#!/usr/bin/perl -w
# Take the HTML m-w.com's wwwebster returns and process it into something
# readable.
#
# Hacky kludge. Works for now.
my $ignorestart = <Thesaurus Search]
# then alt="WWWebster Dictionary">
my $inputstart = <
line
# Previously
my $inputend = <
line
my $clipstart = <) {
s/\r//g;
if ($ignoring) {
$ignoring = 0 if $_ eq $inputstart;
next;
} else {
$ignoring = 1 if $_ eq $inputend;
if ($_ eq $ignorestart) {
$ignoring = 1;
next;
}
if ($_ eq $clipstart) {
$clipping = 1;
}
if ($clipping) {
if (m#^#) {
print "(Alternatives not shown)\n";
$clipping = 0;
} else {
next;
}
}
chomp;
s/
/\n/g;
s/<.*?>//g;
# Check for the beginning or end of a multi-line HTML tag.
if ($intag) {
s/.*?>// and $intag = 0;
} else {
s/<.*// and $intag = 1;
}
s/\&\;/\&/g;
s/\>\;/\>/g;
s/\<\;/\