diff options
author | Jonas Smedegaard <dr@jones.dk> | 2014-12-28 06:50:07 +0100 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2014-12-28 06:50:07 +0100 |
commit | d3e794c52bd0797cc38ec171779689b2d195f1a3 (patch) | |
tree | 19c045de57b1255c6b9d51171ba26f78cf659e48 | |
parent | 33d10b0888f498d379ca9a9149ac2c33703e46bf (diff) |
Escape URLs more aggressively, and fix unescape after bibliography is resolved.
-rw-r--r-- | Makefile | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -6,14 +6,16 @@ source_basename = EUT/2nd-edition 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|\bhttps?://[^\s/\|}]+[^\s\"]+?\K([-=]+)|uri_escape($$1, "-=")|eg +re_urlencode = s|\bhttps?://$$RE{net}{domain}{-nospace}{-rfc1101}(?::\d+)?/\K(\S*?)(?=[.,;]?[\s<\"\|}])|uri_escape(uri_unescape($$1), "^A-Za-z0-9/\.")|eg templates = template.tex header.tex before.tex after.tex -filters = ./pandoc-memoir ./pandoc-cs1 ./pandoc-iri +filters = ./pandoc-memoir ./pandoc-cs1 export PANDOC_CITEPROC_FILE = $(stem).bib +filters-late = ./pandoc-iri + # To produce final document: make -B STATUS=final STATUS ?= draft @@ -21,6 +23,7 @@ title = Ensuring utmost transparency subtitle = Free Software and Open Standards under the Rules of Procedure of the European Parliament args_filter += $(filters:%=--filter %) args_filter += $(PANDOC_CITEPROC_FILE:%=--bibliography=%) +args_filter_late += $(filters-late:%=--filter %) args_meta += -V lang=english -V langoption=variant=british args_meta += -M title="$(title) - $(subtitle)" args_meta += -V title="$(title)" @@ -44,7 +47,7 @@ download: wget -O $(stem).raw '$(source_baseurl)w/index.php?title=$(source_basename)&action=edit' $(stem).mediawiki: $(stem).raw - perl -0777 -MHTML::Entities -MURI::Escape -p \ + perl -0777 -MHTML::Entities -MRegexp::Common=net -MURI::Escape -p \ -e 's|.*<textarea[^>]*>||s; s|</textarea.*||s;' \ -e 'decode_entities($$_);' \ -e 's|.*?\n= |= |s;' \ @@ -57,4 +60,4 @@ $(stem).native: $(stem).mediawiki $(filters) pandoc -f mediawiki $(args_filter) -o $@ $< $(flavors:%=$(stem)-%.pdf) $(stem).tex: $(stem).native $(templates) - pandoc $(args_meta) $(args_latex) $(args_$(@:$(stem)-%.pdf=%)) -o $@ $< + pandoc $(args_meta) $(args_filter_late) $(args_latex) $(args_$(@:$(stem)-%.pdf=%)) -o $@ $< |