From ec595c9d4f04b7e10656e9617f58cd21f0e23f31 Mon Sep 17 00:00:00 2001 From: Gustav Eek Date: Sun, 6 Oct 2019 00:28:12 +0200 Subject: Update Pandoc plugin for Ikiwiki to upstream HEAD Pandoc plugin, *pandoc.pm*, is updated for the upstream HEAD: >https://github.com/sciunto-org/ikiwiki-pandoc.git> > e0b6a52 > 2019-02-02T18:52:47+00:00 > Merge pull request #23 from mletterle/format-arg > baldur.kristinsson@gmail.com In Pandoc 2.2.1, packaged for Debian 10 Buster, options `--smart/-S` are removed as well as `--normalize`. Normalisation is default and one should use `+smart` or `-smart` extension instead. This version of the Ikiwiki plugin is compatible for those --- .ikiwiki/IkiWiki/Plugin/pandoc.pm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to '.ikiwiki') 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 } -- cgit v1.2.3