diff options
author | Simon McVittie <smcv@debian.org> | 2014-07-01 08:23:13 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2014-09-01 08:54:37 +0100 |
commit | 4a11dc4d16463ed0afaf387d0c33d00ba639f52e (patch) | |
tree | 2dc2a287b0e3a1670657eb7820d425ffdbd48735 /IkiWiki | |
parent | 7aa10a2952a0d0ee8543f575966f7e4a780c993c (diff) | |
download | ikiwiki-4a11dc4d16463ed0afaf387d0c33d00ba639f52e.tar ikiwiki-4a11dc4d16463ed0afaf387d0c33d00ba639f52e.tar.gz |
edittemplate: only generate a UUID on-demand
If the template doesn't use <TMPL_VAR UUID> there's no point in
incurring any cost.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/edittemplate.pm | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm index 6e8c256da..b408dfcac 100644 --- a/IkiWiki/Plugin/edittemplate.pm +++ b/IkiWiki/Plugin/edittemplate.pm @@ -139,13 +139,15 @@ sub filltemplate ($$) { $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); - }; + if ($template->query(name => 'uuid')) { + eval { + require UUID::Tiny; + UUID::Tiny->import(':std'); + my $uuid; + $uuid = create_uuid_as_string(UUID_V4()); + $template->param(uuid => $uuid); + }; + } return $template->output; } |