Publication Date 18 Jan 2012
| Authors |
$Id: daps.xml 472 2011-12-29 08:56:00Z taroth21 $
| Revision History | |
|---|---|
| Revision 1.0 | 2005-05 |
|
Initial version | |
| Revision 1.41 | 2005-06-08 |
|
Updated with suggestions from Dublin | |
| Revision 1.46 | 2005-06-13 |
|
Updating information about make targets | |
| Revision 1.50 | 2005-06-21 |
|
Added information about how to configure hyphenation | |
| Revision 1.55 | 2005-07-11 |
|
Reinserted accidently delete validation section from bg again | |
| Revision 1.60 | 2005-07-13 |
|
Added new section about Checking in and Quick Start | |
| Revision | 2005-10-11 |
|
Added XEP installation, more task oriented descriptions. Reorganized the structure. Removed CVS section and moved it into a separate article. | |
| Revision 546 | 2010-10-01 |
|
Updated documentation | |
Contents
Configuring your system enables you to build books from DocBook XML sources. Proceed as follows:
Before you start, you should be aware of some prerequisites. You need:
A Linux system. :-)
Some rudimentary Linux knowledge. This article cannot explain the basics of Linux.
Some knowledge about XML and Subversion (where needed). This article cannot go in-depth into these two technologies, but we provide some links for further information. (See Links.)
The daps package. It requires several other packages, for example the DocBook stylesheets.
The daps package installs everything what you need for building PDFs and HTML. In case you want to build your books with XEP (a commercial formatter from RenderX) you should have two files:
The XEP ZIP archive with the name
xep-X.Y-DATE-docbench.zip. The placeholders
X and Y are major
and minor number of the XEP release, DATE
corresponds to the date in the format YearMonthDay.
This file contains the XEP formatter and the XML editor oXygen. You can use both independently of each other.
The license key with the name license.xml which
is mailed to you after purchasing XEP.
To install XEP on your system do the following:
Procedure 1. Installing XEP on your system
Log into your system as you normally do with your prefered user.
![]() | XEP and user root |
|---|---|
Do not install XEP as | |
Open a terminal window with Alt+F2 and enter konsole.
Copy your XEP ZIP archive to /tmp:
cp xep-X.Y-DATE-docbench.zip /tmp
Change the directory:
cd /tmp
Unzip the archive:
unzip xep-X.Y-DATE-docbench.zip
It gives you two files: a README.txt and a file named
setup-X.Y-DATE-docbench.zip.
Start the installation dialog with:
java -jar setup-X.Y-DATE-docbench.jar
Choose the correct directory where you want to install XEP and the oXygen XML Editor and select the path to the license file. Proceed with twice to start the installation process.
![]() | Home directory accessed with NFS |
|---|---|
Install XEP always in a directory which resides
on your local harddisc. Don't install XEP in a directory which is
accessed by NFS (Network File System). This is the case if you work in a
network environment where | |
Delete the copied archive and the extracted files under
/tmp where neccessary.
Extend to PATH environment variable with your
installation directory from XEP. Open ~/.bashrc or
~/.bashrc.local and insert:
export PATH="XEP_INSTALLTION_PATH:$PATH"Replace XEP_INSTALLTION_PATH with your XEP
installation directory.
Before you build a book, you should check whether all relevant packages are installed. Because it can be a bit difficult to know all packages, we have created a setup script that checks your system for the correct versions.
We assume in this section, you use the directory
/local for the storage of your files. Whenever you see
there is this directory, replace it with your choice.
Proceed as follows:
Procedure 2. Setting up your XML Build Environment
Access the source code:
If you have access to the SUSE Subversion repository, see the separate documentation Using Subversion [using.svn].
If you don't have access to our Subversion repository, you get an archive from us. Unpack it and move it to your desired location.
Change the directory:
cd /local/suselx/novdoc/
Run the following commands:
./autogen.sh && ./configure && make
First it generates the configure and
Makefile files. If this was successful the
configure script checks for certain packages and
programs, for example:
checking for inkscape... inkscape
Install further packages, if you get an error. The script tells you what you have to install.
Run the following command if everything was successful:
make install-xep
This installs configuration and hyphenation files into the XEP installation directory.
This section explains how to use our build system to create books in HTML and PDF. The entire process of building books from XML sources contains the steps in Figure 1, “Overview of the Entire Process”.
The build process looks like:
First, you need to access the files from our repository. This gives you a set of directories.
You configure your settings in your current shell
Make sure that your XML files are valid. You cannot build HTML or PDF with invalid files.
Your XML source code is profiled according to your settings. Find more in Section 7.2, “Profiling Books”.
The profiled XML sources are transformed into HTML or XSL-FO.
To build a HTML from the XML source code, you will see the following steps:
According to your settings, the XML source codes will be profiled first
The profiled XML sources are validated
After the validation, the XML sources are transformed into HTML
To build HTML do the following:
Procedure 3. Building HTML
Open a shell with Alt+F2 and type konsole
Change the directory to your directory structure:
cd PATH_TO_YOUR_DIRECTORYSet up your shell to configure your environment. In general this is done with:
source ENV-SLPROF-html
Enter:
make html
This will profile the XML sources and transform this into HTML.
Open a browser and access the HTML files under
html.
To build a PDF from the XML source code, you will see the following steps:
According to your settings, the XML source codes will be profiled first
The profiled XML sources are validated
After a successful validation, the XML sources are transformed into a FO file. This is an intermediate format
XEP reads the FO file, renders it in memory and save it as PDF
To build a PDF do the following:
Procedure 4. Building PDF¶
Open a shell with Alt+F2 and type konsole
Change the directory to your directory structure:
cd PATH_TO_YOUR_DIRECTORYSet up your shell to configure your environment. In general this is done with:
source ENV-SLPROF-print
Build your PDF with or without cropmarks:
With cropmarks:
make pdf
Without cropmarks:
make color-pdf
If you work on only one chapter, transforming the whole book is
a waste of time. You can save time if you use the
ROOTID parameter. For example, if you have
a chapter with an id
attribute value of chap.foo,
use the following procedure:
Procedure 5. Transforming Only a Portion of the Book
Open a shell with Alt+F2 and type konsole
Set up your shell to configure your environment. In general this is done with:
source ENV-SLPROF-print
or
source ENV-SLPROF-online
depending on your desired output
Open the chapter, appendix, glossary or preface that you are working on.
Check your id value by looking
at the root element. Memorize this id.
![]() | Check Your id Attribute |
|---|---|
This mechanism only works if one of the top level elements
( | |
Build your output format:
For HTML:
ROOTID=THE_ROOT_ID_VALUE make htmlFor PDF:
ROOTID=THE_ROOT_ID_VALUE make pdfOpen the result file as
or
THE_ROOT_ID_VALUE.htmlTHE_ROOT_ID_VALUE.pdf
Be aware that for HTML a chapter is spread over different files. The file
is
just the beginning. However this files contains links to everything
inside the chapter.THE_ROOT_ID_VALUE.html
In a PDF with lots of pages, it can be difficult to find the correct file if you find an error. For this purpose, we inserted the Debugging Mechanism.
You only need to set an environment variable, and the process automatically generates a PDF with filenames in it. Of course, this PDF is only for debugging purposes and is not to be published!
To create a PDF with filenames in it, do the following:
Set the environment variable DRAFT to
yes:
export DRAFT="yes"
Make sure that each root element in each file contains the attribute
xml:base with the filename in
it:
<sect1 id="sec.foo" xml:base="foo.xml"> ...
Re-create the PDF by running:
make force
The environment variable is now set. The PDF contains filenames in it.
Validation errors are fatal when they appear in the profiled source code. If some error occurs, you must modify the original source code in a way that the profiled code becomes valid. Therefore, you have to fix the error in a completely different file than where it is found in the first place. There are two mechanisms that may be used to validate the profiled source code:
make validate
make bigfile
The target make bigfile is a
workaround for a bug in xmllint that occurs in versions
before 2.6.15. When you use this target, you find the complete
book in tmp/$(BOOK).xml. The only way to
handle errors then is to look up the error in this huge file, and then
find the same error somewhere in the xml sources to fix it.
If you call make validate,
all validation errors will be listed with the filename and
line number of the profiled sources. This means that, depending on
the profiling options, the error might be exactly at the same
place in the source files, or in a later line. If you have
problems finding the error, you can look up the
profiled sources at the specified line number and then find the same
lines in the original files.
If you get an error that says that, some element does not follow the DTD, you have another way to search for the problem:
Element table content does not follow the DTD, expecting (title , tgroup), got (tgroup ) Document profiled/x86-amd64-em64t_slprof-slpers_0_0/MAIN.box.xml does not validate
In this example, the error first says, that the problem occurs in a table. The error also tells you which XML structure has been found, and what was expected. In this case, the DTD expected a title element inside the table before starting with the actual table content.
Another common problem is having data outside of XML tags. Such an error may looks like the following:
Element table content does not follow the DTD, expecting
(title , tgroup), got (title CDATA tgroup )
Document profiled/x86-amd64-em64t_slprof-slpers_0_0/MAIN.box.xml does not validateIn this example, there is a character, that is not whitespace between the title of a table and the table content. Please note that sometimes such characters are not displayed because they might not be a printable characters. In such cases, the easiest fix is to remove all whitespace, and then format the xml again.
Most of the problems are found by make
validate, but a view things are not detected
by this method. The FO-processor XEP detects at least one more type of
problem: whether index ranges have matching start and end elements. This
kind of error is quite clearly described in the output of XEP. If you have
any doubt, please compare the specified elements with the original English
version.
If you build a PDF and XEP complains about some missing fonts you didn't install the configuration file for XEP. Look at Procedure 4, “Building PDF” and begin with Step 2.
You need this section only, if you need more in-depth information of some background information.
The command line utility make reads a file
Makefile that includes a rule set for creating and
converting files. The Makefile in a project
directory just includes the file common.mk in
suselx/novdoc/make.
First, select which project to work on. This is done by sourcing an ENV- file that contains the needed information to build a certain book.
source ENV-styleguide
After this, you can use the build environment in your current shell.
Before you create your HTML or PDF, you have to make a decision about profiling. Profiling describes a method that manages different “versions” in one file.
For example, think of a chapter about installing a program on different processor architectures. Each must use different setup utilities and paths. One solution would be to write one chapter for each architecture. The problem is that there are more things that are similar than things that are different. Maintaining files that only differ in some minor paragraphs or sections is a nightmare.
A solution is to use profiling. In general, you insert each architecture into one file and distinguish the different platforms with an XML attribute. The only drawback is that you have to extract the correct version that is “buried” in the file.
To tell the build mechanics about the needed architectures, you need to
make sure that the variables PROFARCH and
PROFOS are set properly in your ENV- file. Example 1, “A ENV-* file” shows you the content of the
ENV- file that sets variables for this document. (See
also Appendix A, Adding a New Project.)
Example 1. A ENV-* file¶
Includes system relevant information. This is mandatory, and must be called at the beginning of this file. | |
Sets the main file that contains “references” to other chapters, appendixes, etc. This variable is mandatory. | |
Selects the architecture profiling information. This is an optional variable, but is most likely used in our books. | |
Selects the operating system profiling information. This is an optional variable, but is most likely used in our books. | |
Selects those parts of the book that are to be printed or made available online. Currently used parameters are print and online. | |
Determines the layout of the book. The following values are possible:
| |
Sets the version of the current distribution. This is used to distinguish versions built with make dist. |
As an author or user, you do not need to do anything special. The make
process knows which files have been modified and must be profiled again.
When changing profiling variables, the ENV- file has
to be sourced again, and a make force command will redo the profiling.
MAIN* files¶The make mechanics can be used not only for Novdoc but for DocBook as well. For this reason, mechanic has to know which stylesheet to use for profiling. We have to use different stylesheets, because we have different DTDs. Each DTD needs a separate profiling stylesheet. In general, tey are all the same, but they differ in one part: which DOCTYPE they generate.
To use it, insert the following line into the MAIN, right after the XML declaration:
<?xml-stylesheet
href="urn:x-suse:xslt:profiling:docbook45-profile.xsl"
type="text/xml"
title="Profiling step"?>The second line can be only one of the following:
urn:x-suse:xslt:profiling:novdoc-profile.xsl urn:x-suse:xslt:profiling:docbook43-profile.xsl
The first line is the default and should be used. Insert the second line only if you use DocBook V4.3.
Before you transform your XML document, you must take care that the complete document is valid. If only one file is invalid, the process stops and you do not get your desired output format. This has nothing to do with the make process itself. It is the design of XML. You can only get predicted results if the input files adhere to a certain structure.
If you want to validate your document without building, use the command
make validate
The make process takes care of profiling the files then validates the entire document. To validate only single files, use:
make validatesingle
![]() | Validating Single Files |
|---|---|
Validating single files can give unexpected results. In general, some sections or files depend on others. This can make validation difficult. | |
Add new images under
images/src in the
subdirectory of the correct format. Currently, two
formats are supported.
This is a bitmap format that is used in our online versions (HTML) for all kinds of graphics. In the printed books, it is used for screenshots too.
This is a vector format that is used in our books (PDF) when available. It can be scaled to different resolutions and you always get very high quality.
If you have a format that is not listed above, convert it into the supported format. For historical reasons, there is a FIG format, too. New files should be created and saved as SVG or PNG.
![]() | Support for Other Formats |
|---|---|
There is no need to use formats other than PNG. Other bitmap formats, like JPEG or GIF, can easily be converted into PNG. Make sure that you always use PNG. For other vector formats, check if your graphic program allows exporting SVG. If this is not possible, export to PNG. When in doubt, ask the authors of this guide. | |
Our books can be transformed into two target formats: HTML and PDF. Use HTML for online versions and PDF for a nice printout. To create HTML, type:
make html
To create PDF, type:
make pdf
This creates lots of messages. The HTML files are saved into
html. To view it, point a browser
to index.html in this directory.
For creating a PDF, just enter make. The
resulting PDF appears in the current directory and has the name
$(.BOOK).pdf
You need this section only, if you need more in-depth information of configuration and administration of the whole build mechanic.
You need to read this section only if you want to support a new language that is not available in our Subversion repository. Other users can skip this section.
XEP supports hyphenation in different languages. It uses the same algorithm as LaTeX. Therefore you can use the same files from LaTeX in XEP.
We distinguish between these two possible options:
Support a new language
Provide exceptions to hyphenated words in a supported language
The hyphenation algorithm uses hyphenation patterns to determine
possible positions in a word. XEP stores this information in the files
hyphen/*.tex.
If you want to support a new language, proceed with following steps:
Copy the respective hyphenation pattern from LaTeX into hyphen in your XEP installation
directory.
Open the XEP configuration file, usually
xep-daps.xml.
Search for the following line:
<languages default-language="en-US" xml:base="hyphen/">
Insert after this line the following XML code:
<language name="Czech" codes="cz">
<hyphenation pattern="czhyphen_rx.tex"/>In this example, you insert hyphenation patterns for Czech. The
information can be found in file
czhyphen_rx.tex.
Save the configuration file.
Sometimes, the algorithm creates unwanted results. For this reason, you can insert exceptions of hyphenation. Do the following:
Open the respective file for your language, for example
hyphen.tex for English.
If there is no line beginning with \hyphenation,
insert the following code:
\hyphenation{%Insert in the next line as many exceptions as you like. Each exception contains dashes to indicate the possible locations of hyphens. For example:
ap-pen-dix% man-u-script% man-u-scripts%
Terminate the line with:
}
Save the file.
If you are a translator, you probably need more specific information. This section gives a brief overview of what you need to know. If in doubt, contact the authors of this document.
Our XML source code contains comments in two forms: as XML comments and as remark elements. Both are used frequently and look like this:
<!-- This is an XML comment --> ... <remark>Here comes a remark comment</remark>
You do not need to translate comments. They are only informative text for writers or even for you. Sometimes there is language-specific information, so we inform you about these issues in a comment or remark.
Computer output and input often contains whitespace (space and
linebreaks). Make sure that you do not insert or delete spaces inside a
screen element. Every space here is considered
essential.
In general, screen contents should be translated
only in rare cases.
Entities are placeholders for text or other XML structures. An entity
name must never be translated! An entity looks like: &entityname;.
Copy id attributes from the
original English source code to the target language. This is important. If
you omit this step, correct references cannot be created. An id attribute
looks like this (bold text):
<sect1 id="sec.foo">
...
</sect1The “normal” text occurs inside the para
element. However, there are some locations where text is not allowed. For example, a
description of a menu item is marked up with menuchoice and
guimenu. See Example 2, “Correct use of menuchoice”.
Example 2. Correct use of menuchoice¶
<menuchoice> <guimenu>Alt</guimenu> <guimenu>F2</guimenu> </menuchoice>
Don't insert text between </guimenu>
and <guimenu> like in Example 3, “Incorrect use of menuchoice”.
Example 3. Incorrect use of menuchoice¶
<menuchoice>
<guimenu>Alt</guimenu> with
<guimenu>F2</guimenu>
</menuchoice>