support longname for page types in commands and rename

Also, sort the list of page types.
master
Joey Hess 2009-05-21 15:50:25 -04:00
parent 36dbd21be6
commit 27193a2eeb
3 changed files with 12 additions and 4 deletions

View File

@ -287,10 +287,15 @@ sub editcomment ($$) {
else { else {
$type = $config{default_pageext}; $type = $config{default_pageext};
} }
my @page_types; my @page_types;
if (exists $IkiWiki::hooks{htmlize}) { 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 => 'do', type => 'hidden');
$form->field(name => 'sid', type => 'hidden', value => $session->id, $form->field(name => 'sid', type => 'hidden', value => $session->id,

View File

@ -280,6 +280,7 @@ sub cgi_editpage ($$) {
push @page_types, [$key, $hooks{htmlize}{$key}{longname} || $key]; push @page_types, [$key, $hooks{htmlize}{$key}{longname} || $key];
} }
} }
@page_types=sort @page_types;
$form->tmpl_param("page_select", 1); $form->tmpl_param("page_select", 1);
$form->field(name => "page", type => 'select', $form->field(name => "page", type => 'select',

View File

@ -116,14 +116,16 @@ sub rename_form ($$$) {
# insert the standard extensions # insert the standard extensions
my @page_types; my @page_types;
if (exists $IkiWiki::hooks{htmlize}) { if (exists $IkiWiki::hooks{htmlize}) {
@page_types=grep { !/^_/ } foreach my $key (grep { !/^_/ } keys %{$IkiWiki::hooks{htmlize}}) {
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 # make sure the current extension is in the list
my ($ext) = $pagesources{$page}=~/\.([^.]+)$/; my ($ext) = $pagesources{$page}=~/\.([^.]+)$/;
if (! $IkiWiki::hooks{htmlize}{$ext}) { if (! $IkiWiki::hooks{htmlize}{$ext}) {
unshift(@page_types, $ext); unshift(@page_types, [$ext, $ext]);
} }
$f->field(name => "type", type => 'select', $f->field(name => "type", type => 'select',