summaryrefslogtreecommitdiff
path: root/mediawiki-extract
blob: 5b483e31d743d145c3e2ccd055c53fe10436b804 (plain)
  1. #!/usr/bin/perl
  2. # extract and decode mediawiki content from HTML source view
  3. use warnings;
  4. use strict;
  5. use Path::Tiny;
  6. use HTML::HTML5::Entities;
  7. my $infile = shift;
  8. my $outfile = shift || $infile;
  9. $_ = path($infile)->slurp_utf8;
  10. s!.*<textarea[^>]*>!!s;
  11. s!</textarea.*!!s;
  12. decode_entities($_);
  13. path($outfile)->spew_utf8($_);
  14. 1;