| Revision 35 (by dpavlin, 2004/03/01 16:53:07) |
fix broken MailMan archive download format to correct mbox format
(seems to be issue only with older mailman installations, but they
are still often)
|
#!/usr/bin/perl -w
# Fix stupd html which is embedded in mailman mbox which you download
# this is a filter. Use it like this:
#
# mailman2mbox.pl < mbox > mbox-new
#
# 2003-09-04 Dobrica Pavlinusic <dpavlin@rot13.org>
#
my $first = 1;
while(<STDIN>) {
if ($first) {
chomp;
$first = 0;
next if ($_ eq ""); # skip first empty line
$_ .= "\n";
}
s,^</*PRE>,,g;
s,<A HREF="[^"]*">(.+?)</A>,$1,g;
# fix quoting
s,^><i>,>,;
s,^</I>(>[^<]*)<i>,$1,;
s,^</I>,,;
s/</</g;
s/>/>/g;
s/"/"/g;
s/&/&/g;
s/^(From.+?) at (.+)$/$1\@$2/g;
print;
}