summaryrefslogtreecommitdiff
path: root/mediawiki-extract
blob: c2dae689aea94c408cdd23e0e419adeddef2af10 (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::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;