Difference between revisions of "Documentation Primer/Manual/DocBook Reference/Synopsis"

Jump to: navigation, search
(Corrected links)
 
Line 145: Line 145:
  
 
<!--T:33-->
 
<!--T:33-->
:Used inside [[#cmdsynopsis|{{Tag|cmdsynopsis}}]].  Since most KDE applications are &GUI; only, you won't see this very often.  See the entry for  [[#cmdsynopsis|{{Tag|cmdsynopsis}}]] for a full explanation and example.
+
:Used inside [[Special:myLanguage/Documentation Primer/Manual/DocBook Reference/Synopsis#cmdsynopsis|{{Tag|cmdsynopsis}}]].  Since most KDE applications are &GUI; only, you won't see this very often.  See the entry for  [[Special:myLanguage/Documentation Primer/Manual/DocBook Reference/Synopsis#cmdsynopsis|{{Tag|cmdsynopsis}}]] for a full explanation and example.
  
 
</translate><span id="group"></span><translate>
 
</translate><span id="group"></span><translate>
Line 330: Line 330:
 
<!--T:44-->
 
<!--T:44-->
 
{{Prevnext2
 
{{Prevnext2
| prevpage=Documentation Primer/Manual/DocBook Reference/Tips
+
| prevpage=Special:myLanguage/Documentation Primer/Manual/DocBook Reference/Tips
 
| prevtext=Admonitions - Tips, hints, and Warnings
 
| prevtext=Admonitions - Tips, hints, and Warnings
| nextpage=Documentation Primer/Manual/DocBook Reference/Programming
+
| nextpage=Special:myLanguage/Documentation Primer/Manual/DocBook Reference/Programming
 
| nexttext=Markup for programming
 
| nexttext=Markup for programming
| index=Documentation Primer/Manual
+
| index=Special:myLanguage/Documentation Primer/Manual
 
| indextext=Back to Menu
 
| indextext=Back to Menu
 
}}
 
}}
  
 
</translate>
 
</translate>

Latest revision as of 11:37, 9 September 2012

Other languages:English 100%

[edit] The synopsis elements

<cmdsynopsis>

Example: How to markup a command synopsis
<cmdsynopsis>
<command>more</command>
<group choice="opt"><option>-d</option>
<option>l</option><option>f</option>
<option>p</option><option>c</option>
<option>s</option><option>u</option>
</group>
<arg>-num</arg>
<arg>+/ pattern</arg>
<arg>+ linenum</arg>
<arg rep="repeat"><replaceable>file</replaceable></arg>
</cmdsynopsis>
This should generate:
more [-dlfpcsu][-num][+/ pattern][+ linenum][file]

There are several very nice examples in the Duck book at www.docbook.org <funcsynopsis>

Example: How to markup a function synopsis
<funcsynopsis>
<funcprototype>
<funcdef>void <function>setFile</function></funcdef>
<paramdef>QString <parameter>file</parameter></paramdef>
</funcprototype>
</funcsynopsis>

<funcsynopsis>
<funcprototype>
<funcdef>void <function>setAutoResize</function></funcdef>
<paramdef>bool <parameter><replaceable>val</replaceable></parameter></paramdef>
</funcprototype>
</funcsynopsis>

<funcsynopsis>
<funcprototype>
<funcdef>QString <function>getVideoCodec</function></funcdef><void/>
</funcprototype>
</funcsynopsis>


These would generate the following, respectively.
void setFile(file);
QString file;
void setAutoResize(val);
bool val;
QString getVideoCodec();
A function synopsis can contain the following:

<funcprototype>
Contains a prototype of the function. It can contain <void>, <varargs>, <paramdef> or most commonly, a <funcdef> which actually defines the function.

<funcdef>
A function and it's return type.

<funcparams>
Contains the list of parameters for the function.

<paramdef>
Information about the parameters of a function.

<void>
An empty element in a function indicating there are no arguments.

<varargs>
An empty element in a function indicating there are multiple arguments, without specifically listing them. This is generally represented with an ellipsis (...). For example int max(...);

<funcsynopsisinfo>
Not used in KDE documentation.

<arg>

Used inside <cmdsynopsis>. Since most KDE applications are &GUI; only, you won't see this very often. See the entry for <cmdsynopsis> for a full explanation and example.

<group>

Group

<sbr>

sbr

<synopfragment>

synopfragment

<modifier>

A modifier modifies a class, field, or method synopsis. Examples are the words "public", "private" or "virtual"

<fieldsynopsis>

A field synopsis.




This page was last modified on 9 September 2012, at 11:37. This page has been accessed 1,125 times. Content is available under Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal