Not sure if you know about
GutenMark but I'd suggest you look at this for Gutenberg text files, it really is the best for converting into HTML - Gutenberg themselves recommend it. Easiest way would be to simply call it instead of spending your time implementing its functionality into BBeBinder, but at least the source code would really help.
Just a suggestion on formatting, I've noticed you create BBeBs with formatting for paragraphs that follows the Web page version, i.e. with a new line between paragraphs. Most ebooks skip this and simply start on a newline, it does look better.