is there a Python HTML TableOfContents generator?
Thomas Guettler
zopestoller at thomas-guettler.de
Mon Feb 3 09:58:04 EST 2003
Stephen Ferg schrieb:
> 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).
>
http://www.thomas-guettler.de/scripts/number-html-headings.py.txt
I started something like this some time ago. But up to now it does
not make a TOC, it just numbers the HTML headings:
<h1>foo</h1>
<h2>bar</h2>
will get:
<h1>1. foo</h1>
<h2>1. 2 bar</h1>
If you add the table of content feature, please mail it to me!
URL:
http://www.thomas-guettler.de/scripts/number-html-headings.py.txt
thomas
More information about the Python-list
mailing list