Skip to content

Instantly share code, notes, and snippets.

@manuelp
Last active May 26, 2019 00:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manuelp/b3ea6e74c358661d444a to your computer and use it in GitHub Desktop.
Save manuelp/b3ea6e74c358661d444a to your computer and use it in GitHub Desktop.
Makefile for producing documents with Asciidoctor + Pandoc
BASE_NAME=sample-document
all: $(BASE_NAME).html $(BASE_NAME).pdf $(BASE_NAME).xml $(BASE_NAME).docx $(BASE_NAME).epub $(BASE_NAME).md $(BASE_NAME).confluence
$(BASE_NAME).html: prepare
asciidoctor $(BASE_NAME).adoc -o output/$(BASE_NAME).html
# https://github.com/asciidoctor/asciidoctor-pdf
$(BASE_NAME).pdf: prepare
asciidoctor -r asciidoctor-pdf -b pdf $(BASE_NAME).adoc -o output/$(BASE_NAME).pdf
$(BASE_NAME).xml: prepare
asciidoctor -b docbook5 -d article $(BASE_NAME).adoc -o output/$(BASE_NAME).xml
$(BASE_NAME).epub: $(BASE_NAME).xml
pandoc -f docbook -t epub3 output/$(BASE_NAME).xml -o output/$(BASE_NAME).epub
$(BASE_NAME).docx: $(BASE_NAME).xml
pandoc -f docbook -t docx output/$(BASE_NAME).xml -o output/$(BASE_NAME).docx
$(BASE_NAME).md: prepare $(BASE_NAME).xml
pandoc -f docbook -t markdown_github -s --toc output/$(BASE_NAME).xml -o output/$(BASE_NAME).md
# https://github.com/jedi4ever/markdown2confluence
$(BASE_NAME).confluence: prepare $(BASE_NAME).md
markdown2confluence output/$(BASE_NAME).md > output/$(BASE_NAME).confluence
prepare:
mkdir -p output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment