XML technologies / DocBook / Block elements / Synopses / Command synopses (cmdsynopsis)
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
To mark up command syntax, use the element cmdsynopsis. It can be used inside a man page.
The following elements describe command syntax: command for the command being described, arg for arguments, group for groups, and <sbr/> for an explicit line break.
Example: Using cmdsynopsis
<cmdsynopsis>
<command>touch</command>
<arg choice="opt" rep="repeat">OPTION</arg>
<arg choice="plain" rep="repeat"><replaceable>DATEI</replaceable></arg>
</cmdsynopsis> touch [OPTION...] DATEI ...
Line 2: The command being described.
Line 3: An optional, repeatable argument. Repetition is specified with rep.
Line 4: An ordinary argument with a placeholder.
Create more complex examples with arg:
Example: Nesting with arg
<cmdsynopsis>
<command>scp</command>
<arg>OPTIONS</arg>
<arg choice="opt">
<arg choice="opt">user@</arg>
<arg choice="plain">host1:</arg>
<arg choice="plain">file1</arg>
<arg rep="repeat"/>
</cmdsynopsis> scp [OPTIONS] [ [user@] host1: ] file1 [...]
If options become too long, <sbr/> inserts a line break at the desired position:
Example: Line break with <sbr/>
<cmdsynopsis>
<command>ssh</command>
<arg>-b <option>bind_address</option></arg>
<sbr/>
<arg>-S <option>ctl_path</option></arg>
</cmdsynopsis> ssh [-b bind_address]
[-S ctl_path]
Using group you can group options:
Example: Grouping options with group
<cmdsynopsis>
<command>chgrp</command>
<arg>-R
<group>
<arg>-H</arg>
<arg>-L</arg>
<arg>-P</arg>
</group>
</arg>
</cmdsynopsis> chgrp [-R [[-H] | [-L] | [-P]] ]
If there are too many options, it is useful to place them in the element synopfragment and reference them with synopfragmentref:
Example: Splitting options with synopfragment
<cmdsynopsis>
<command>convert</command>
<arg choice="plain"><replaceable>input-file</replaceable></arg>
<group>
<synopfragmentref linkend="syn.convert.options">OPTIONS</synopfragmentref>
</group>
<arg choice="plain"><replaceable>output-file</replaceable></arg>
<synopfragment ANKER="syn.convert.options">
<arg>-antialias</arg>
<arg>-border <replaceable>geometry</replaceable></arg>
<arg>-clip</arg>
<arg>-colorspace</arg>
</synopfragment>
</cmdsynopsis>Replace the placeholder ANKER with id in DocBook 4 and xml:id in DocBook 5.
convert input-file [(1) OPTIONS] output-file
(1) [-antialias] [-border geometry] [-clip] [-colorspace]
Copyright © 2009 Millin Verlag
You may print the online version for your private use.
Otherwise, this chapter from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Millin Verlag, Siebengebirgsring 36, 53797 Lohmar, info(at)millin.de
back to top