summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-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)