troff to html converter
I use troff (OK, groff) to do most of my word processing. I'm comfortable with it, I can use vi to write the text, and I can write programs to generate troff output, which means I can write programs to generate PDFs.
Recently I wanted to convert a troff document to html. One would think this is a solved problem, and I suppose it is, for some limited domains (like man pages). The converters I found (for Linux or FreeBSD) don't seem to work all that well for mm macros using tables. roff2html couldn't render a list or a table at all. groffer, same problem (not surprising, roff2html calls groffer).
It was time to fire up the Perl interpreter and hack out my own converter. It didn't turn out to be as hard as I feared, as long as I limited the program to handle the troff contstructs I use in 99% of my documents.
tr2html.pl handles the following troff and troff/mm/tbl markup:
The program won't handle nested tables, and perhaps not nested lists.
Program is public domain but I'd appreciate it if you'd leave my name in the comments. Oh, and if you make any improvements, I'd love to see them. Email webmaster at this domain to contact me.
Get it here.