Difference between revisions of "DocBook - Introduction"

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.
(Created page with '<div class="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">Chapter 3. Extending DocBook</th></tr><tr><td align="left" wid…')
 
 
Line 1: Line 1:
<div class="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">Chapter&nbsp;3.&nbsp;Extending DocBook</th></tr><tr><td align="left" width="20%">[[DocBook - Writing Documentation|Prev]]&nbsp;</td><th align="center" width="60%">&nbsp;</th><td align="right" width="20%">&nbsp;</td></tr></table><hr></div>
+
<div class="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">Chapter&nbsp;1.&nbsp;Introduction</th></tr><tr><td align="left" width="20%">[[DocBook - Conventions|Prev]]&nbsp;</td><th align="center" width="60%">&nbsp;</th><td align="right" width="20%">&nbsp;[[DocBook - Writing Documentation|Next]]</td></tr></table><hr></div>
  
  
 
<div>
 
<div>
=<span id="N1043E">Extending DocBook</span>=
+
=<span id="N1006A">Introduction</span>=
 
</div><div><div class="titlepage"><div><div>
 
</div><div><div class="titlepage"><div><div>
==<span id="secXslStylesheets">XSL Stylesheets</span>==
+
==<span id="N1006E">Documentation Headaches</span>==
 
</div></div></div><p>
 
</div></div></div><p>
Stylesheets are XSL files which define how <span class="productname">DocBook</span> elements are formatted.
+
For developers, writing user documentation is always a hassle. After spending weeks or months
 +
of coding, testing and debugging, they have to start again from scratch and re-write their work
 +
in a form that is understandable and useful to humans.
 
</p><p>
 
</p><p>
While the XML source file merely contains markups describing what the meaning of its elements are, stylesheets
+
Decisions have to be made about what details are worth mentioning without being overwhelming,
translate that meaning into formatting information.
+
what should simply be dropped for the sake of brevity, and what prior knowledge or experience
 +
the reader would have. The documentation should be precise and concise, yet cover a wide
 +
range of aspects in order to answer as many potential questions as possible, and at the same
 +
time stay simple and comprehensible.
 
</p><p>
 
</p><p>
For example, the author may tag a certain passage as <code class="sgmltag-element">programlisting</code>. The stylesheet then
+
In addition to making choices on the content, the form of presentation needs to be considered.
informs the transformation process that a <code class="sgmltag-element">programlisting</code> should be printed in monospaced font
+
Should the documentation be published as a book or as a web page? As a simple README text file
on a dark background and that all whitespace should be preserved. Another stylesheet might use
+
which is distributed with the code, or as a manpage? Should it be published in a WIKI? Or perhaps
a serif font on a pink background, and a third stylesheet might drop it alltogether.
+
in all of those forms to distribute the documentation to as wide an audience as possible?
 
</p><p>
 
</p><p>
<span class="productname">Adempiere</span>'s implementation of <span class="productname">DocBook</span> comes with pre-defined
+
Although everybody would agree that content is much more important than format,
stylesheets for producing HTML, WIKI, and PDF output. They are located in the <code class="filename">docbook/style</code>
+
developers tend to visualize a certain format before they even start writing
directory.
+
the first words. It is understandable, as the format supplies a certain structure,
 +
and programmers love structure. Format and structure is what they do. Writing essays
 +
or prose is not.
 
</p><p>
 
</p><p>
These are simple text files in <code class="filename">.xsl</code> format and can therefore be
+
Apart from the obvious problem of content being dictated by format, especially in big
edited with any text editor. Again, XML-aware editors are a great help
+
open-source community projects such as <span class="productname">Adempiere</span> it can happen
 +
that each individual piece of documentation will have a different look and structure,
 +
and the reader will miss a coherent theme underlying various subprojects.
 
</p><p>
 
</p><p>
Documentation how to customize <span class="productname">DocBook</span> stylesheets can be found
+
As time passes, code develops and matures, bugs are fixed, functionality is added or dropped,
[http://www.sagehill.net/docbookxsl here].
+
and the user documentation constantly needs to be updated and adjusted. Having published in different
 +
formats, it means that a new edition of the PDF book needs to be issued, web pages
 +
re-written, and WIKI-pages updated. It is only a question of time until the various documents
 +
become unsynchronized, among each other as well as with the actual source.
 
</p></div><div><div class="titlepage"><div><div>
 
</p></div><div><div class="titlepage"><div><div>
==<span id="N10471">To Do</span>==
+
==<span id="N10081">DocBook 5</span>==
</div></div></div><div><div class="titlepage"><div><div>
+
===<span id="N10475">Internationalization</span>===
+
 
</div></div></div><p>
 
</div></div></div><p>
The current stylesheets are only available for US English. For other languages, the <em>legalNotice&hellip;</em>
+
Such problems are of course not specific to <span class="productname">Adempiere</span>,
parameters would have to be translated in <code class="filename">docbook/style/common.xsl.</code>
+
and already in 1991 <span class="orgname">HaL Computer Systems</span> and <span class="orgname">O&rsquo;Reilly &amp; Associates</span>
</p><p>
+
jointly developed [http://www.docbook.org DocBook] as a tool
The stylesheets have not been tested with writing systems which are not left-to-right.
+
to write technical documentation in presentation-neutral form. This does not take the burden of writing
</p></div><div><div class="titlepage"><div><div>
+
the actual documentation off the developer, but it helps to solve most other problems.
===<span id="N10483">WIKI Stylesheets</span>===
+
</p><p>
</div></div></div><p>
+
In version 5.0, <span class="productname">DocBook</span> has undergone some major structural changes, so it is
While the PDF stylesheets are mature and the HTML stylesheets provide acceptable results, the WIKI
+
now commonly referred to as <span class="productname">DocBook 5</span> to distinguish it from earlier versions.
stylesheets are a product of trial-and-error and leave much room for improvement.
+
</p><p>
</p><p>
+
A <span class="productname">DocBook</span> source document is a simple XML file which does not describe
Currently they are based on the HTML stylesheets with some tweaking to use WIKI instead of HTML markup.
+
what its content should look like, but what the meaning of the content is.
</p><p>
+
</p><p>
But as HTML itself is well-formed XML, it might be better to have stylesheets which transform the HTML output
+
The developer can therefore fully concentrate on writing the documentation content. He can mark
documents to WIKI format instead of directly transforming the source XML. Translating HTML markup to WIKI markup
+
certain lines as program code or screen shot, others as product or company name, and totally ignore
should be fairly straightforward and much easier than transforming <span class="productname">DocBook</span> XML
+
in what font or color or size they should appear.
to WIKI markup using tweaked HTML stylesheets.
+
</p><p>
</p><p>
+
Writing in XML code means any text editor or word processor can be used, but of course XML-aware editors
But for linking, WIKI uses page names, not file names, so a way would need to be found to deduct the page name
+
are a great help. In fact, this documentation is written using the <span class="productname">Eclipse</span>
from chunked HTML files.
+
IDE.
</p></div></div>
+
</p><p>
<div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%">[[DocBook - Writing Documentation|Prev]]&nbsp;</td><td align="center" width="20%">&nbsp;</td><td align="right" width="40%">&nbsp;</td></tr><tr><td valign="top" align="left" width="40%">Chapter&nbsp;2.&nbsp;Writing Documentation&nbsp;</td><td align="center" width="20%">[[DocBook|Home]]</td><td valign="top" align="right" width="40%">&nbsp;</td></tr></table></div>
+
After the document is written, XSL stylesheets are used to transform the XML source file into a
 +
variety of different formats. Thus a single source file can be used for generating PDF, HTML, WIKI,
 +
or even plain text results. If the documentation needs to be changed, only one file needs to be edited,
 +
and then all output formats can simply be re-compiled.
 +
</p><p>
 +
The stylesheets define where, if at all, certain blocks of text should be placed on a page, and what formatting
 +
should be used (font, color, background, size, etc.). Using the same stylesheets for documenting different
 +
projects results in a homogeneous presentation which the reader can easily recognize and feel comfortable with.
 +
</p><p>
 +
<span class="productname">Adempiere</span>'s <span class="application">docbook</span> subproject provides the stylesheets
 +
for publishing <span class="productname">Adempiere</span> PDF, HTML and WIKI documentation, and integrates the tools
 +
required to automatically generate them when the main code is being compiled.
 +
</p></div>
 +
<div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%">[[DocBook - Conventions|Prev]]&nbsp;</td><td align="center" width="20%">&nbsp;</td><td align="right" width="40%">&nbsp;[[DocBook - Writing Documentation|Next]]</td></tr><tr><td valign="top" align="left" width="40%">Conventions&nbsp;</td><td align="center" width="20%">[[DocBook|Home]]</td><td valign="top" align="right" width="40%">&nbsp;Chapter&nbsp;2.&nbsp;Writing Documentation</td></tr></table></div>

Latest revision as of 21:31, 3 October 2011


Introduction

Documentation Headaches

For developers, writing user documentation is always a hassle. After spending weeks or months of coding, testing and debugging, they have to start again from scratch and re-write their work in a form that is understandable and useful to humans.

Decisions have to be made about what details are worth mentioning without being overwhelming, what should simply be dropped for the sake of brevity, and what prior knowledge or experience the reader would have. The documentation should be precise and concise, yet cover a wide range of aspects in order to answer as many potential questions as possible, and at the same time stay simple and comprehensible.

In addition to making choices on the content, the form of presentation needs to be considered. Should the documentation be published as a book or as a web page? As a simple README text file which is distributed with the code, or as a manpage? Should it be published in a WIKI? Or perhaps in all of those forms to distribute the documentation to as wide an audience as possible?

Although everybody would agree that content is much more important than format, developers tend to visualize a certain format before they even start writing the first words. It is understandable, as the format supplies a certain structure, and programmers love structure. Format and structure is what they do. Writing essays or prose is not.

Apart from the obvious problem of content being dictated by format, especially in big open-source community projects such as Adempiere it can happen that each individual piece of documentation will have a different look and structure, and the reader will miss a coherent theme underlying various subprojects.

As time passes, code develops and matures, bugs are fixed, functionality is added or dropped, and the user documentation constantly needs to be updated and adjusted. Having published in different formats, it means that a new edition of the PDF book needs to be issued, web pages re-written, and WIKI-pages updated. It is only a question of time until the various documents become unsynchronized, among each other as well as with the actual source.

DocBook 5

Such problems are of course not specific to Adempiere, and already in 1991 HaL Computer Systems and O’Reilly & Associates jointly developed DocBook as a tool to write technical documentation in presentation-neutral form. This does not take the burden of writing the actual documentation off the developer, but it helps to solve most other problems.

In version 5.0, DocBook has undergone some major structural changes, so it is now commonly referred to as DocBook 5 to distinguish it from earlier versions.

A DocBook source document is a simple XML file which does not describe what its content should look like, but what the meaning of the content is.

The developer can therefore fully concentrate on writing the documentation content. He can mark certain lines as program code or screen shot, others as product or company name, and totally ignore in what font or color or size they should appear.

Writing in XML code means any text editor or word processor can be used, but of course XML-aware editors are a great help. In fact, this documentation is written using the Eclipse IDE.

After the document is written, XSL stylesheets are used to transform the XML source file into a variety of different formats. Thus a single source file can be used for generating PDF, HTML, WIKI, or even plain text results. If the documentation needs to be changed, only one file needs to be edited, and then all output formats can simply be re-compiled.

The stylesheets define where, if at all, certain blocks of text should be placed on a page, and what formatting should be used (font, color, background, size, etc.). Using the same stylesheets for documenting different projects results in a homogeneous presentation which the reader can easily recognize and feel comfortable with.

Adempiere's docbook subproject provides the stylesheets for publishing Adempiere PDF, HTML and WIKI documentation, and integrates the tools required to automatically generate them when the main code is being compiled.