summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2015-03-25 03:47:07 +0100
committerJonas Smedegaard <dr@jones.dk>2015-03-25 03:47:07 +0100
commite38663a49a22576899f27fdaa646d8ee6d61fc81 (patch)
treea2f66b8fd2b8db1ae2cd5e47ebeeb6b47bcfc5a1
parentd5f944606e0e539151f7c24128893e8892db8110 (diff)
Fix handle em-dash.
-rw-r--r--Makefile1
-rwxr-xr-xnative-hacks21
2 files changed, 22 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 2862a3d..f2329f4 100644
--- a/Makefile
+++ b/Makefile
@@ -86,6 +86,7 @@ $(stem).mw: $(stem).raw
$(stem).native: $(stem).mw $(localfilters)
$(env_filter) pandoc -f mediawiki --smart $(args_meta) $(args_filter) -o $@ $<
+# ./native-hacks $@
$(markdown_includes:.md=.tex): %.tex: %.md
pandoc -f markdown -t latex --chapters -o $@ $<
diff --git a/native-hacks b/native-hacks
new file mode 100755
index 0000000..dca1520
--- /dev/null
+++ b/native-hacks
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+# work around smart quote handling not smart enough
+
+use warnings;
+use strict;
+
+use Path::Tiny;
+use Regexp::Common qw(net);
+
+my $infile = shift;
+my $outfile = shift || $infile;
+
+$_ = path($infile)->slurp_utf8;
+
+# "pandoc --smart" apparently ignores en- and em-dashes with mediawiki.
+s/Space,Str "--",Space/Space,Str "\\8212",Space/g;
+
+path($outfile)->spew_utf8($_);
+
+1;