Do you have code handy to convert from html (with a TOC) to epub?
I looked up some python examples to start with:
python epub docs http://www.egofile.com/2010/01/convert-openofficeorg-writer-...
http://code.google.com/p/python-epub-builder/
http://www.ibm.com/developerworks/xml/tutorials/x-epubtut/se...