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