]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/edittemplate.pm
Provide a UUID in edittemplate templates.
[ikiwiki.git] / IkiWiki / Plugin / edittemplate.pm
index c7f1e4fa7f7117660b5d89207a1795caec9fc6af..6e8c256da3fdca36addcf8a12a767a6c90d68019 100644 (file)
@@ -130,13 +130,23 @@ sub filltemplate ($$) {
                $template=template("/".$template_page);
        };
        if ($@) {
+               # gettext can clobber $@
+               my $error = $@;
                # Indicate that the earlier preprocessor directive set 
                # up a template that doesn't work.
-               return "[[!edittemplate ".gettext("failed to process template:")." $@]]";
+               return "[[!edittemplate ".gettext("failed to process template:")." $error]]";
        }
 
        $template->param(name => $page);
 
+       eval {
+               require UUID::Tiny;
+               UUID::Tiny->import(':std');
+               my $uuid;
+               $uuid = create_uuid_as_string(UUID_V4());
+               $template->param(uuid => $uuid);
+       };
+
        return $template->output;
 }