use Digest::MD5 qw(md5_hex);
use File::Temp qw(tempdir);
use HTML::Entities;
-use IkiWiki 2.00;
+use IkiWiki 3.00;
my $default_prefix = <<EOPREFIX;
\\documentclass{article}
my $default_postfix = '\\end{document}';
-sub import { #{{{
+sub import {
hook(type => "getsetup", id => "teximg", call => \&getsetup);
hook(type => "preprocess", id => "teximg", call => \&preprocess);
-} #}}}
+}
-sub getsetup () { #{{{
+sub getsetup () {
return
plugin => {
safe => 1,
safe => 0, # Not sure how secure LaTeX is...
rebuild => 1,
},
-} #}}}
+}
-sub preprocess (@) { #{{{
+sub preprocess (@) {
my %params = @_;
my $height = $params{height};
else {
error gettext("code includes disallowed latex commands")
}
-} #}}}
+}
-sub check_height ($) { #{{{
+sub check_height ($) {
# Since latex doesn't support unlimited scaling this function
# returns the closest supported size.
my $height =shift;
}
}
return $ret;
-} #}}}
+}
-sub create ($$$) { #{{{
+sub create ($$$) {
# This function calls the image generating function and returns
# the <img .. /> for the generated image.
my $code = shift;
else {
error qq{<a href="$logurl">}.gettext("failed to generate image from code")."</a>";
}
-} #}}}
+}
-sub gen_image ($$$$) { #{{{
+sub gen_image ($$$$) {
# Actually creates the image.
my $code = shift;
my $height = shift;
return 0;
}
-} #}}}
+}
-sub create_tmp_dir ($) { #{{{
+sub create_tmp_dir ($) {
# Create a temp directory, it will be removed when ikiwiki exits.
my $base = shift;
my $template = $base.".XXXXXXXXXX";
my $tmpdir = tempdir($template, TMPDIR => 1, CLEANUP => 1);
return $tmpdir;
-} #}}}
+}
-sub check ($) { #{{{
+sub check ($) {
# Check if the code is ok
my $code = shift;
}
}
return 1;
-} #}}}
+}
1