diff options
-rw-r--r-- | IkiWiki/Plugin/edittemplate.pm | 14 | ||||
-rw-r--r-- | IkiWiki/Plugin/progress.pm | 5 | ||||
-rw-r--r-- | debian/changelog | 4 | ||||
-rw-r--r-- | doc/todo/Allow_edittemplate_to_set_file_type.mdwn | 4 |
4 files changed, 22 insertions, 5 deletions
diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm index 98308de13..4d4117c15 100644 --- a/IkiWiki/Plugin/edittemplate.pm +++ b/IkiWiki/Plugin/edittemplate.pm @@ -56,8 +56,14 @@ sub preprocess (@) { #{{{ $pagestate{$params{page}}{edittemplate}{$params{match}}=$params{template}; + return "" if ($params{silent} && IkiWiki::yesno($params{silent})); + + my $link=IkiWiki::linkpage($params{template}); + add_depends($params{page}, $link); + my $linkHTML = htmllink($params{page}, $params{destpage}, $link); + return sprintf(gettext("edittemplate %s registered for %s"), - $params{template}, $params{match}); + $linkHTML, $params{match}); } # }}} sub formbuilder (@) { #{{{ @@ -87,8 +93,12 @@ sub formbuilder (@) { #{{{ if (exists $pagestate{$registering_page}{edittemplate}) { foreach my $pagespec (sort keys %{$pagestate{$registering_page}{edittemplate}}) { if (pagespec_match($p, $pagespec, location => $registering_page)) { + my $template=$pagestate{$registering_page}{edittemplate}{$pagespec}; $form->field(name => "editcontent", - value => filltemplate($pagestate{$registering_page}{edittemplate}{$pagespec}, $page)); + value => filltemplate($template, $page)); + $form->field(name => "type", + value => pagetype($pagesources{$template})) + if $pagesources{$template}; return; } } diff --git a/IkiWiki/Plugin/progress.pm b/IkiWiki/Plugin/progress.pm index 2c015284e..e536f4e23 100644 --- a/IkiWiki/Plugin/progress.pm +++ b/IkiWiki/Plugin/progress.pm @@ -29,12 +29,11 @@ sub preprocess (@) { #{{{ if (defined $params{percent}) { $fill = $params{percent}; ($fill) = $fill =~ m/($percentage_pattern)/; # fill is untainted now + $fill=~s/%$//; if (! defined $fill || ! length $fill || $fill > 100 || $fill < 0) { error(sprintf(gettext("illegal percent value %s"), $params{percent})); } - elsif ($fill !~ /%$/) { - $fill.="%"; - } + $fill.="%"; } elsif (defined $params{totalpages} and defined $params{donepages}) { add_depends($params{page}, $params{totalpages}); diff --git a/debian/changelog b/debian/changelog index a44b89058..6019e3960 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,10 @@ ikiwiki (2.65) UNRELEASED; urgency=low * Fix reversion in use of ikiwiki -verbose -setup with a setup file that enables syslog. Setup output is once again output to stdout in this case. + * edittemplate: Default new page file type to the same type as the template. + (willu) + * edittemplate: Add "silent" parameter. (Willu) + * edittemplate: Link to template, to allow creating it. (Willu) -- Joey Hess <joeyh@debian.org> Wed, 17 Sep 2008 14:26:56 -0400 diff --git a/doc/todo/Allow_edittemplate_to_set_file_type.mdwn b/doc/todo/Allow_edittemplate_to_set_file_type.mdwn index 9981c530b..b49968c18 100644 --- a/doc/todo/Allow_edittemplate_to_set_file_type.mdwn +++ b/doc/todo/Allow_edittemplate_to_set_file_type.mdwn @@ -5,6 +5,9 @@ Below is a [[patch]] to [[plugins/edittemplate]] that does a few things: * It makes the description of what was registered link to the template page (which gives feedback for typos or allows template creation) * It adds a colon to the standard string correcting the syntax. +[[done]] except for the colon change; it's referring to the template as an +edittemplate there. --[[Joey]] + ---- diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm @@ -38,3 +41,4 @@ Below is a [[patch]] to [[plugins/edittemplate]] that does a few things: return; } } + |