Styles for Code and Markup
Stuff goes here.
Examples
Examples pulled from other reference documents
Program Listings, Scripts, and XML type files
Thus this markup:
<programlisting><![CDATA[ <emphasis>text</emphasis> ]]></programlisting>
Produces this:
<emphasis>text</emphasis>
![]() | Note This use of CDATA markup is very time saving when displaying large sections of DocBook code. The alternative is to escape every less and grater than sign on the markup - time consuming and hard to maintain. |
See Writing Documentation Using DocBook:Using DocBook at CERN, Chapter 7, Example 7.3
Example 5.2. Program Listing with Line Numbers
Simple program listing with linenumbers
<programlisting linenumbering="numbered"> 10 PRINT "HELLO WORLD" 20 GOTO 10 </programlisting>
Produces the following:
1 10 PRINT "HELLO WORLD" 2 20 GOTO 10
Program List with Callouts
Better example in XSLT book
sub do_nothing_useful {
my($a, $b, $c);
$a = new A;
$a->does_nothing_either();
$b = new B;
$c = "frog";

return ($a, $c);
}
| These are calls to the constructor
|
| This function returns a two-element list. |
| The destructor
( |
Program Linst with Callout - in code
#ifndef _My_Parser_h_#define _My_Parser_h_ #include "MyFetch.h"
class My_Parser
{ public: // // Construction/Destruction // My_Parser();
4 virtual ~My_Parser() = 0; virtual int parse(MyFetch &fetcher) = 0; }; #endif

![[Note]](/wiki/docbook/images/note.png)