3 ms·
Here is that forked man2html program: https://www.kylheku.com/cgit/man/ https://www.kylheku.com/cgit/man/ I applied quite a lot of changes to it. It basically
by kazinator 3y ago
Here is that forked man2html program: https://www.kylheku.com/cgit/man/ https://www.kylheku.com/cgit/man/
I applied quite a lot of changes to it.
It basically contains a really hacky, spaghetti-coded nroff interpreter. Very nasty C code.
In some of the patches, I actually implement missing features, like if/else conditions and loops. I got it to handle some of the complex macros in the TXR man page.
I also put in a way where the man page can detect that it's being processed by that man2html program to do some things differently, that work better for HTML. If the M2 variable is present, then the nroff processor is confirmed to the man2html.
There is a three-way if for targeting macros that annotate key strokes (used in the part of the manual that documents the REPL). In man2html, we generate inline HTML <kbd>...</kbd> tags. In nroff (man paging) we put square brackets, like [Ctrl-C], and for PDF output via groff, I used a complex copy pasta from the Groff manual to render boxes.