summaryrefslogtreecommitdiff
path: root/mediawiki-trim
diff options
context:
space:
mode:
Diffstat (limited to 'mediawiki-trim')
-rwxr-xr-xmediawiki-trim20
1 files changed, 20 insertions, 0 deletions
diff --git a/mediawiki-trim b/mediawiki-trim
new file mode 100755
index 0000000..a67d205
--- /dev/null
+++ b/mediawiki-trim
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+# drop content above initial headline - i.e. treat it as editorial noise
+
+use warnings;
+use strict;
+
+use Path::Tiny;
+use HTML::Entities;
+
+my $infile = shift;
+my $outfile = shift || $infile;
+
+$_ = path($infile)->slurp_utf8;
+
+s!.*?\n= != !s;
+
+path($outfile)->spew_utf8($_);
+
+1;