#!/bin/sh -e mkdir -p media/ mkdir -p output/ # Assets if [[ "$*" == *"--dither"* ]] then cp -r media_dither/* media/ fi if [[ "$*" == *"--hr"* ]] then cp -r media_hr/* media/ fi # Gen if [[ "$*" == *"--epub"* ]] then cat metadata.yaml wiktopher.md > output/assembled.md pandoc output/assembled.md --from markdown+line_blocks+inline_notes --toc -V toc-title:"Table of Contents" --toc-depth=2 --epub-metadata=metadata.yaml --epub-cover-image=media/cover_epub.jpg --css epub.css -w epub -o output/wiktopher.epub fi if [[ "$*" == *"--pdf"* ]] then pandoc --variable=geometry:a5paper wiktopher.md --pdf-engine=tectonic --from markdown+line_blocks+inline_notes --toc -V toc-title:"Table of Contents" --toc-depth=2 --include-in-header=titlesec-conf.tex -o output/pdf.pdf gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output/final_pdf.pdf output/pdf.pdf # # # main title page pandoc --variable=geometry:a5paper wiktopher.md --pdf-engine=tectonic --include-in-header=titlepage.tex -o output/titlepage.pdf # # # copyright page pandoc --variable=geometry:a5paper wiktopher.md --pdf-engine=tectonic --include-in-header=copyright.tex -o output/copyright.pdf # Combine PDFs gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output/wiktopher.pdf output/cover.pdf output/titlepage.pdf output/copyright.pdf output/final_pdf.pdf fi if [[ "$*" == *"--print"* ]] then # convert media/cover.jpg output/cover.pdf pandoc --variable=geometry:a5paper wiktopher.md --pdf-engine=tectonic --from markdown+line_blocks+inline_notes --toc -V toc-title:"Table of Contents" --toc-depth=2 --include-in-header=titlesec-conf.tex -o output/draft.pdf gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output/final_draft.pdf output/draft.pdf # # # main title page pandoc --variable=geometry:a5paper wiktopher.md --pdf-engine=tectonic --include-in-header=titlepage.tex -o output/titlepage.pdf # # # copyright page pandoc --variable=geometry:a5paper wiktopher.md --pdf-engine=tectonic --include-in-header=copyright.tex -o output/copyright.pdf # Combine PDFs # pdfunite output/cover.pdf output/titlepage.pdf output/copyright.pdf output/draft.pdf output/wiktopher_print.pdf gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output/wiktopher_print.pdf output/titlepage.pdf output/copyright.pdf output/final_draft.pdf fi if [[ "$*" == *"--push"* ]] then ~/bin/butler push output/wiktopher.pdf hundredrabbits/wiktopher-desert-tales:pdf ~/bin/butler push output/wiktopher.epub hundredrabbits/wiktopher-desert-tales:epub ~/bin/butler push output/wiktopher.mobi hundredrabbits/wiktopher-desert-tales:mobi ~/bin/butler push output/wiktopher.kepub.epub hundredrabbits/wiktopher-desert-tales:kepub.epub fi if [[ "$*" == *"--clean"* ]] then rm -f output/* rm -f media/* fi