summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-12-25 13:50:24 +0100
committerJonas Smedegaard <dr@jones.dk>2014-12-25 13:51:03 +0100
commita8d873cea1672a2341d2f57d4e0057056a5fc983 (patch)
treefcb9c7a374ec5b7b3d681381186b843bb435fcc3
parentfd5f0ad6473c84787c87cfa7637e6e283f970171 (diff)
Work around modest URL parsing.
-rw-r--r--Makefile6
1 files changed, 5 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 7aa7cd7..07bd8de 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,9 @@ 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
@@ -35,12 +38,13 @@ download:
wget -o $(stem).raw '$(source_baseurl)index.php?title=$(source_basename)&action=edit'
$(stem).mediawiki: $(stem).raw
- perl -0777 -MHTML::Entities -p \
+ 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);' \
< $< > $@
$(stem).pdf: $(stem).mediawiki $(templates) $(filters)