XML technologies / DocBook / Structural elements / Reference pages

(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)

Within reference you document functions, commands, classes and similar items. A reference consists mainly of refentry elements. The following example illustrates a reference and is also valid in DocBook 5.

Example: Structure of a command reference

<refentry>
    <refmeta>
        <refentrytitle>xmllint</refentrytitle>
        <manvolnum>1</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>xmllint</refname>
        <refpurpose>XML-Kommandozeilentool</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Synopsis</title>
        <cmdsynopsis>
            <command>xmllint</command>
            <arg choice="opt">Option</arg>
            <arg choice="req">XML-Datei</arg>
        </cmdsynopsis>
    </refsynopsisdiv>
    <refsect1>
        <title>Einführung</title>
        <para>Eine kleine Beschreibung zu xmllint.</para>
    </refsect1>
    <refsect1>
        <title>Optionen</title>
        <variablelist>
            <varlistentry>
                <term><option>--version</option></term>
                <listitem>
                    <para>Gibt die Version von xmllint aus.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><option>--valid</option></term>
                <listitem>
                    <para>Validiert die XML-Datei.</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsect1>
    <!-- ... -->    
</refentry>

Line 2: Contains the reference page’s title, man-page section and other useful information.
Line 3: Sets the header and footer for man pages.
Line 4: Specifies the man-page section, normally categories 1 through 9 plus n.
Line 7: Sets the command name.
Line 8: Command purpose, appearing immediately after its name in man pages.
Line 10: Marks the command synopsis area.
Line 12: Starts the command line listing command names and parameters.
Line 18: A heading. You could also use refsection here. With refsect1 you can add more headings using refsect2 and refsect3.

The preceding example renders as follows:

XMLLINT(1)                                                                                  XMLLINT(1)

  

NAME

          xmllint - XML Kommandozeilentool

SYNOPSIS

          xmllint [Option] {XML-Datei}

EINFÜHRUNG

          Eine kleine Beschreibung zu xmllint.

OPTIONEN

          --version

               Gibt die Version von xmllint aus.

          --valid

               Validiert die XML-Datei.

  

                                                                                                XMLLINT(1)

Functions, classes and similar items can be documented in the same way. For more information, see "Synopses".

  

back to top