summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/teximg.pm
diff options
context:
space:
mode:
authorAmitai Schlair <schmonz@magnetic-babysitter.(none)>2009-08-30 03:02:15 -0400
committerAmitai Schlair <schmonz@magnetic-babysitter.(none)>2009-08-30 03:02:15 -0400
commitc36d2fa896e9ea42c0b6b0135ba04b4f4f60950f (patch)
tree22f1314d8e974c73bde4970c97d497628f2a1465 /IkiWiki/Plugin/teximg.pm
parent5e94e973eeb4ba75d9c37bd801278f686f0977c3 (diff)
parent517432273b96fc9e6bad9b7667ef6d1b04c699ee (diff)
Merge branch 'master' of git://github.com/joeyh/ikiwiki
Diffstat (limited to 'IkiWiki/Plugin/teximg.pm')
-rw-r--r--IkiWiki/Plugin/teximg.pm40
1 files changed, 2 insertions, 38 deletions
diff --git a/IkiWiki/Plugin/teximg.pm b/IkiWiki/Plugin/teximg.pm
index dba5372b5..f92ed0132 100644
--- a/IkiWiki/Plugin/teximg.pm
+++ b/IkiWiki/Plugin/teximg.pm
@@ -69,13 +69,7 @@ sub preprocess (@) {
if (! defined $code && ! length $code) {
error gettext("missing tex code");
}
-
- if (check($code)) {
- return create($code, check_height($height), \%params);
- }
- else {
- error gettext("code includes disallowed latex commands")
- }
+ return create($code, check_height($height), \%params);
}
sub check_height ($) {
@@ -155,7 +149,7 @@ sub gen_image ($$$$) {
my $tmp = eval { create_tmp_dir($digest) };
if (! $@ &&
writefile("$digest.tex", $tmp, $tex) &&
- system("cd $tmp; latex --interaction=nonstopmode $tmp/$digest.tex > /dev/null") == 0 &&
+ system("cd $tmp; shell_escape=f openout_any=p openin_any=p latex --interaction=nonstopmode $digest.tex < /dev/null > /dev/null") == 0 &&
# ensure destination directory exists
writefile("$imagedir/$digest.png", $config{destdir}, "") &&
(($config{teximg_dvipng} &&
@@ -191,34 +185,4 @@ sub create_tmp_dir ($) {
return $tmpdir;
}
-sub check ($) {
- # Check if the code is ok
- my $code = shift;
-
- my @badthings = (
- qr/\$\$/,
- qr/\\include/,
- qr/\\includegraphic/,
- qr/\\usepackage/,
- qr/\\newcommand/,
- qr/\\renewcommand/,
- qr/\\def/,
- qr/\\input/,
- qr/\\open/,
- qr/\\loop/,
- qr/\\errorstopmode/,
- qr/\\scrollmode/,
- qr/\\batchmode/,
- qr/\\read/,
- qr/\\write/,
- );
-
- foreach my $thing (@badthings) {
- if ($code =~ m/$thing/ ) {
- return 0;
- }
- }
- return 1;
-}
-
1