blob: 53825dc6b262e2ba62ae0b210960f05c9de0d376 (
plain)
- stem = eut
- source_baseurl = http://euwiki.org/
- source_basename = EUT/2nd-edition
- # work around in mediawiki bug parsing blockquote tags on same line
- re_blockquote = s|\n*(</?blockquote>)\n*|\n$$1\n|g
- # work around modest URL parsing <https://github.com/jgm/pandoc/issues/1838>
- re_urlencode = s|\bhttp[^\s\"]+?\K(--+)|uri_escape($$1, "-")|eg
- templates = template.tex header.tex before.tex after.tex
- filters = ./pandoc-filter-sections ./pandoc-filter-bib ./pandoc-filter-iri
- export PANDOC_CITEPROC_FILE = $(stem).bib
- # To produce final document: make -B STATUS=final
- STATUS ?= draft
- args += --template=template.tex --latex-engine=xelatex
- args += -H header.tex -B before.tex -A after.tex
- args += $(filters:%=--filter %)
- args += $(PANDOC_CITEPROC_FILE:%=--bibliography=%)
- args += -V mainfont="Lora" -V sansfont="Quattrocento Sans" -V monofont="Inconsolata"
- args += -V documentclass=memoir -V headstyles=komalike -V chapterstyle=ell
- args += -V classoption=titlepage -V classoption=$(STATUS)
- args += -V lang=english -V langoption=variant=british
- args += -V title="Ensuring utmost transparency"
- args += -V subtitle="Free Software and Open Standards under the Rules of Procedure of the European Parliament"
- args += -V author="Carlo Piana" -V author="Ulf Öberg"
- args += -V date=""
- flavors = a4 book ebook
- args_a4 = $(args) -V papersize=a4paper -V fontsize=10pt -V classoption=oneside
- args_book = $(args) -V papersize=b5paper -V fontsize=10pt -V classoption=twoside
- args_ebook = $(args) -V papersize=ebook -V fontsize=12pt -V classoption=oneside
- all: $(flavors:%=$(stem)-%.pdf)
- download:
- wget -o $(stem).raw '$(source_baseurl)index.php?title=$(source_basename)&action=edit'
- $(stem).mediawiki: $(stem).raw
- perl -0777 -MHTML::Entities -MURI::Escape -p \
- -e 's|.*<textarea[^>]*>||s; s|</textarea.*||s;' \
- -e 'decode_entities($$_);' \
- -e 's|.*?\n= |= |s;' \
- -e 's|<!--.*-->||s;' \
- -e '$(re_blockquote);' \
- -e '$(re_urlencode);' \
- < $< > $@
- $(flavors:%=$(stem)-%.pdf): $(stem)-%.pdf: $(stem).mediawiki $(templates) $(filters)
- pandoc -f mediawiki $(args_$*) -o $@ $<
|