#!/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.
# TODO: handle more ranges (e.g. roman numbers or single letters as first part)
s/Space,Str "--",Space/Space,Str "\\8212",Space/g;
s/(Str "\d+)-(\d+")/$1", Str "\\8211", Str "$2/g;

path($outfile)->spew_utf8($_);

1;