I am using XAE with Emacs for writing DocBook documents. This way, I can write documentation and source code within the same environment. Often, at almost the same time; switching between documenting and programming without delay.
A DocBook 4.5 based documentation may consist of many filial documents. These filial documents are integrated through entities into the documentation. or »xinclude« The mechanism is similar to an »include« statement in C or a »package require« in Tcl/Tk.
Pictures and examples are also referenced from external sources. Referenced files are better maintable than single documents. Unfortunately, the DocBook syntax highlighting does not yet work inside of referenced source code.
There are two reference methods in DocBook: entityref and fileref. entityref is the more natural way for figures, were an entity, pointing to the figure, gets defined inside the master document. Through entityref and a XML catalogs, parametric documents become feasible. There is one cavet with entityref without a catalog: file paths are absolute, even when the entity uses relative path! The used XML catalog must resolve the entityref to avoid absolute file pathes in the target document. fileref on the other hand allows for relative file names –relative to the master document; preserving the relative path in the generating HTML.
format="SVG" fileref="graphics/mygraphics"
here a file named
mygrpahics.SVG
must exist
inside the local directory
mygraphics
.
Using entities as parameter values.
<!ENTITY sdpi "20"> <!ENTITY cwidth "90"> <!-- format and file names as entitties --> <!ENTITY ftype "SVG"> <!ENTITY cshierarchy "csshierarchy02"> ... <figure id="csshier"> <title>Hierarchy of Listboxes</title> <mediaobject> <imageobject> <imagedata format="&ftype;" align="center" contentwidth="&cwidth;%" contentdepth="88em" scale="&sdpi;" scalefit="1" fileref="pictures/&cshierarchy;" /> </imageobject> </mediaobject> </figure>
See also: Modular DocBook, DocBook XSL: The Complete Guide on sagehill.net.
refentry is the DocBook man page. Each template will have its own refentry document.
The refentry documents are then assembled into a larger document through entities.
The Entity defined in Example 9.1, “Entity Reference” is later referenced inside the DocBook 4.5 document, see Example 9.2, “Using an Entity”.
Any used entity must be defined either in the DOCTYPE preamble of a stand alone document, or inside the master document.
An entity can be seen as a variable definition. Entities add flexibility to a document.
The Example 9.3, “DOCTYPE and Entity.” makes the entity »mytemplatepage« known inside the entire DocBook document. The Example 9.2, “Using an Entity” can be used in referenced documents, too.
The Example 9.4, “DocBook Mode in Emacs” declares the parent document for this document as: »appendix.xml« of type »appendix«.
Emacs will parse the parent document for entities whenever it is told to do so –through such a comment block. Thus DOCTYPE declarations can be omitted inside a child document. Only a single entity list must exist inside the master document for the entire documentation.