diff options
author | Gustav Eek <gustav.eek@fripost.org> | 2019-10-06 00:47:09 +0200 |
---|---|---|
committer | Gustav Eek <gustav.eek@fripost.org> | 2019-10-06 00:47:09 +0200 |
commit | d26cf0a5468a87a1fba327eff2ad06fae2b9ff6d (patch) | |
tree | b58642b8c889260ec70349c454fd923fb1ee3cef | |
parent | a26aa95cc1e3feca18c9fb053fbe4ef53635eb7c (diff) | |
parent | 4cce91fd9356b3c5f440382bdd498f11ec7f1362 (diff) |
Merge branch 'master' into create-wiki-preview
-rwxr-xr-x | .ikiwiki/IkiWiki/Plugin/pandoc.pm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/.ikiwiki/IkiWiki/Plugin/pandoc.pm b/.ikiwiki/IkiWiki/Plugin/pandoc.pm index 25081ef..da13763 100755 --- a/.ikiwiki/IkiWiki/Plugin/pandoc.pm +++ b/.ikiwiki/IkiWiki/Plugin/pandoc.pm @@ -96,6 +96,13 @@ sub getsetup () { safe => 1, rebuild => 1, }, + pandoc_markdown_fmt => { + type => "string", + example => "markdown", + description => "Format string to use when processing files handled by Pandoc.", + safe => 1, + rebuild => 1, + }, pandoc_latex => { type => "boolean", example => 0, @@ -409,10 +416,11 @@ sub htmlize ($@) { # can be parsed out # We must omit the 'bibliography' parameter here, otherwise the list of # references will be doubled. + my $markdown_fmt = $config{pandoc_markdown_fmt} || 'markdown'; my $to_json_pid = open2(*JSON_OUT, *PANDOC_OUT, $command, - '-f', $format, + '-f', $markdown_fmt, '-t', 'json', - @args, '--normalize'); + @args); error("Unable to open $command") unless $to_json_pid; # Workaround for perl bug (#376329) @@ -435,8 +443,8 @@ sub htmlize ($@) { my $meta = undef; my $decoded_json = decode_json($json_content); # The representation of the meta block changed in pandoc version 1.18 - if (ref $decoded_json eq 'HASH' && $decoded_json->{'Meta'}) { - $meta = $decoded_json->{'Meta'} || {}; # post-1.18 version + if (ref $decoded_json eq 'HASH' && $decoded_json->{'meta'}) { + $meta = $decoded_json->{'meta'} || {}; # post-1.18 version } elsif (ref $decoded_json eq 'ARRAY') { $meta = $decoded_json->[0]->{'unMeta'} || {}; # pre-1.18 version } |