docbook2man-spec(1)

docbook2man-spec1

Convert docbook refentries to man pages

Usage

sgmlspl sgmlspl-specs/docbook2man-spec.pl

nsgmls {[sgml document] | sgmlspl sgmlspl-specs/docbook2man-spec.pl [--section label] [--appsection label] [--defsection label] [--date date] [[--lowercase] [--preserve-case]]}

Overview

docbook2man is a sgmlspl spec file that produced man pages (using the -man macros) from DocBook RefEntry markup.

The program reads ESIS produced by nsgmls (or other SGML parsers) from standard input. Markup not found in RefEntry is discarded.

Its output, the converted man pages, are written to the current directory. If RefMeta information is not specified in a RefEntry, then the man page will be written to standard output.

The file manpage.links will also be created, which contains any aliases of the manpages generated. This file is in the format:

<man page> <alias manpage>

The manpage.refs file keeps track of XRef references. Note that if the input document has any forward references, then docbook2man may have to be invoked twice (the first time updating manpage.refs) to resolve them.

Options

--appsection label

If Application is found in a RefEntryTitle, then the section defaults to this value.

--defsection label

The default section for the generated man page, if the source RefMeta does not contain a ManVolNum.

--section label

Sets both --appsection and --defsection.

--date date

Sets date as the date to use for man pages without Date markup (in DocInfo. If this option is not specified, the default date is the current date.

Note that the date must be given as one argument; i.e. shell quoting may have to be used for dates with spaces.

--lowercase

Man page filenames will be lowercased.

--preserve-case

Do not --lowercase. This is the default.

Requirements

The SGMLSpm package from CPAN. This package includes the sgmlspl script that is also needed.

Limitations

Trying docbook2man on non-DocBook or non-conformant SGML results in undefined behavior. :-)

This program is a slow, dodgy Perl script.

This program does not come close to supporting all the possible markup in DocBook, and may produce wrong output in some cases with supported markup.

To do

Obvious stuff:

•

Fix docbook2man breakages found in the test documents, especially weird.sgml.

•

Add new element handling and fix existing handling. Be robust.

•

Produce cleanest, readable man output as possible (unlike some other converters). Follow Linux man(7) convention. As conversion to man pages is usually not done very often, it is better to be slower/more complicated than to produce wrong output. Also if someone wants to give up using DocBook for whatever reason, the last-converted man pages can then be maintained manually.

•

Make it faster. I think most of the speed problems so far is with parsing ESIS. Rewrite SGMLS.pm with C and/or get input directly from SP.

•

Support other (human) languages. But what to do with non-ASCII charsets? SGMLSpm doesn't report them and roff does not grok them.

If we do this, more people can use DocBook.

From docbook2man 0.5.1-6 in Debian 2.2 (Potato). Parsed by carta from the page's man source.