summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-12-30 01:50:08 +0100
committerJonas Smedegaard <dr@jones.dk>2014-12-30 01:50:08 +0100
commit6f98b4dfb2b80e3eb3072dd3f140351581746db2 (patch)
tree3504d7481f617648637af7e3209bb32f45e605c0 /Makefile
parent5b493a9bf8356bce9472256a3a2a16c3b7ab2643 (diff)
Move mediawiki tweaks to separate scripts.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile18
1 files changed, 4 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index c0da69d..be72240 100644
--- a/Makefile
+++ b/Makefile
@@ -2,12 +2,6 @@ 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|\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
@@ -49,14 +43,10 @@ download:
wget -O $(stem).raw '$(source_baseurl)w/index.php?title=$(source_basename)&action=edit'
$(stem).mediawiki: $(stem).raw
- perl -C -0777 -MHTML::Entities -MRegexp::Common=net -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);' \
- < $< > $@
+ ./mediawiki-extract $< $@
+ ./mediawiki-trim $@
+ ./mediawiki-blockquote $@
+ ./mediawiki-uri-escape $@
$(stem).native: $(stem).mediawiki $(localfilters)
pandoc -f mediawiki $(args_meta) $(args_filter) -o $@ $<