From 06953664b9903fc9e1736e8283b90c80a2ed1a5a Mon Sep 17 00:00:00 2001
From: Christian Krause <christian.krause@mailbox.org>
Date: Wed, 4 Dec 2019 10:46:49 +0100
Subject: [PATCH] fixes pandoc version dependent engine option name

---
 Makefile | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 1020fc0..7e1d2a8 100644
--- a/Makefile
+++ b/Makefile
@@ -12,12 +12,20 @@ TITLE = title
 # -----------------------------------------------------------------------------
 
 PANDOC = pandoc
+PANDOC_MAJOR_VERSION := \
+	$(shell pandoc -v | awk -F "[ .]" 'NR==1 { print $$2 }')
 
-PANDOCFLAGS = \
+ifeq ($(shell test $(PANDOC_MAJOR_VERSION) -lt 2; echo $$?), 0)
+	PANDOC_PDF_ENGINE_OPT_NAME = latex-engine
+else
+	PANDOC_PDF_ENGINE_OPT_NAME = pdf-engine
+endif
+
+PANDOC_PDF_OPTIONS = \
 	--fail-if-warnings \
 	--standalone \
 	--filter pandoc-citeproc \
-	--pdf-engine=xelatex \
+	--$(PANDOC_PDF_ENGINE_OPT_NAME)=xelatex \
 
 # -----------------------------------------------------------------------------
 # sources
@@ -43,7 +51,7 @@ $(SUBDIRS):
 subdirs: $(SUBDIRS)
 
 $(TITLE).pdf: $(SUBDIRS) metadata.yml $(SOURCES_CSV) $(SOURCES_MD)
-	$(PANDOC) $(PANDOCFLAGS) -o $@ metadata.yml $(SOURCES_MD)
+	$(PANDOC) $(PANDOC_PDF_OPTIONS) -o $@ metadata.yml $(SOURCES_MD)
 
 check: spellcheck
 
-- 
GitLab