support longname for page types in commands and rename
authorJoey Hess <joey@gnu.kitenet.net>
Thu, 21 May 2009 19:50:25 +0000 (15:50 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Thu, 21 May 2009 19:50:25 +0000 (15:50 -0400)
Also, sort the list of page types.

IkiWiki/Plugin/comments.pm
IkiWiki/Plugin/editpage.pm
IkiWiki/Plugin/rename.pm

index e618d1a90ade4f1a1286e856e1b7ea65cd1fc981..0aa4759d807c3060eed580d58f862c6d22ab9d70 100644 (file)
@@ -287,10 +287,15 @@ sub editcomment ($$) {
        else {
                $type = $config{default_pageext};
        }
+
+
        my @page_types;
        if (exists $IkiWiki::hooks{htmlize}) {
-               @page_types = grep { ! /^_/ } keys %{$IkiWiki::hooks{htmlize}};
+               foreach my $key (grep { !/^_/ } keys %{$IkiWiki::hooks{htmlize}}) {
+                       push @page_types, [$key, $IkiWiki::hooks{htmlize}{$key}{longname} || $key];
+               }
        }
+       @page_types=sort @page_types;
 
        $form->field(name => 'do', type => 'hidden');
        $form->field(name => 'sid', type => 'hidden', value => $session->id,
index af42097baedc2acb46534e9c818e0124ec0dc82b..8effc02d0dbee4b51e3db29d05e9f1b151e576fa 100644 (file)
@@ -280,6 +280,7 @@ sub cgi_editpage ($$) {
                                        push @page_types, [$key, $hooks{htmlize}{$key}{longname} || $key];
                                }
                        }
+                       @page_types=sort @page_types;
                        
                        $form->tmpl_param("page_select", 1);
                        $form->field(name => "page", type => 'select',
index 41af3ca4d61b2495dc0e69e77da6513a2de07373..0b6e74705b29e86330395344140d7b6390db7cf2 100644 (file)
@@ -116,14 +116,16 @@ sub rename_form ($$$) {
                # insert the standard extensions
                my @page_types;
                if (exists $IkiWiki::hooks{htmlize}) {
-                       @page_types=grep { !/^_/ }
-                               keys %{$IkiWiki::hooks{htmlize}};
+                       foreach my $key (grep { !/^_/ } keys %{$IkiWiki::hooks{htmlize}}) {
+                               push @page_types, [$key, $IkiWiki::hooks{htmlize}{$key}{longname} || $key];
+                       }
                }
+               @page_types=sort @page_types;
        
                # make sure the current extension is in the list
                my ($ext) = $pagesources{$page}=~/\.([^.]+)$/;
                if (! $IkiWiki::hooks{htmlize}{$ext}) {
-                       unshift(@page_types, $ext);
+                       unshift(@page_types, [$ext, $ext]);
                }
        
                $f->field(name => "type", type => 'select',