1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
|
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet
href="urn:x-daps:xslt:profiling:docbook45-profile.xsl"
type="text/xml"
title="Profiling step"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd"
[<!ENTITY % entities SYSTEM "entity-decl.ent">
%entities;
]>
<chapter id="cha.daps.user.output">
<title>Generating Output Formats</title>
<abstract>
<para>
This chapter covers the following topics:
<itemizedlist>
<listitem>
<para>
Validating your XML files
</para>
</listitem>
<listitem>
<para>
Basic command syntax for generating output formats
</para>
</listitem>
<listitem>
<para>
Output formats you can generate with &dapsacr;
</para>
</listitem>
<listitem>
<para>
Generating partial builds of your documentation
</para>
</listitem>
<listitem>
<para>Specifying the &main; file at the command line (instead of using a &dc;
file)</para>
</listitem>
</itemizedlist>
</para>
</abstract>
<sect1 id="sec.daps.user.output.validate">
<title>Validating Your XML Sources</title>
&daps-validation-basics;
&daps-example-validation-error;
<para>
Using profiling in your DocBook sources makes validation
unreliable. Furthermore, validating XML files within a
<sgmltag>book</sgmltag> or <sgmltag>set</sgmltag> often exceeds validation
of the current XML file, as links (<sgmltag>xref</sgmltag> elements) or
XIncludes need to be resolved, too.
</para>
<para>
&dapsacr; can handle all those cases because of the built-in
<literal>xmllint</literal> validator. By default,
<sgmltag>remark</sgmltag> elements and XML comments are ignored during
validation. However, if you intend to create a (draft) output including
remarks or comments, you need to include them for validation—see
the example commands below.
</para>
<para>
To validate all files that belong to your documentation project,
&dapsacr; only needs to know which &dc; file to use. Use the
<option>-d</option> option to specify it.
</para>
<variablelist>
<varlistentry>
<term>Validating All XML Files in a Book, Article or Set</term>
<listitem>
<screen>&prompt.user;&dapscmd; -d <replaceable>PATH_TO_DC_FILE</replaceable> validate </screen>
<para>
If the XML files are not valid, &dapsacr; will return the parser
errors. If validation was successful, &dapsacr; returns: <literal>All
files are valid.</literal>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Validating Files Including <sgmltag>remark</sgmltag> Elements</term>
<listitem>
<screen>&prompt.user;&dapscmd; -d <replaceable>PATH_TO_DC_FILE</replaceable> validate --remarks</screen>
</listitem>
</varlistentry>
<varlistentry>
<term>Validating Files Without Checking Cross References (<sgmltag>xref</sgmltag>)</term>
<listitem>
<screen>&prompt.user;&dapscmd; -d <replaceable>PATH_TO_DC_FILE</replaceable> validate --norefcheck</screen>
<para>
This option only affects DocBook 5 sources and is ignored when
processing DocBook 4.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect1>
<sect1 id="sec.daps.user.output.syntax">
<title>Basic Syntax for Generating Output</title>
<para>
&dapsacr; supports a number of different output formats, including also
<quote>exotic</quote> formats like man pages or simple text.
<xref linkend="tab.daps.user.output.overview" xrefstyle="select:label"/>
gives an overview.
</para>
<para>
You can build several output formats (without them interfering with each
other in the <filename>build</filename> directory), build your complete
documentation project (set, book, or article), or only a part of it (for
example, a specific chapter).
</para>
<para>
Independent of the individual output format you want to create, you need
to specify the &dc; file to use:
</para>
<screen>&prompt.user;&dapscmd; -d <replaceable>PATH_TO_&dc;_FILE</replaceable> <replaceable>OUTPUT_FORMAT</replaceable> </screen>
<para>
For example:
</para>
<screen>&prompt.user;&dapscmd; -d &dc;-daps-example pdf</screen>
<para>
At the end of the transformation process, &dapsacr; shows a message where
to find the generated output.
</para>
</sect1>
<sect1 id="sec.daps.user.output.formats">
<title>Supported Output Formats</title>
<para>
The following table lists the main output formats and their
characteristics, and the &dapsacr; subcommands to generate them. Refer to
<xref linkend="sec.daps.user.output.syntax" xrefstyle="select:label"/>
for the commands' basic syntax.
</para>
<!--<remark>toms 2013-01-18: According to DocBook: Web Help -> WebHelp -
taroth 2013-01-21: hm, I already did some research on that topic some months ago
and I found lots of different spellings even within the project itself, that's
why in the end I decided to use the spelling that seemed most reasonable to
me...</remark>-->
<table id="tab.daps.user.output.overview">
<title>&dapsacr; Output Commands and Formats</title>
<xi:include href="daps_table_output_formats_i.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</table>
&daps-output-all;
<para>
By default, &dapsacr; uses the regular DocBook stylesheets, but &dapsacr;
also allows you to customize your output formats in a very flexible way.
For details, refer to <xref linkend="cha.daps.user.layout"/>.
</para>
</sect1>
<sect1 id="sec.daps.user.output.adv">
<title>Advanced Output Options</title>
<para>
In the following, find some example commands for special use cases, like
doing partial builds of your documentation project or specifying no
further parameters than the &main; file for an output. In the last case,
you can do completely without a &dc; file.
</para>
<para>
For more advanced output options like including remarks or
draft watermarks in the output, creating one big XML file or creating
distributable archives, refer to <xref linkend="cha.daps.user.review"/>.
</para>
<variablelist>
<varlistentry>
<term>Building Only Parts of a Documentation Project</term>
<listitem>
<screen>&prompt.user;&dapscmd; -d &dc;-daps-example pdf --rootid=cha.template.examples</screen>
&daps-partial-builds;
</listitem>
</varlistentry>
<varlistentry>
<term>Specifying the &main; File on the Command Line</term>
<listitem>
<screen>&prompt.user;&dapscmd; -m <replaceable>PATH_TO_MAIN_FILE</replaceable></screen>
<para>
If you do not need to specify any further parameters than the &main;
file, you can do completely without a &dc; file. With the
<option>-m</option> option you can specify the &main; file defining
your document. The options <option>-m</option> and <option>-d</option>
exclude each other.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Opening the Output Directly in a PDF Viewer</term>
<listitem>
<screen>&prompt.user;<command>evince</command> $(daps -d &dc;-daps-example pdf) &</screen>
<para>Use the syntax above to open the PDF output directly in a PDF viewer (for example,
Evince).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Getting More Information about the Build Process</term>
<listitem>
<para>
By default &dapsacr;, only provides the path to the resulting file as
output. To set higher verbosity levels, use the global options
<option>-v</option>, <option>-vv</option>, <option>-vvv</option>, and
<option>--debug</option>.
</para>
<para>
Output verbosity ranges from <option>-v</option> (print one line of
results) to <option>-vvv</option> (print all commands, very verbose).
For example, the following command will print all files created during
the build process:
</para>
<screen>&prompt.user;&dapscmd; -vv -d &dc;-daps-example pdf</screen>
<para>For debug output, use the following command:</para>
<screen>&prompt.user;&dapscmd; --debug -d &dc;-daps-example pdf</screen>
</listitem>
</varlistentry>
<varlistentry>
<term>Specifying the Number of Parallel Jobs During the Build Process</term>
<listitem>
<para>
By default &dapsacr; uses as many jobs as there are CPU cores
available. Use the option <option>--jobs</option> to define the number
of parallel jobs used for the build process. Higher numbers will lower
the build time, but will also increase CPU load. For example, the
following command will use 16 jobs for the build process:
</para>
<screen>&prompt.user;&dapscmd; --jobs=16 -d &dc;-daps-example pdf</screen>
</listitem>
</varlistentry>
</variablelist>
</sect1>
<sect1 id="sec.daps.user.output.xmlformat">
<title>Pretty XML Formatting</title>
<para>
It can be useful to have properly formatted XML sources.
A homogeneous formatting facilitates collaboration and makes diffs more readable.
If done consistently, <command>xmlformat</command> reduces the amount of changes
that need to be stored in version control systems which leads to smaller repositories.
</para>
<variablelist>
<varlistentry>
<term>Prettify all project XML files</term>
<listitem>
<screen>&prompt.user;&dapscmd; -d &dc;-daps-example xmlformat</screen>
</listitem>
</varlistentry>
<varlistentry>
<term>Prettify a specific XML file</term>
<listitem>
<screen>&prompt.user;&dapscmd; -d &dc;-daps-example xmlformat --file=xml/example.xml</screen>
</listitem>
</varlistentry>
<varlistentry>
<term>Prettify only parts of a book</term>
<listitem>
<screen>&prompt.user;&dapscmd; -d &dc;-daps-example xmlformat --rootid=cha.template.examples</screen>
</listitem>
</varlistentry>
</variablelist>
<important>
<title>
<command>xmlformat</command> Alters Source XML Files
</title>
<para>
This command reformats your XML files in place, replacing their contents with the reformatted XML.
To keep the files with the previous formatting, make a backup before running <command>daps xmlformat</command>.
</para>
</important>
</sect1>
<sect1 id="sec.daps.user.output.timestamp">
<title>Putting the current Date and Time into the Target Document</title>
<para>
To get information about the build date and time, you can use the <sgmltag class="pi">dbtimestamp</sgmltag> tag.
The processing instruction <sgmltag class="pi">dbtimestamp</sgmltag> is processed by &daps;, when the document
is built. The date and time will then show up in the final document, based on how you've set the date/time format.
</para>
<example>
<title>Example for implementing the dbtimestamp tag in an XML File:</title>
<screen><para>Current date: <?dbtimestamp?>.</para></screen>
</example>
<para>
The format of the date/time can be customized via the format parameter.
</para>
<example>
<title>Example for implementing the dbtimestamp tag with a customized format:</title>
<screen><para>Current date: <?dbtimestamp format="A, d B Y"?>.</para></screen>
</example>
<para>
For further information about the format elements look at this site:
<ulink url="http://www.sagehill.net/docbookxsl/Datetime.html"/>
</para>
</sect1>
</chapter>
|