diff options
author | Joey Hess <joey@kitenet.net> | 2010-04-17 13:35:15 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-04-17 13:35:15 -0400 |
commit | b7d50abc0f3dbe99d2a3664c12ea95d24bfcf04b (patch) | |
tree | bd716da03086a6c47df994723d424454c090649d /IkiWiki/Plugin | |
parent | 2269a4c74b24378d8e7e2229ca3374a197d08d9c (diff) | |
download | ikiwiki-b7d50abc0f3dbe99d2a3664c12ea95d24bfcf04b.tar ikiwiki-b7d50abc0f3dbe99d2a3664c12ea95d24bfcf04b.tar.gz |
refactor autofiles
Made add_autofile take a generator function, and just register the
autofile, for later possible creation. The testing is moved into Render,
which allows cleaning up some stuff.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/tag.pm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index 9e6f417bf..7a918a4e8 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -70,13 +70,13 @@ sub gentag ($) { my $tagfile = newpagefile(tagpage($tag), $config{default_pageext}); $tagfile=~s/^\///; - return if (! add_autofile($tagfile, "tag")); + add_autofile($tagfile, sub { + debug(sprintf(gettext("creating tag page %s"), $tag)); - debug(sprintf(gettext("creating tag page %s"), $tag)); - - my $template=template("autotag.tmpl"); - $template->param(tag => $tag); - writefile($tagfile, $config{srcdir}, $template->output); + my $template=template("autotag.tmpl"); + $template->param(tag => $tag); + writefile($tagfile, $config{srcdir}, $template->output); + }); } } |