#!/usr/bin/perl -w
use strict;

# Convert my HTML transcriptions into plain ASCII
# 2005-Mar-03 Brian Foley

my $pre = 0;

while(<>) {
    $pre = 0 if (m!</pre>!);

    # Only output text between <pre>...</pre> tags
    if ($pre) {

        # Strip <a> and <u> tags
        s!</?[au][^>]*>!!g;

        # Strip out span tags (used for boxes etc)
        s!</?span[^>]*>!!g;

        # Strip &lt; and &gt; entities
        s!&lt;!<!g;
        s!&gt;!>!g;

        # Strip &amp; entity. This must be done
        # last, otherwise things like &amp;gt; will
        # be misconverted.
        s!&amp;!&!g;

        print;
    }

    $pre = 1 if (m!<pre>!);
}
