I recently found a program called
text2html
(one of them, at least), which seems to work pretty well. I used
it in much simpler text than what you describe, but it included
titles, bulleted paragraphs and the like, and it performed
flawlessly. It may be at least a start for what you need. And
it comes in module form, so you can just
use it and call the
appropriate subroutine.
--ZZamboni