Skip to content

Commit

Permalink
support older pandoc #146
Browse files Browse the repository at this point in the history
Don't use -M or markdown_github on pandoc versions that do not support
them (like on ubuntu 14 and earlier.)
  • Loading branch information
rkitover committed Apr 29, 2016
1 parent d44b3a5 commit 78a7652
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion scripts/pandoc-sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh

# Add metadata to generated docs.
# Add metadata to generated docs (if supported)
if pandoc --help | grep '^ *-M ' >/dev/null; then

# Make section title for man pages.
title=`echo "$@" | \
Expand Down Expand Up @@ -37,4 +38,21 @@ IFS="$OLDIFS"

set -- "$@" -M date="`date +'%B %d, %Y'`"

fi # metadata

# use markdown instead of markdown_github on older versions
if ! ( pandoc --help | grep markdown_github >/dev/null ); then
first_arg=1

for arg in "$@"; do
[ $first_arg -eq 1 ] && set -- && first_arg=0

if [ "$arg" = markdown_github ]; then
set -- "$@" markdown
else
set -- "$@" "$arg"
fi
done
fi

pandoc "$@"

0 comments on commit 78a7652

Please sign in to comment.