(Note: Within Project Gutenberg most Balzac novels follow a convention for chapter headings. This is the part you'll have to change if you want to reformat the writings of other authors that use other chapter heading conventions. It would be cool to introduce a little artificial intelligence that picks out chapter heading conventions that might be being used, presents them to the user for verification, then procedes on its way reformatting the text according to the selected convention.)
Here's a slight modification used to transform the list of characters in the "Repertory of Characters" for Balzac's Comedie Humaine into a structured hypertext glossary:
chaptofile5