Last active
January 8, 2023 17:05
-
-
Save alexklapheke/e0c35e3cb8460b27c59554fdd35ce588 to your computer and use it in GitHub Desktop.
Pandoc Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
templatedir = $(HOME)/.pandoc/templates | |
bibfile = $(HOME)/texmf/bibtex/bib/references.bib | |
template = custom | |
number = # --number-sections | |
toc = --toc | |
# For knitr: | |
# Rscript --slave -e "library(knitr);knit('test.Rmd')" | |
# Rscript --slave -e "library(knitr);pandoc('test.md')" | |
# HTML to markdown (creates circular dependency) | |
# mkd : $(patsubst %.html,%.mkd,$(wildcard *.html)) | |
# %.mkd : %.html | |
# pandoc -t markdown-raw_html -V 'lang=en-US' \ | |
# --wrap=none \ | |
# --atx-headers \ | |
# -o $@ $< | |
html : $(patsubst %.mkd,%.html,$(wildcard *.mkd)) | |
%.html : %.mkd | |
pandoc -t html -V 'lang=en-US' \ | |
--standalone \ | |
--smart \ | |
--mathml \ | |
--section-divs \ | |
$(number) \ | |
$(toc) \ | |
--ascii \ | |
--filter=$(HOME)/.pandoc/checkmarks.hs \ | |
--filter=$(HOME)/.pandoc/parallel.hs \ | |
--css=$(templatedir)/css/$(template).css \ | |
--include-in-header=$(templatedir)/html-header.html \ | |
--bibliography=$(bibfile) \ | |
-o $@ $< | |
standalone.html : $(patsubst %.mkd,%.html,$(wildcard *.mkd)) | |
%.standalone.html : %.mkd | |
pandoc -t html -V 'lang=en-US' \ | |
--standalone \ | |
--self-contained \ | |
--smart \ | |
--mathml \ | |
--section-divs \ | |
$(toc) \ | |
--ascii \ | |
--filter=$(HOME)/.pandoc/checkmarks.hs \ | |
--filter=$(HOME)/.pandoc/parallel.hs \ | |
--css=$(templatedir)/css/$(template).css \ | |
--bibliography=$(bibfile) \ | |
-o $@ $< | |
slidy.html : $(patsubst %.mkd,%.html,$(wildcard *.mkd)) | |
%.slidy.html : %.mkd | |
pandoc -t slidy -V 'lang=en-US' \ | |
--standalone \ | |
--smart \ | |
--mathml \ | |
--ascii \ | |
--filter=$(HOME)/.pandoc/checkmarks.hs \ | |
--filter=$(HOME)/.pandoc/parallel.hs \ | |
-V slidy-url=$(templatedir)/slidy \ | |
--bibliography=$(bibfile) \ | |
-o $@ $< | |
slideous.html : $(patsubst %.mkd,%.html,$(wildcard *.mkd)) | |
%.slideous.html : %.mkd | |
pandoc -t slideous -V 'lang=en-US' \ | |
--standalone \ | |
--smart \ | |
--mathml \ | |
--ascii \ | |
--filter=$(HOME)/.pandoc/checkmarks.hs \ | |
--filter=$(HOME)/.pandoc/parallel.hs \ | |
-V slideous-url=$(templatedir)/slideous \ | |
--bibliography=$(bibfile) \ | |
-o $@ $< | |
s5.html : $(patsubst %.mkd,%.html,$(wildcard *.mkd)) | |
%.s5.html : %.mkd | |
pandoc -t s5 -V 'lang=en-US' \ | |
--standalone \ | |
--smart \ | |
--mathml \ | |
--ascii \ | |
--filter=$(HOME)/.pandoc/checkmarks.hs \ | |
--filter=$(HOME)/.pandoc/parallel.hs \ | |
-V s5-url=$(templatedir)/s5 \ | |
--bibliography=$(bibfile) \ | |
-o $@ $< | |
dzslides.html : $(patsubst %.mkd,%.html,$(wildcard *.mkd)) | |
%.dzslides.html : %.mkd | |
pandoc -t dzslides -V 'lang=en-US' \ | |
--standalone \ | |
--smart \ | |
--mathml \ | |
--ascii \ | |
--filter=$(HOME)/.pandoc/checkmarks.hs \ | |
--filter=$(HOME)/.pandoc/parallel.hs \ | |
--bibliography=$(bibfile) \ | |
-o $@ $< | |
revealjs.html : $(patsubst %.mkd,%.html,$(wildcard *.mkd)) | |
%.revealjs.html : %.mkd | |
pandoc -t revealjs -V 'lang=en-US' \ | |
--standalone \ | |
--smart \ | |
--mathml \ | |
--ascii \ | |
--filter=$(HOME)/.pandoc/checkmarks.hs \ | |
--filter=$(HOME)/.pandoc/parallel.hs \ | |
-V revealjs-url=$(templatedir)/reveal.js \ | |
--bibliography=$(bibfile) \ | |
-o $@ $< | |
tex : $(patsubst %.mkd,%.tex,$(wildcard *.mkd)) | |
latex : $(patsubst %.mkd,%.tex,$(wildcard *.mkd)) | |
%.tex : %.mkd | |
pandoc -t latex \ | |
--standalone \ | |
--smart \ | |
--wrap=preserve \ | |
--listings \ | |
--template=$(template) \ | |
--filter=$(HOME)/.pandoc/parallel.hs \ | |
--filter pandoc-crossref \ | |
--natbib \ | |
-o $@ $< | |
beamer.tex : $(patsubst %.mkd,%.tex,$(wildcard *.mkd)) | |
%.beamer.tex : %.mkd | |
pandoc -t beamer \ | |
--standalone \ | |
--smart \ | |
--wrap=preserve \ | |
--listings \ | |
--filter=$(HOME)/.pandoc/parallel.hs \ | |
--filter=alert.hs \ | |
--filter pandoc-crossref \ | |
-V theme=metropolis \ | |
--natbib \ | |
-o $@ $< | |
pdf : $(patsubst %.mkd,%.pdf,$(wildcard *.mkd)) | |
%.pdf : %.mkd | |
pandoc -t latex \ | |
--latex-engine=xelatex \ | |
--smart \ | |
--wrap=preserve \ | |
--listings \ | |
--template=$(template) \ | |
--filter=$(HOME)/.pandoc/parallel.hs \ | |
--filter pandoc-crossref \ | |
--natbib \ | |
-o $@ $< | |
beamer.pdf : $(patsubst %.mkd,%.pdf,$(wildcard *.mkd)) | |
%.beamer.pdf : %.mkd | |
pandoc -t beamer \ | |
--latex-engine=xelatex \ | |
--smart \ | |
--wrap=preserve \ | |
--listings \ | |
--filter=$(HOME)/.pandoc/parallel.hs \ | |
--filter=alert.hs \ | |
--filter pandoc-crossref \ | |
-V theme=metropolis \ | |
--natbib \ | |
-o $@ $< | |
epub : $(patsubst %.mkd,%.epub,$(wildcard *.mkd)) | |
epubcover = $(patsubst %.mkd,%.jpg,$(wildcard *.mkd)) | |
%.epub : %.mkd | |
ifneq ("$(wildcard $(epubcover))","") | |
pandoc -t epub \ | |
--standalone \ | |
--smart \ | |
--mathml \ | |
--filter=$(HOME)/.pandoc/checkmarks.hs \ | |
--filter=$(HOME)/.pandoc/parallel.hs \ | |
--epub-cover-image=$(patsubst %.mkd,%.jpg,$<) \ | |
-o $@ $< | |
else | |
pandoc -t epub \ | |
--standalone \ | |
--smart \ | |
--mathml \ | |
--filter=$(HOME)/.pandoc/checkmarks.hs \ | |
--filter=$(HOME)/.pandoc/parallel.hs \ | |
-o $@ $< | |
endif | |
sep.epub : $(patsubst %.mkd,%.epub,$(wildcard *.mkd)) | |
%.sep.epub : %.mkd | |
pandoc -t epub \ | |
-f markdown \ | |
--standalone \ | |
--smart \ | |
--mathml \ | |
--template='sep' \ | |
-o $@ $< | |
# --reference-docx=$(templatedir)/reference.docx | |
docx : $(patsubst %.mkd,%.docx,$(wildcard *.mkd)) | |
%.docx : %.mkd | |
pandoc -t docx \ | |
--standalone \ | |
--smart \ | |
--mathml \ | |
--toc \ | |
--toc-depth=2 \ | |
--number-sections \ | |
--reference-docx=$(templatedir)/reference.docx \ | |
-o $@ $< | |
odt : $(patsubst %.mkd,%.odt,$(wildcard *.mkd)) | |
%.odt : %.mkd | |
pandoc -t odt \ | |
--standalone \ | |
--smart \ | |
--mathml \ | |
-o $@ $< |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment