0

I want to start a site with a collection of BSD man-pages, similar to man.cgi, but static HTML, and which includes all the stuff from the ports trees, too.

I've tried unpacking man/ from all the OpenBSD packages for a recent release, and I've noticed that although some packages provide mdoc pages, in man/man?/page.?, some others only provide terminal formatted pages in man/cat?/page.0.

I can use groff -mdoc -Thtml or mandoc -Txhtml for the mdoc files in man/man?/, but how do I convert the cat files from man/cat?/ into XHTML?

How do those man.cgi scripts at FreeBSD.org and NetBSD.org do this?

cnst
  • 25,870
  • 6
  • 90
  • 122

1 Answers1

0

In MirBSD we’re delivering all online manpages as static HTML (the actual web CGI is thus very small), and use a crafty script to convert the output of nroff -Tcol foo.1 | col -x to XHTML/1.1 – although, for this to work, we had to tweak nroff(1) and the mdoc and man macropackages (and ms and me etc.) slightly. We only ship all manpages from base, as well as the historic BSD docs, though.

Also, GNU gnroff has no -Tcol, but -Tascii will work – but if you want to use this with gnroff output, you might need to change the regexps accordingly.

Be extra careful when editing this file: it contains normal UTF-8 stuff as well as extra control characters and invalid byte sequences; if you’re not careful, your editor will corrupt it. (I’m using jupp myself.)

For more live feedback on this, feel free to visit the MirBSD IRC channel.

As to your original goal: I suggest to only harvest manpages from binary packages, because they often get changed during compilation, such as by AC_SUBST in autoconf, or even only generated as part of the package build.

mirabilos
  • 5,123
  • 2
  • 46
  • 72