Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix manpage build with pandoc 2.0 #228

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand All @@ -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 \
Expand Down
17 changes: 14 additions & 3 deletions scripts/pandoc-sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,30 @@ 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

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"
Expand Down