From 78a1a24dd8da1a3f07e1b09a6f26e6fc32312938 Mon Sep 17 00:00:00 2001 From: Abdo Roig-Maranges Date: Sat, 2 Dec 2017 19:23:44 +0100 Subject: [PATCH 1/2] adapt to command-line change in pandoc 2.0 pandoc 2 has removed -S from the command line. Instead we must add +smart as an extension to the format. --- Makefile | 4 ++-- scripts/pandoc-sh | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d4d0f71..0cfa755 100644 --- a/Makefile +++ b/Makefile @@ -263,7 +263,7 @@ man/%.1: markdown_src/%.md @if command -v pandoc >/dev/null; then \ echo 'generating $@'; \ ${MKPATH} `dirname '$@'` 2>/dev/null || true; \ - ${PANDOC} -Ss -f markdown_github $< -o $@; \ + ${PANDOC} -s -f markdown_github $< -o $@; \ else \ if [ ! -r docs-warn-stamp ]; then \ echo >&2; \ @@ -283,7 +283,7 @@ html/%.html: %.md.work @if command -v pandoc >/dev/null; then \ echo 'generating $@'; \ ${MKPATH} `dirname '$@'` 2>/dev/null || true; \ - ${PANDOC} -Ss --toc -f markdown_github $< -o $@; \ + ${PANDOC} -s --toc -f markdown_github $< -o $@; \ rm -f $<; \ else \ if [ ! -r docs-warn-stamp ]; then \ diff --git a/scripts/pandoc-sh b/scripts/pandoc-sh index 03cb265..7a6e8bf 100755 --- a/scripts/pandoc-sh +++ b/scripts/pandoc-sh @@ -33,13 +33,20 @@ fi first_arg=1 for arg in "$@"; do - [ $first_arg -eq 1 ] && set -- && first_arg=0 + if [ $first_arg -eq 1 ]; then + if [ $old_pandoc -eq 1 ]; then + set -- "-S" + else + set -- + fi + first_arg=0 + fi if [ "$arg" = markdown_github ]; then if [ $old_pandoc -eq 1 ]; then set -- "$@" markdown else - set -- "$@" markdown_github+pandoc_title_block + set -- "$@" markdown_github+pandoc_title_block+smart fi else set -- "$@" "$arg" From 07905e4c445d963dd34f3f46caad84e1472a210c Mon Sep 17 00:00:00 2001 From: Abdo Roig-Maranges Date: Sat, 2 Dec 2017 20:02:04 +0100 Subject: [PATCH 2/2] pandoc feature detection was broken for new pandoc Pandoc no longer prints input formats in --help, so we cannot detect availability of markdown_github this way. There is a --list-input-formats command line argument, but it was introduced recently. So, let's check by version. markdown_github was introduced in version 1.10. --- scripts/pandoc-sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/pandoc-sh b/scripts/pandoc-sh index 7a6e8bf..44ec603 100755 --- a/scripts/pandoc-sh +++ b/scripts/pandoc-sh @@ -27,7 +27,11 @@ title="`echo \"$title\" | \ # use markdown instead of markdown_github on older versions # and markdown_github+pandoc_title_block on newer ones old_pandoc=0 -if ! ( pandoc --help | grep markdown_github >/dev/null ); then +pandoc_version=$(pandoc --version | head -1 | cut -d' ' -f2) +pandoc_major_version=${pandoc_version%%.*} +pandoc_minor_version=${pandoc_version#*.} +pandoc_minor_version=${pandoc_minor_version%%.*} +if [ $pandoc_major_version -le 1 ] && [ $pandoc_minor_version -le 9 ]; then old_pandoc=1 fi