I'm experimenting with Linux manual (man) page creation using DocBook, and specifically I'm using 'docbook2man' on a Fedora 20 box, and I've been unable to figure how to create the manual's title text.
For example, if I open the man-pages(7) manual page, the manual's title is MAN-PAGES(7)
and the manual's title text is Linux Programmer's Manual
.
For further clarification, man-pages(7) defines the TH command as
.TH title section date source manual
It's the manual
element--e.g., Linux Programmer's Manual
--that I'm trying to figure out how to create using docbook2man.
I've been experimenting with the example code found in section 4.6 "Generating a man page" on the Using DocBook website. The pertinent sections of that code example are provided below (see Listing 1). The file name I'm using for this example code is foo-ref.sgml
. The command line I'm using is
docbook2man foo-ref.sgml
Listing 1. Example SGML manual page
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
<refentry>
<refentryinfo>
<date>2001-01-01</date>
</refentryinfo>
<refmeta>
<refentrytitle>
<application>foo</application>
</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo>foo 1.0</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
<application>foo</application>
</refname>
<refpurpose>
Does nothing useful.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>2001-01-01</date>
</refsynopsisdivinfo>
<cmdsynopsis>
<command>foo</command>
<arg><option>-f </option><replaceable class="parameter">bar</replaceable></arg>
<arg><option>-d<replaceable class="parameter">n</replaceable></option></arg>
<arg rep="repeat"><replaceable class="parameter">file</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<refsect1info>
<date>2001-01-01</date>
</refsect1info>
<title>DESCRIPTION</title>
<para>
<command>foo</command> does nothing useful.
</para>
</refsect1>
<!-- etc. -->
</refentry>
When I process this source code with docbook2man, a man page named 'foo.1' is generated whose .TH macro is rendered as shown below, but with an empty string ""
for the manual's title text element:
.TH "FOO" "1" "2001-01-01" "foo 1.0" ""
I've dug around in the DocBook5 refentry refernece manual, trying various tags, but so far I haven't found anything that produces the title text. I've also searched the Interwebs for DocBook manual page examples, but none of the examples I've found produces the manual title text. So I'm starting to wonder if this is even doable with docbook2man?
Any suggestions?
After some more experimenting and without the desired results, I decided to abandon the
docbook2man
program and use instead thedoclifter(1)
andxsltproc(1)
programs to create my Linux manual pages.Example 1) On a Fedora 20 host, use
doclifter
to translate an existing man pageman-pages(7)
into a DocBook 'refentry' compatible XML file. This is VERY USEFUL because it renders an XML file that can can be used as a example reference for creating one's own DocBook 'refentry' XML source files.Listing 1.
doclifter
example (man->XML)Example 2) On a Fedora Linux 20 host, use
xsltproc
to convert an XML file~/tmp/foo.xml
containing DocBook refentry content into a Linux manual (man) page~/tmp/foo.1
.Listing 2 below is the XML source code for example file
~/tmp/foo.xml
that will be translated byxsltproc
into the manual page file~/tmp/foo.1
(see Listing 3 below). This XML source code is a derivative work from (1) the SGML example code provided in section 4.6 "Generating a man page" on the Using DocBook website, and (2) various code snippets--some modified, some copied verbatim--from the XML file created bydoclifter
in Example 1 above.Listing 2. Example DocBook 'refentry' XML file
~/tmp/foo.xml
Listing 3 below shows the
xsltproc
commands to use (on a Fedora 20 host) to translate the file~/tmp/foo.xml
into the manual page file~/tmp/foo.1
.Listing 3.
xsltproc
example (foo.xml -> foo.1)