Skip to content

Commit

Permalink
Added version check for pandoc 1 vs 2 for --smart vs -smart
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocode committed Mar 14, 2018
1 parent ce0e752 commit aa6f977
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ STYLE=chmduquesne

all: html pdf docx rtf

pdf: dir
pdf: init
for f in $(IN_DIR)/*.md; do \
FILE_NAME=`basename $$f | sed 's/.md//g'`; \
echo $$FILE_NAME.pdf; \
Expand All @@ -17,7 +17,7 @@ pdf: dir
--result=$(OUT_DIR)/$$FILE_NAME.pdf > $(OUT_DIR)/context_$$FILE_NAME.log 2>&1; \
done

html: dir
html: init
for f in $(IN_DIR)/*.md; do \
FILE_NAME=`basename $$f | sed 's/.md//g'`; \
echo $$FILE_NAME.html; \
Expand All @@ -26,22 +26,32 @@ html: dir
--output $(OUT_DIR)/$$FILE_NAME.html $$f; \
done

docx: dir
docx: init
for f in $(IN_DIR)/*.md; do \
FILE_NAME=`basename $$f | sed 's/.md//g'`; \
echo $$FILE_NAME.docx; \
pandoc --standalone --smart $$f --output $(OUT_DIR)/$$FILE_NAME.docx; \
pandoc --standalone $$SMART $$f --output $(OUT_DIR)/$$FILE_NAME.docx; \
done

rtf: dir
rtf: init
for f in $(IN_DIR)/*.md; do \
FILE_NAME=`basename $$f | sed 's/.md//g'`; \
echo $$FILE_NAME.rtf; \
pandoc --standalone --smart $$f --output $(OUT_DIR)/$$FILE_NAME.rtf; \
pandoc --standalone $$SMART $$f --output $(OUT_DIR)/$$FILE_NAME.rtf; \
done

init: dir version

dir:
mkdir -p $(OUT_DIR)

version:
PANDOC_VERSION=`pandoc --version | head -1 | cut -d' ' -f2 | cut -d'.' -f1`; \
if [ "$$PANDOC_VERSION" -eq "2" ]; then \
SMART=-smart; \
else \
SMART=--smart; \
fi \

clean:
rm -f $(OUT_DIR)/*

0 comments on commit aa6f977

Please sign in to comment.