X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/4a3dc37eafeb45b82c0452cca8a1328e974a583c..0c3291d4f32efd1ccfcfca86429db67e7b1a0c35:/IkiWiki/Plugin/teximg.pm diff --git a/IkiWiki/Plugin/teximg.pm b/IkiWiki/Plugin/teximg.pm index 8c3e88c69..369c10882 100644 --- a/IkiWiki/Plugin/teximg.pm +++ b/IkiWiki/Plugin/teximg.pm @@ -11,9 +11,18 @@ use HTML::Entities; use IkiWiki 2.00; sub import { #{{{ + hook(type => "getsetup", id => "teximg", call => \&getsetup); hook(type => "preprocess", id => "teximg", call => \&preprocess); } #}}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => undef, + }, +} #}}} + sub preprocess (@) { #{{{ my %params = @_; @@ -27,14 +36,14 @@ sub preprocess (@) { #{{{ my $code = $params{code}; if (! defined $code && ! length $code) { - return "[[teximg ".gettext("missing tex code"). "]]"; + error gettext("missing tex code"); } if (check($code)) { return create($code, check_height($height), \%params); } else { - return "[[teximg ".gettext("code includes disallowed latex commands"). "]]"; + error gettext("code includes disallowed latex commands") } } #}}} @@ -85,7 +94,7 @@ sub create ($$$) { #{{{ .qq{" class="teximg" />}; } else { - return qq{[[teximg }.gettext("failed to generate image from code")."]]"; + error qq{}.gettext("failed to generate image from code").""; } } #}}}