4 ms·
roff is quite horrible to read and write. There's a much better solution than banging your head against an archaic and unforgiving file format: AsciiDoctor's ma
by tkfu 9y ago
roff is quite horrible to read and write. There's a much better solution than banging your head against an archaic and unforgiving file format: AsciiDoctor's manpage backend [1]. You write in asciidoc, with some required structure that's quite easy to follow, and it spits out a proper roff document for you. Asciidoctor's own manpage [2] is, of course, generated in this way, and it's a pretty good example of the form.
[1] http://asciidoctor.org/docs/user-manual/#man-pages http://asciidoctor.org/docs/user-manual/#man-pages
[2] https://raw.githubusercontent.com/asciidoctor/asciidoctor/master/man/asciidoctor.adoc https://raw.githubusercontent.com/asciidoctor/asciidoctor/ma...
- gnuvince 9y agoThe main issue with this is that AsciiDoc cannot express semantics. When writing manpages, you can specify that something is a flag or a function parameter, etc.
- tkfu 9y agoI'd argue that (1) manpages are for humans to read, and (2) there is effectively only one presentation style for the conveying the semantic contents. So as long as the author of the manpage follows the standard conventions for manpage presentation style, they are in fact expressing the semantics. And it's a lot easier to learn the conventions (flags in bold, arguments in italics, etc.) and write them in lightweight markup than it is to learn roff.
- opk 9y agoSemantic markup has more uses than just consistent presentation. For example, most of the BSD's use mandoc rather than groff for rendering which allows you to do more detailed searches with apropos. Note that the linked article refers to the mdoc macros. These aren't especially new and are very well supported but the man macros are still more common. If you dig into the details, the mdoc macros have many advantages.
- deleted 9y ago[deleted]
- JdeBP 9y agoUsing mandoc instead of groff is a bit of a step backwards, note. grotty is capable of ECMA-48:1976 and ISO 8613-6:1994 control sequences, and can actually do proper italicization, boldface, underline, and colour in manual pages; which many terminals nowadays have supported for decades. * https://jdebp.eu/Softwares/nosh/italics-in-manuals.html https://jdebp.eu/Softwares/nosh/italics-in-manuals.html mandoc still only knows the old 1960s TTY-37 control sequences that use overstrike for boldface and underline and that have no notion of italicization or colour. When FreeBSD switched from groff to mandoc, I went looking for any way to have mandoc support ECMA-48:1976 and ISO 8613-6:1994 control sequences. It turned out to be a large amount of work to bring it up to parity with something that the GNU toolchain has had since the 1990s (and is in fact the GNU toolchain's native mode of operation).
- jwilk 9y ago> one has to employ the MANROFFOPT environment variable, setting it to "-P-i". This didn't work for me (Debian unstable), because man called nroff, which doesn't understand the -P option. So I put DEFINE troff groff -mandoc -P-i DEFINE nroff groff -mandoc -P-i in /etc/manpath.config . This did the trick, but I'm not sure it didn't break something else.
- JdeBP 9y agoAha! A typing error. One should set it to -- -P-i Note the -- option. This causes nroff to just pass the -P-i option straight through to groff.
- arca_vorago 9y agoMy markup choice is between asciidoc and emacs org-mode, but I haven't done man pages. I wonder if there is an org mode man page system?