summaryrefslogtreecommitdiff
path: root/Makefile
blob: 697cca250023ba30f0a9c04a439182c7603543e3 (plain)
  1. stem = eut
  2. source_baseurl = http://euwiki.org/
  3. source_basename = EUT/2nd-edition
  4. # work around in mediawiki bug parsing blockquote tags on same line
  5. re_blockquote = s|\n*(</?blockquote>)\n*|\n$$1\n|g
  6. filters = ./pandoc-filter-sections ./pandoc-filter-bib
  7. export PANDOC_CITEPROC_FILE = $(stem).bib
  8. #PANDOC_CITEPROC_FILE = $(stem).bib
  9. # To produce final document: make -B STATUS=final
  10. STATUS ?= draft
  11. args += --template=template.tex --latex-engine=xelatex
  12. args += -H header.tex -B before.tex -A after.tex
  13. args += $(filters:%=--filter %)
  14. args += $(PANDOC_CITEPROC_FILE:%=--bibliography=%)
  15. args += -V mainfont="Lora" -V sansfont="Quattrocento Sans" -V monofont="Inconsolata"
  16. args += -V papersize=a4paper -V fontsize=10pt
  17. args += -V documentclass=memoir -V headstyles=komalike -V chapterstyle=ell
  18. args += -V classoption=oneside -V classoption=titlepage -V classoption=$(STATUS)
  19. args += -V lang=english -V langoption=variant=british
  20. args += -V title="Ensuring utmost transparency"
  21. args += -V subtitle="Free Software and Open Standards under the Rules of Procedure of the European Parliament"
  22. args += -V author="Carlo Piana" -V author="Ulf Öberg"
  23. args += -V date=""
  24. all: $(stem).pdf
  25. download:
  26. wget -o $(stem).raw '$(source_baseurl)index.php?title=$(source_basename)&action=edit'
  27. $(stem).mediawiki: $(stem).raw
  28. perl -0777 -MHTML::Entities -p \
  29. -e 's|.*<textarea[^>]*>||s; s|</textarea.*||s;' \
  30. -e 'decode_entities($$_);' \
  31. -e 's|.*?\n= |= |s;' \
  32. -e 's|<!--.*-->||s;' \
  33. -e '$(re_blockquote);' \
  34. < $< > $@
  35. $(stem).pdf: $(stem).mediawiki template.tex
  36. pandoc -f mediawiki $(args) -o $@ $<