From 374d30f09234c0cfebc0f112dfe9005b759fe239 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 25 Mar 2019 13:07:39 +0100 Subject: [PATCH] Fix code formatting bug in the ncdc man page --- Makefile | 8 +++++--- mkpod.pl | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 2721dcd..4f8f538 100644 --- a/Makefile +++ b/Makefile @@ -108,12 +108,14 @@ ${FETCH}: dat/%: # There is a 'pod2markdown' program, but going through HTML with a little bit # of Perl magic tends to give better results, if only because definition lists # are properly converted this way and I have more control over links. +# The final pass through perl is to fix a pandoc bug where a code block as the +# first thing inside a definition does not survive a round-trip. ${POD_MD}: dat/%.md: dat/%.pod mkpod.pl @echo "POD $*" @cat "$<" | ./mkpod.pl |\ - pandoc -f html -t markdown -s -o "$@" \ - --metadata title="${shell for i in ${PAGES}; do case "$$i" in "$*.pod "*) echo "$$i" | sed -E 's/[^ ]+ +[^ ]+ +//';; esac; done}" - @rm -f pod2htmd.tmp pod2html.tmp + pandoc -f html -t markdown -s \ + --metadata title="${shell for i in ${PAGES}; do case "$$i" in "$*.pod "*) echo "$$i" | sed -E 's/[^ ]+ +[^ ]+ +//';; esac; done}" |\ + perl -e '$$/=undef; print (scalar(<>) =~ s/: ([^\s].*)\n ([^\s].*)/: $$1\n $$2/gr)' >"$@" ${CHANGES_MD}: dat/%.md: dat/%.log mkchangelog.pl diff --git a/mkpod.pl b/mkpod.pl index d1edb87..aacf00a 100755 --- a/mkpod.pl +++ b/mkpod.pl @@ -49,7 +49,7 @@ $p->parse_file(\*STDIN); # Some post-processing to improve the pandoc-generated markdown $html =~ s/^ //mg; -$html =~ s/ //g; +$html =~ s/ //g; $html =~ s/
  • /

  • /g; print $html;