summaryrefslogtreecommitdiff
path: root/Makefile
blob: 272415d38012baed54c1f5cc4b6e554f28dedf45 (plain)
  1. stem = eut
  2. source_baseurl = http://euwiki.org/
  3. source_basename = EUT/2nd-edition
  4. citeproc_file = $(stem).bib
  5. templates = template.tex header.tex before.tex after.tex
  6. filters = ./pandoc-memoir ./pandoc-cs1
  7. filters += $(if $(citeproc_file),pandoc-citeproc)
  8. filters += ./pandoc-iri
  9. localfilters = $(filter ./%,$(filters))
  10. # To produce final document: make -B STATUS=final
  11. STATUS ?= draft
  12. title = Ensuring utmost transparency
  13. subtitle = Free Software and Open Standards under the Rules of Procedure of the European Parliament
  14. env_filter += $(citeproc_file:%=PANDOC_CITEPROC_FILE=%)
  15. args_filter += $(filters:%=--filter %)
  16. args_meta += $(citeproc_file:%=-M bibliography=%)
  17. args_meta += -V lang=english -V langoption=variant=british
  18. args_meta += -M title="$(title) - $(subtitle)"
  19. args_meta += -V title="$(title)"
  20. args_meta += -V subtitle="$(subtitle)"
  21. args_meta += -M author="Carlo Piana, Ulf Öberg"
  22. args_meta += -V author="Carlo Piana" -V author="Ulf Öberg"
  23. args_meta += -V date=""
  24. args_latex += --template=template.tex --latex-engine=xelatex
  25. args_latex += -H header.tex -B before.tex -A after.tex
  26. args_latex += -V mainfont="Lora" -V sansfont="Quattrocento Sans" -V monofont="Inconsolata"
  27. args_latex += -V documentclass=memoir -V headstyles=komalike -V chapterstyle=ell
  28. args_latex += -V classoption=titlepage -V classoption=$(STATUS)
  29. flavors = a4 book ebook
  30. args_a4 = -V papersize=a4paper -V fontsize=10pt -V classoption=oneside
  31. args_book = -V papersize=b5paper -V fontsize=10pt -V classoption=twoside
  32. args_ebook = -V papersize=ebook -V fontsize=12pt -V classoption=oneside
  33. all: $(flavors:%=$(stem)-%.pdf)
  34. download:
  35. wget -O $(stem).raw '$(source_baseurl)w/index.php?title=$(source_basename)&action=edit'
  36. $(stem).mediawiki: $(stem).raw
  37. ./mediawiki-extract $< $@
  38. ./mediawiki-trim $@
  39. ./mediawiki-blockquote $@
  40. ./mediawiki-uri-escape $@
  41. $(stem).native: $(stem).mediawiki $(localfilters)
  42. $(env_filter) pandoc -f mediawiki $(args_meta) $(args_filter) -o $@ $<
  43. $(flavors:%=$(stem)-%.pdf) $(stem).tex: $(stem).native $(templates)
  44. pandoc $(args_meta) $(args_latex) $(args_$(@:$(stem)-%.pdf=%)) -o $@ $<