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