is there a Python HTML TableOfContents generator?

Stephen Ferg steve at ferg.org
Sat Feb 1 22:06:16 EST 2003


I need a Python program that creates a table of contents for an HTML
file.  Basically, it would make two passes through the HTML file.  The
first pass would possibly create bookmark (<a name="..">) tags within
heading (<h1>, <h2>, etc.) tags, or extract information from such
bookmark tags if they already exist.  The second pass would insert a
table of contents, appropriately indented, with links to the
appropriate bookmarks, at the head of the HTML document (and delete an
old table of contents, if one already exists).

Before I start reinventing the wheel, I'd like to know if anyone has
already done something like this.

There is a Perl module called HTMLgenToc that does this, but who wants
to use Perl!  Is there a Python equivalent?




More information about the Python-list mailing list