]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/tag.pm
tag_autocreate fixups
[git.ikiwiki.info.git] / IkiWiki / Plugin / tag.pm
index 9e6f417bf712535b3192ddf84e0858a6af758121..1145a9f130966d4c69b1a6ce6b8373fdbaf0eafd 100644 (file)
@@ -37,9 +37,9 @@ sub getsetup () {
                tag_autocreate => {
                        type => "boolean",
                        example => 0,
-                       description => "Autocreate new tag pages",
+                       description => "autocreate new tag pages?",
                        safe => 1,
-                       rebuild => 1,
+                       rebuild => undef,
                },
 }
 
@@ -66,17 +66,17 @@ sub taglink ($$$;@) {
 
 sub gentag ($) {
        my $tag=shift;
-       if (defined $config{tag_autocreate} && $config{tag_autocreate}) {
+       if ($config{tag_autocreate}) {
                my $tagfile = newpagefile(tagpage($tag), $config{default_pageext});
                $tagfile=~s/^\///;
 
-               return if (! add_autofile($tagfile, "tag"));
-
-               debug(sprintf(gettext("creating tag page %s"), $tag));
+               add_autofile($tagfile, sub {
+                       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);
+               });
        }
 }