XML technologies / DocBook / Block elements / Program listings / Annotating lines

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

There are two ways to annotate a specific point in your source code:

Source code and annotations can be mixed within programlisting or screen:

<programlisting language="python">#!/usr/bin/python -u
import sys
import string
import commands

<lineannotation>Zusammensetzen des Befehls:</lineannotation>
cmd = ["file", sys.argv[1], "| cut -d',' -f2" ]
cmd = string.join(cmd)

(res, out) = commands.getstatusoutput(cmd) <lineannotation
  >Ausführen des Befehls</lineannotation>

print res, out <lineannotation
  >Rückgabewert und Ergebnis ausgeben</lineannotation>
</programlisting>

  

back to top