summaryrefslogtreecommitdiff
path: root/native-hacks
blob: e0f2318d0f7cf55756b909215c8d1c9f4a759945 (plain)
  1. #!/usr/bin/perl
  2. # work around smart quote handling not smart enough
  3. use warnings;
  4. use strict;
  5. use Path::Tiny;
  6. use Regexp::Common qw(net);
  7. my $infile = shift;
  8. my $outfile = shift || $infile;
  9. $_ = path($infile)->slurp_utf8;
  10. # "pandoc --smart" apparently ignores en- and em-dashes with mediawiki.
  11. # TODO: handle more ranges (e.g. roman numbers or single letters as first part)
  12. s/Space,Str "--",Space/Space,Str "\\8212",Space/g;
  13. s/(Str "\d+)-(\d+")/$1", Str "\\8211", Str "$2/g;
  14. path($outfile)->spew_utf8($_);
  15. 1;