#!/usr/bin/env perl
print "
\n
Contents
\n
\n";
$depth = 2;
while(<>) {
if (/(.+?)<\/h\1>/) {
print " "x($1-2)."\n" if ($1 > $depth);
print " "x($1-2)."
\n" if ($1 < $depth);
print " "x($1-2)."- $3\n";
$depth = $1;
} elsif (//) {
print STDERR "! No id attribute on line $.: $_";
}
}
print "
\n
\n";