bookshop 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +11 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +47 -14
- data/bookshop.gemspec +7 -8
- data/lib/bookshop/commands/build.rb +66 -3
- data/lib/bookshop/generators/bookshop/app/app_generator.rb +12 -1
- data/lib/bookshop/generators/bookshop/app/templates/README.rdoc +94 -18
- data/lib/bookshop/generators/bookshop/app/templates/book/book.xml +17 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/bookinfo.xml +22 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/ch00.xml +112 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/ch01.xml +194 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/ch02.xml +707 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/ch03.xml +2224 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/covers/.svn/all-wcprops +11 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/covers/.svn/entries +62 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/covers/.svn/prop-base/cover.jpg.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/covers/.svn/text-base/cover.jpg.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/covers/cover.jpg +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/covers/cover.pdf +4310 -13
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/all-wcprops +197 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/entries +1116 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/callouts.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/characterTool.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/commentview.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/docbook_duck.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/editReferenced.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/elementbar.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/figureInsert.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/figurePickFile2.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/fileref.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/hyperlink_print.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/hyperlink_web.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/insertcomment.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/keyCapWrap.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/lineannotations.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/linkFlow.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/linkend.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/promotedemote.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/search.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/secMenu.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/spell.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/svn_workflow_ongoing.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/svn_workflow_setup.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/tableID.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/tableInsert.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/treeView.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/ulink.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/universal_design_for_web_applications_cover.png.svn-base +5 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/untitled.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/urlAttribute.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/validation.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/viewMenu.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/prop-base/windowPrefs.png.svn-base +9 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/callouts.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/characterTool.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/commentview.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/docbook_duck.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/editReferenced.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/elementbar.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/figureInsert.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/figurePickFile2.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/fileref.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/hyperlink_print.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/hyperlink_web.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/insertcomment.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/keyCapWrap.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/lineannotations.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/linkFlow.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/linkend.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/promotedemote.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/search.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/secMenu.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/spell.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/svn_workflow_ongoing.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/svn_workflow_setup.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/tableID.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/tableInsert.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/treeView.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/ulink.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/universal_design_for_web_applications_cover.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/untitled.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/urlAttribute.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/validation.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/viewMenu.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/.svn/text-base/windowPrefs.png.svn-base +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/{images → figs}/bluehead_logo.gif +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/callouts.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/characterTool.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/commentview.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/docbook_duck.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/{images → figs}/draft.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/editReferenced.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/elementbar.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/figureInsert.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/figurePickFile2.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/fileref.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/hyperlink_print.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/hyperlink_web.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/insertcomment.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/keyCapWrap.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/lineannotations.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/linkFlow.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/linkend.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/promotedemote.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/search.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/secMenu.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/spell.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/svn_workflow_ongoing.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/svn_workflow_setup.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/tableID.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/tableInsert.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/treeView.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/ulink.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/universal_design_for_web_applications_cover.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/untitled.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/urlAttribute.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/validation.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/viewMenu.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/book/figs/windowPrefs.png +0 -0
- data/lib/bookshop/generators/bookshop/app/templates/stylesheets/html-stylesheet.xsl.tt +1 -1
- data/lib/bookshop/generators/bookshop/app/tools/java/epubcheck-1.2.jar +0 -0
- data/lib/bookshop/generators/bookshop/app/tools/java/lib/jing.jar +0 -0
- data/lib/bookshop/generators/bookshop/app/tools/java/lib/saxon.jar +0 -0
- data/lib/bookshop/generators/bookshop/app/tools/java/serializer.jar +0 -0
- data/lib/bookshop/generators/bookshop/app/tools/java/xalan.jar +0 -0
- data/lib/bookshop/generators/bookshop/app/tools/java/xercesImpl.jar +0 -0
- data/lib/bookshop/generators/bookshop/app/tools/java/{xml-apis-1.3.04.jar → xml-apis.jar} +0 -0
- data/lib/bookshop/generators/bookshop/app/tools/java/xsltc.jar +0 -0
- data/lib/bookshop/generators/bookshop/app/tools/kindle/kindlegen +0 -0
- data/lib/bookshop/version.rb +1 -1
- metadata +134 -26
- data/lib/bookshop/generators/bookshop/app/templates/book/book.xml.tt +0 -93
- data/lib/bookshop/generators/bookshop/app/templates/book/ch01_put_short_title_here.xml +0 -28
- data/lib/bookshop/generators/bookshop/app/templates/book/dedication.xml +0 -10
- data/lib/bookshop/generators/bookshop/app/templates/builds/html/.empty_directory +0 -0
- data/lib/bookshop/generators/bookshop/app/tools/java/serializer-2.7.0.jar +0 -0
- data/lib/bookshop/generators/bookshop/app/tools/java/xalan-2.7.0.jar +0 -0
- data/lib/bookshop/generators/bookshop/app/tools/java/xercesImpl-2.7.1.jar +0 -0
@@ -0,0 +1,2224 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
3
|
+
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
4
|
+
<chapter id="docbook_xml_markup_guidelines">
|
5
|
+
<title>DocBook XML Markup Guidelines</title>
|
6
|
+
|
7
|
+
<para>Here are some general markup guidelines and instructions that you may
|
8
|
+
find helpful while writing your manuscript in DocBook. If you have any
|
9
|
+
questions about what markup to use for a particular element, or whether our
|
10
|
+
toolchain supports a specific type of markup, please contact
|
11
|
+
<email>toolsreq@oreilly.com</email>.</para>
|
12
|
+
|
13
|
+
<sect1 id="keep_it_simple">
|
14
|
+
<title>Keep It Simple</title>
|
15
|
+
|
16
|
+
<para>“Keep it Simple” sounds a bit silly when referring to something as
|
17
|
+
complex as DocBook, but the point here is that even though DocBook offers
|
18
|
+
over 400 elements, you’ll likely need only a fraction of them. For
|
19
|
+
example, you can safely stay away from the <literal moreinfo="none"
|
20
|
+
role="keep-together">confsponsor</literal>, <literal
|
21
|
+
moreinfo="none">msgsub</literal>, and <literal
|
22
|
+
moreinfo="none">seriesvolnums</literal> elements. DocBook is meant to be
|
23
|
+
comprehensive across a universe of technical documentation. We’re only
|
24
|
+
dealing with a subset: content meant for expression in an O’Reilly title.
|
25
|
+
Practically speaking, you’ll mostly use elements very similar to the
|
26
|
+
standard HTML elements, like <literal
|
27
|
+
moreinfo="none">itemizedlist</literal> and <literal
|
28
|
+
moreinfo="none">table</literal>.</para>
|
29
|
+
|
30
|
+
<para><xref linkend="common_elements" /> covers some of the commonly used
|
31
|
+
DocBook elements in O’Reilly books.</para>
|
32
|
+
|
33
|
+
<sidebar>
|
34
|
+
<title>Can I Change the Appearance of Elements in My Book?</title>
|
35
|
+
|
36
|
+
<para>We have developed our series stylesheets according to O’Reilly
|
37
|
+
house style and the design standards for each series. If something isn’t
|
38
|
+
showing up as you’d expect in your PDF, or if you want to know if it’s
|
39
|
+
feasible to make a customization (after consulting with your editor on
|
40
|
+
house style), please contact <email>toolsreq@oreilly.com</email>.</para>
|
41
|
+
</sidebar>
|
42
|
+
|
43
|
+
<sect2>
|
44
|
+
<title>Using Elements Correctly</title>
|
45
|
+
|
46
|
+
<para>For XML to be valid it must not only be well-formed (which means
|
47
|
+
that all the start and end tags match), but also must have all the tags
|
48
|
+
in the proper hierarchy according to the associated DTD (in our case,
|
49
|
+
the DocBook 4.5 DTD). The tag at the top of the hierarchy is called the
|
50
|
+
root element. For a book, <literal
|
51
|
+
moreinfo="none"><book></literal> would be your root element, which
|
52
|
+
would contain <literal moreinfo="none"><part></literal> or
|
53
|
+
<literal moreinfo="none"><chapter></literal> children, for
|
54
|
+
example. Tags like <literal moreinfo="none"><chapter></literal>
|
55
|
+
must be nested within <literal moreinfo="none"><book></literal>,
|
56
|
+
and a <literal moreinfo="none"><sect3></literal> cannot be
|
57
|
+
directly nested within a <literal
|
58
|
+
moreinfo="none"><sect1></literal>; it would have to be within a
|
59
|
+
<literal moreinfo="none"><sect2></literal>. Reversed tags or
|
60
|
+
improper nesting will return invalid DocBook files.</para>
|
61
|
+
|
62
|
+
<note>
|
63
|
+
<para>One nice feature of using an XML editor such as XXE is that it
|
64
|
+
will not allow you to move, delete, or add elements in a way that
|
65
|
+
doesn’t follow the DTD hierarchy.</para>
|
66
|
+
</note>
|
67
|
+
|
68
|
+
<sidebar>
|
69
|
+
<title>Tags Versus Elements</title>
|
70
|
+
|
71
|
+
<para>The words “tag” and “element” are sometimes used
|
72
|
+
interchangeably, but there is a distinction. For example,
|
73
|
+
<literal><chapter></literal> is a tag that indicates the start
|
74
|
+
of a <literal>chapter</literal> element. For the XML document to be
|
75
|
+
well-formed, it must contain an end tag,
|
76
|
+
<literal></chapter></literal>.</para>
|
77
|
+
|
78
|
+
<para>Some tags are self-contained and stand alone as complete
|
79
|
+
elements, without the need for separate end tags. For example,
|
80
|
+
<literal><xref linkend="foo" /></literal> is a self-contained
|
81
|
+
tag—note the <literal>/></literal> marker that closes it.</para>
|
82
|
+
</sidebar>
|
83
|
+
</sect2>
|
84
|
+
|
85
|
+
<sect2>
|
86
|
+
<title>Sample Markup and PDFs</title>
|
87
|
+
|
88
|
+
<para>This document uses the same DocBook markup as our books, so you
|
89
|
+
can use it as a model for your own manuscript. <xref
|
90
|
+
linkend="common_elements" /> provides a close look at some of the more
|
91
|
+
frequently used elements in O’Reilly books. In addition, please check
|
92
|
+
out some book samples we have posted, which are available at the URL
|
93
|
+
below. Note that we often put a README (text) file in each directory to
|
94
|
+
give you a bit of guidance on what is where, and generally it’s best to
|
95
|
+
take a look at the PDF version for additional commentary before delving
|
96
|
+
into the XML.</para>
|
97
|
+
|
98
|
+
<simplelist>
|
99
|
+
<member><ulink
|
100
|
+
url="https://prod.oreilly.com/external/tools/docbook/prod/trunk/samples/"></ulink></member>
|
101
|
+
|
102
|
+
<member>(username: <literal moreinfo="none">guest</literal>; empty
|
103
|
+
password)</member>
|
104
|
+
</simplelist>
|
105
|
+
|
106
|
+
<note>
|
107
|
+
<para>If the Tools team has already given you SVN credentials
|
108
|
+
(mentioned in <xref linkend="using_an_oreilly_svn_repo" />), you
|
109
|
+
should use those instead of “guest” so that your browser/client
|
110
|
+
doesn’t cache “guest” and later prevent you from accessing your own
|
111
|
+
repo.</para>
|
112
|
+
</note>
|
113
|
+
|
114
|
+
<para>The samples include a standard chapter as well as more complex
|
115
|
+
markup, including:</para>
|
116
|
+
|
117
|
+
<itemizedlist>
|
118
|
+
<listitem>
|
119
|
+
<para>Markup/rendering for RefEntry material (common in Nutshells
|
120
|
+
and occasionally other series; consult with your editor on whether
|
121
|
+
this applies to your book), found in the
|
122
|
+
<filename>nutshell/</filename> directory</para>
|
123
|
+
</listitem>
|
124
|
+
|
125
|
+
<listitem>
|
126
|
+
<para>Bibliography markup/rendering, in the
|
127
|
+
<filename>bibliography/</filename> directory</para>
|
128
|
+
</listitem>
|
129
|
+
|
130
|
+
<listitem>
|
131
|
+
<para>URL markup/rendering options, in the
|
132
|
+
<filename>urls/</filename> directory</para>
|
133
|
+
</listitem>
|
134
|
+
</itemizedlist>
|
135
|
+
|
136
|
+
<sidebar>
|
137
|
+
<title>The Elements in My PDFs Don’t Look Like the Ones in this
|
138
|
+
Document</title>
|
139
|
+
|
140
|
+
<para>The rendered version of this document is an example of
|
141
|
+
O’Reilly’s Animal Guide series template. You may be working on a book
|
142
|
+
in a different series, such as Theory In Practice, Nutshell, Cookbook,
|
143
|
+
or Pocket Reference. That’s fine—the book’s series doesn’t affect how
|
144
|
+
you write in DocBook. The XML <emphasis>markup</emphasis> you use
|
145
|
+
won’t change, since it’s the underlying series
|
146
|
+
<emphasis>stylesheet</emphasis> that determines how the elements
|
147
|
+
appear in the PDF. You can find more series-specific information and
|
148
|
+
examples in the <filename><ulink role="orm:hideurl:ital"
|
149
|
+
url="https://prod.oreilly.com/external/tools/docbook/prod/trunk/samples/">samples/</ulink></filename>
|
150
|
+
directory.</para>
|
151
|
+
</sidebar>
|
152
|
+
</sect2>
|
153
|
+
</sect1>
|
154
|
+
|
155
|
+
<sect1 id="organizing_files">
|
156
|
+
<title>Organizing Your Files</title>
|
157
|
+
|
158
|
+
<para>As you will see in the <filename moreinfo="none">book.xml</filename>
|
159
|
+
file that O’Reilly provides for you, the book file contains just the book
|
160
|
+
metadata and no actual content. Each chapter is its own full DocBook
|
161
|
+
document with its own <literal moreinfo="none">DOCTYPE</literal>
|
162
|
+
declaration, which makes validation easier.</para>
|
163
|
+
|
164
|
+
<note>
|
165
|
+
<para>This section discusses the files as we structure and name them
|
166
|
+
once they are submitted to Production, but when you are working on them,
|
167
|
+
you can structure and name them in any way that’s convenient for you.
|
168
|
+
All that matters is that you have a valid
|
169
|
+
<filename>book.xml</filename>—whether it’s a monolithic file you edit
|
170
|
+
directly, generate from a custom Makefile, etc.</para>
|
171
|
+
</note>
|
172
|
+
|
173
|
+
<para>Once you check out the template files from your SVN repository (see
|
174
|
+
<xref linkend="docbook_and_subversion" />), you can open the <filename
|
175
|
+
moreinfo="none">ch01.xml</filename> file and begin typing your first
|
176
|
+
paragraph. The basic <ulink
|
177
|
+
url="http://www.docbook.org/tdg/en/html/ch02.html#d0e2566"><literal>DOCTYPE</literal></ulink>
|
178
|
+
and other metadata will already be in the <filename
|
179
|
+
moreinfo="none">book.xml</filename> file for you, so you can concentrate
|
180
|
+
more on writing your book and less on XML markup.</para>
|
181
|
+
|
182
|
+
<sect2 id="adding_chapters_to_the_book">
|
183
|
+
<title>Adding Chapters to the Book</title>
|
184
|
+
|
185
|
+
<para>The <filename>book.xml</filename> file includes information
|
186
|
+
pertaining to which files comprise the book and the order in which they
|
187
|
+
should appear:</para>
|
188
|
+
|
189
|
+
<programlisting><?xml version="1.0"?>
|
190
|
+
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
191
|
+
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
192
|
+
<book>
|
193
|
+
<title>Wikipedia: The Missing Manual</title>
|
194
|
+
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bookinfo.xml"/>
|
195
|
+
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ch00.xml"/>
|
196
|
+
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ch01.xml"/>
|
197
|
+
<!-- The rest of the chapter files are listed here -->
|
198
|
+
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ch21.xml"/>
|
199
|
+
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="appa.xml"/>
|
200
|
+
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="appb.xml"/>
|
201
|
+
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="appc.xml"/>
|
202
|
+
</book></programlisting>
|
203
|
+
|
204
|
+
<para>After you complete your first chapter and save it, you can create
|
205
|
+
a new, separate file for Chapter 2, modeled on your Chapter 1 file. Name
|
206
|
+
your new chapter—<filename moreinfo="none">ch02.xml</filename> is
|
207
|
+
O’Reilly’s naming convention—and then reference and include this chapter
|
208
|
+
in the <filename>book.xml</filename> file that is in your book
|
209
|
+
directory, <ulink
|
210
|
+
url="http://www.sagehill.net/docbookxsl/ModularDoc.html#UsingXinclude">using
|
211
|
+
an <literal moreinfo="none">XInclude</literal></ulink> as
|
212
|
+
follows:</para>
|
213
|
+
|
214
|
+
<programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ch02.xml"/></programlisting>
|
215
|
+
|
216
|
+
<warning>
|
217
|
+
<para>If your book contains parts, you may need to add files to the
|
218
|
+
appropriate <filename>part<replaceable>N</replaceable>.xml</filename>
|
219
|
+
instead of the <filename>book.xml</filename> file.</para>
|
220
|
+
</warning>
|
221
|
+
|
222
|
+
<para>Other template files, such as <filename>foreword.xml</filename>
|
223
|
+
and <filename>dedication.xml</filename>, can be found in the
|
224
|
+
<filename><ulink role="orm:hideurl:ital"
|
225
|
+
url="https://prod.oreilly.com/external/tools/docbook/prod/trunk/samples/">samples/</ulink></filename>
|
226
|
+
directory mentioned earlier. As you create new chapters and add them to
|
227
|
+
the book file, you’ll build a complete book document that can be
|
228
|
+
published in a variety of formats.</para>
|
229
|
+
|
230
|
+
<note>
|
231
|
+
<para>Chapter openers always start on a righthand page in the PDF.
|
232
|
+
This means the last page of a chapter may be blank.</para>
|
233
|
+
</note>
|
234
|
+
</sect2>
|
235
|
+
|
236
|
+
<sect2 id="using_sect1s_etc">
|
237
|
+
<title>Using sect1s, sect2s, sect3s</title>
|
238
|
+
|
239
|
+
<para>Just as the book is made up of chapters, each chapter is made up
|
240
|
+
of sections (though chapter files do not necessarily use
|
241
|
+
<literal>XIncludes</literal>). Please use <literal>sect1</literal>,
|
242
|
+
<literal>sect2</literal>, and <literal>sect3</literal> elements, rather
|
243
|
+
than <literal>section</literal> elements, to structure your chapter.
|
244
|
+
Typically both <literal>sect1</literal> and <literal>sect2</literal>
|
245
|
+
titles will appear in the TOC.</para>
|
246
|
+
|
247
|
+
<para>The basic chapter structure looks something like this:</para>
|
248
|
+
|
249
|
+
<programlisting><?xml version="1.0" encoding="UTF-8"?>
|
250
|
+
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
251
|
+
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
252
|
+
<chapter id="chapter_id">
|
253
|
+
<title>Chapter Title Here</title>
|
254
|
+
<sect1>
|
255
|
+
<title>Sect1 Title Here</title>
|
256
|
+
<para>Text goes here...</para>
|
257
|
+
<sect2>
|
258
|
+
<title>Sect2 Title Here</title>
|
259
|
+
<para>Text goes here...</para>
|
260
|
+
<sect3>
|
261
|
+
<title>Sect3 title here</title>
|
262
|
+
<para>Text goes here...</para>
|
263
|
+
</sect3>
|
264
|
+
</sect2>
|
265
|
+
</sect1>
|
266
|
+
</chapter></programlisting>
|
267
|
+
|
268
|
+
<para>Note the <literal>para</literal>s between sections. Per O’Reilly
|
269
|
+
house style, we ask that you don’t add a section directly after the
|
270
|
+
previous section’s title with no <literal>para</literal> or other
|
271
|
+
element in between (though doing so isn’t invalid). In other words,
|
272
|
+
don’t do this:</para>
|
273
|
+
|
274
|
+
<programlisting><sect1>
|
275
|
+
<title>Sect1 Title Here</title>
|
276
|
+
<sect2>
|
277
|
+
<title>Sect2 Title Here</title>
|
278
|
+
<para>Text goes here...</para>
|
279
|
+
</sect2>
|
280
|
+
</sect1></programlisting>
|
281
|
+
|
282
|
+
<note>
|
283
|
+
<para>For a complete list of O’Reilly’s style conventions, including
|
284
|
+
proper heading and title capitalization, consult the <ulink
|
285
|
+
url="http://oreilly.com/oreilly/author/stylesheet.html">O’Reilly
|
286
|
+
Stylesheet and Word List</ulink>. Also keep in mind that except in
|
287
|
+
code listings, there should be no blank or empty lines in your XML
|
288
|
+
documents.</para>
|
289
|
+
</note>
|
290
|
+
|
291
|
+
<sect3>
|
292
|
+
<title>sect4s</title>
|
293
|
+
|
294
|
+
<para>You may also use <literal>sect4</literal>s, although these are
|
295
|
+
much less common in O’Reilly books. The <literal>sect4</literal> title
|
296
|
+
renders inline, with an autogenerated period following it, rather than
|
297
|
+
as a separate heading. Here’s the markup:</para>
|
298
|
+
|
299
|
+
<programlisting><sect4>
|
300
|
+
<title>Example sect4</title>
|
301
|
+
<para>This is a paragraph inside a <literal>sect4</literal>.</para>
|
302
|
+
</sect4></programlisting>
|
303
|
+
|
304
|
+
<para>Here’s how it renders:</para>
|
305
|
+
|
306
|
+
<sect4>
|
307
|
+
<title>Example sect4</title>
|
308
|
+
|
309
|
+
<para>This is a paragraph inside a <literal>sect4</literal>.</para>
|
310
|
+
</sect4>
|
311
|
+
</sect3>
|
312
|
+
</sect2>
|
313
|
+
|
314
|
+
<sect2 id="creating_xrefs">
|
315
|
+
<title>Creating Cross-References</title>
|
316
|
+
|
317
|
+
<para>All references to titled block elements and book
|
318
|
+
components—figures, tables, <phrase
|
319
|
+
role="keep-together">examples</phrase>, sections, chapters, parts,
|
320
|
+
etc.—should be marked up as <literal>xref</literal>s, not entered as
|
321
|
+
plain text. <literal>xref</literal> markup will become a live hyperlink
|
322
|
+
to the target in online versions, and will automatically update if you
|
323
|
+
move numbered elements (figures, chapters, etc.) around while editing.
|
324
|
+
To insert an <literal>xref</literal>, follow these steps:</para>
|
325
|
+
|
326
|
+
<orderedlist>
|
327
|
+
<listitem>
|
328
|
+
<para>Note the <literal>id</literal> of the element you are
|
329
|
+
referencing. If the element does not have an <literal>id</literal>,
|
330
|
+
you will need to add one. For the book to be valid,
|
331
|
+
<literal>id</literal> attributes must be unique across the entire
|
332
|
+
book, have no spaces, and not start with a number. For example, a
|
333
|
+
figure <literal>id</literal> looks like this:</para>
|
334
|
+
|
335
|
+
<programlisting><figure id="foo"></programlisting>
|
336
|
+
</listitem>
|
337
|
+
|
338
|
+
<listitem>
|
339
|
+
<para>Once you have the <literal>id</literal>, you can insert an
|
340
|
+
<literal>xref</literal> element that references it via a
|
341
|
+
<literal>linkend</literal> attribute, like so:</para>
|
342
|
+
|
343
|
+
<programlisting><xref linkend="foo" /></programlisting>
|
344
|
+
</listitem>
|
345
|
+
</orderedlist>
|
346
|
+
|
347
|
+
<warning>
|
348
|
+
<para>You cannot use the word “inherit” as an <literal>id</literal>.
|
349
|
+
It won’t render properly in the PDF.</para>
|
350
|
+
</warning>
|
351
|
+
|
352
|
+
<para>The following table shows examples of <literal>xref</literal>
|
353
|
+
markup and rendering for various <phrase
|
354
|
+
role="keep-together">elements</phrase>.</para>
|
355
|
+
|
356
|
+
<informaltable>
|
357
|
+
<tgroup cols="3">
|
358
|
+
<thead>
|
359
|
+
<row>
|
360
|
+
<entry><phrase role="keep-together">Element to be
|
361
|
+
referenced</phrase></entry>
|
362
|
+
|
363
|
+
<entry>xref markup</entry>
|
364
|
+
|
365
|
+
<entry><phrase role="keep-together">xref
|
366
|
+
rendering</phrase></entry>
|
367
|
+
</row>
|
368
|
+
</thead>
|
369
|
+
|
370
|
+
<tbody>
|
371
|
+
<row>
|
372
|
+
<entry><literal><sect1
|
373
|
+
id="keep_it_simple"></literal></entry>
|
374
|
+
|
375
|
+
<entry><literal><xref
|
376
|
+
linkend="keep_it_simple"/></literal></entry>
|
377
|
+
|
378
|
+
<entry><xref linkend="keep_it_simple" /></entry>
|
379
|
+
</row>
|
380
|
+
|
381
|
+
<row>
|
382
|
+
<entry><literal><chapter
|
383
|
+
id="setting_up_your_xml_files"></literal></entry>
|
384
|
+
|
385
|
+
<entry><literal><xref
|
386
|
+
linkend="setting_up_your_xml_files"/></literal></entry>
|
387
|
+
|
388
|
+
<entry><xref linkend="setting_up_your_xml_files" /></entry>
|
389
|
+
</row>
|
390
|
+
|
391
|
+
<row>
|
392
|
+
<entry><literal><figure
|
393
|
+
id="svn_workflow_setup"></literal></entry>
|
394
|
+
|
395
|
+
<entry><literal><xref
|
396
|
+
linkend="svn_workflow_setup"/></literal></entry>
|
397
|
+
|
398
|
+
<entry><xref linkend="svn_workflow_setup" /></entry>
|
399
|
+
</row>
|
400
|
+
|
401
|
+
<row>
|
402
|
+
<entry><literal><example
|
403
|
+
id="sample_example"></literal></entry>
|
404
|
+
|
405
|
+
<entry><literal><xref
|
406
|
+
linkend="sample_example"/></literal></entry>
|
407
|
+
|
408
|
+
<entry><xref linkend="sample_example" /></entry>
|
409
|
+
</row>
|
410
|
+
|
411
|
+
<row>
|
412
|
+
<entry><literal><table
|
413
|
+
id="maximum_widths"></literal></entry>
|
414
|
+
|
415
|
+
<entry><literal><xref
|
416
|
+
linkend="maximum_widths"/></literal></entry>
|
417
|
+
|
418
|
+
<entry><xref linkend="maximum_widths" /></entry>
|
419
|
+
</row>
|
420
|
+
</tbody>
|
421
|
+
</tgroup>
|
422
|
+
</informaltable>
|
423
|
+
|
424
|
+
<para>Note that cross-references to terms in a
|
425
|
+
<filename>glossary.xml</filename> use special markup, not
|
426
|
+
<literal>xref</literal>. See the <ulink role="orm:hideurl:ital"
|
427
|
+
url="https://prod.oreilly.com/external/tools/docbook/prod/trunk/samples/glossary">/samples/glossary/</ulink>
|
428
|
+
dir for details.</para>
|
429
|
+
|
430
|
+
<warning>
|
431
|
+
<para>Do not hardcode titles, labels, or page numbers. All of these
|
432
|
+
elements of the rendered <literal>xref</literal> are autogenerated; if
|
433
|
+
you move the referenced section to another place in the book or reword
|
434
|
+
a title, the cross-ref will automatically update.</para>
|
435
|
+
</warning>
|
436
|
+
</sect2>
|
437
|
+
</sect1>
|
438
|
+
|
439
|
+
<sect1 id="common_elements">
|
440
|
+
<title>Common Elements</title>
|
441
|
+
|
442
|
+
<para>The following sections describe and provide examples of common
|
443
|
+
DocBook elements in O’Reilly books. As mentioned earlier, additional
|
444
|
+
markup samples are available here: <ulink
|
445
|
+
url="https://prod.oreilly.com/external/tools/docbook/prod/trunk/samples/"></ulink></para>
|
446
|
+
|
447
|
+
<sect2>
|
448
|
+
<title>Block Elements Versus Inline Elements</title>
|
449
|
+
|
450
|
+
<para>At the paragraph-level, there are two basic types of
|
451
|
+
elements:</para>
|
452
|
+
|
453
|
+
<variablelist>
|
454
|
+
<varlistentry>
|
455
|
+
<term>Block elements</term>
|
456
|
+
|
457
|
+
<listitem>
|
458
|
+
<para>Usually presented with a paragraph break before and after
|
459
|
+
them. Block elements may contain character data, inline elements,
|
460
|
+
and possibly other block elements. Examples include paragraphs,
|
461
|
+
lists, sidebars, tables, and block quotations.</para>
|
462
|
+
</listitem>
|
463
|
+
</varlistentry>
|
464
|
+
|
465
|
+
<varlistentry>
|
466
|
+
<term>Inline elements</term>
|
467
|
+
|
468
|
+
<listitem>
|
469
|
+
<para>Usually distinguished by a font change rather than obvious
|
470
|
+
breaks. Inline elements may contain character data and possibly
|
471
|
+
other inline elements, but never block elements. Examples include
|
472
|
+
cross-references, filenames, commands, and URLs.</para>
|
473
|
+
</listitem>
|
474
|
+
</varlistentry>
|
475
|
+
</variablelist>
|
476
|
+
|
477
|
+
<sidebar>
|
478
|
+
<title>Avoid Putting Block Elements in <para>s</title>
|
479
|
+
|
480
|
+
<para>To prevent spacing problems in rendering downstream, we’d prefer
|
481
|
+
that you don’t put any block elements within <literal
|
482
|
+
moreinfo="none">para</literal>s. In other words, block elements should
|
483
|
+
come <emphasis>after</emphasis> the closing
|
484
|
+
<literal></para></literal> tag, not be nested within
|
485
|
+
<literal><para></literal> tags. Some of the block elements that
|
486
|
+
we’d like to avoid in <literal moreinfo="none">para</literal>s are the
|
487
|
+
<phrase role="keep-together">following</phrase>:</para>
|
488
|
+
|
489
|
+
<simplelist type="vert">
|
490
|
+
<member><literal moreinfo="none">blockquote</literal></member>
|
491
|
+
|
492
|
+
<member><literal moreinfo="none">calloutlist</literal></member>
|
493
|
+
|
494
|
+
<member><literal moreinfo="none">example</literal></member>
|
495
|
+
|
496
|
+
<member><literal moreinfo="none">figure</literal></member>
|
497
|
+
|
498
|
+
<member><literal moreinfo="none">glosslist</literal></member>
|
499
|
+
|
500
|
+
<member><literal moreinfo="none">informalequation</literal></member>
|
501
|
+
|
502
|
+
<member><literal moreinfo="none">informalexample</literal></member>
|
503
|
+
|
504
|
+
<member><literal moreinfo="none">informalfigure</literal></member>
|
505
|
+
|
506
|
+
<member><literal moreinfo="none">informaltable</literal></member>
|
507
|
+
|
508
|
+
<member><literal moreinfo="none">itemizedlist</literal></member>
|
509
|
+
|
510
|
+
<member><literal moreinfo="none">literallayout</literal></member>
|
511
|
+
|
512
|
+
<member><literal moreinfo="none">mediaobject</literal></member>
|
513
|
+
|
514
|
+
<member><literal moreinfo="none">note</literal></member>
|
515
|
+
|
516
|
+
<member><literal moreinfo="none">orderedlist</literal></member>
|
517
|
+
|
518
|
+
<member><literal moreinfo="none">programlisting</literal></member>
|
519
|
+
|
520
|
+
<member><literal moreinfo="none">screen</literal></member>
|
521
|
+
|
522
|
+
<member><literal moreinfo="none">sidebar</literal></member>
|
523
|
+
|
524
|
+
<member><literal moreinfo="none">simplelist</literal></member>
|
525
|
+
|
526
|
+
<member><literal moreinfo="none">table</literal></member>
|
527
|
+
|
528
|
+
<member><literal moreinfo="none">variablelist</literal></member>
|
529
|
+
|
530
|
+
<member><literal moreinfo="none">warning</literal></member>
|
531
|
+
</simplelist>
|
532
|
+
</sidebar>
|
533
|
+
</sect2>
|
534
|
+
|
535
|
+
<sect2>
|
536
|
+
<title>Inline Font Markup</title>
|
537
|
+
|
538
|
+
<para>Here are the most common inline elements:</para>
|
539
|
+
|
540
|
+
<variablelist>
|
541
|
+
<varlistentry>
|
542
|
+
<term role="plain"><citation><citation></citation></term>
|
543
|
+
|
544
|
+
<listitem>
|
545
|
+
<para>Used in cross-reference syntax. Authors can also use this
|
546
|
+
for hardcoded <phrase role="keep-together">cross-</phrase><phrase
|
547
|
+
role="keep-together">references</phrase> to other, non-O’Reilly
|
548
|
+
books. As in, “See <citation>TITLE</citation>, published by
|
549
|
+
<replaceable role="keep-together">publisher</replaceable>”.</para>
|
550
|
+
</listitem>
|
551
|
+
</varlistentry>
|
552
|
+
|
553
|
+
<varlistentry>
|
554
|
+
<term role="plain"><command><command></command></term>
|
555
|
+
|
556
|
+
<listitem>
|
557
|
+
<para>An executable program, or the entry a user makes to execute
|
558
|
+
a command. As in, “Compare the two documents with the
|
559
|
+
<command>diff</command> command.”</para>
|
560
|
+
</listitem>
|
561
|
+
</varlistentry>
|
562
|
+
|
563
|
+
<varlistentry>
|
564
|
+
<term role="plain"><emphasis><email></emphasis></term>
|
565
|
+
|
566
|
+
<listitem>
|
567
|
+
<para>An email address, such as
|
568
|
+
<email>example@oreilly.com</email>. (Note that these will become
|
569
|
+
hyperlinks in online versions, so for fake or example addresses,
|
570
|
+
use <literal><emphasis></literal> <phrase
|
571
|
+
role="keep-together">instead</phrase>.)</para>
|
572
|
+
</listitem>
|
573
|
+
</varlistentry>
|
574
|
+
|
575
|
+
<varlistentry>
|
576
|
+
<term role="plain"><emphasis><emphasis></emphasis></term>
|
577
|
+
|
578
|
+
<listitem>
|
579
|
+
<para>Provided for use where you would traditionally use
|
580
|
+
<emphasis>italics</emphasis> to emphasize a word or phrase.</para>
|
581
|
+
</listitem>
|
582
|
+
</varlistentry>
|
583
|
+
|
584
|
+
<varlistentry>
|
585
|
+
<term role="plain"><emphasis role="bold"><emphasis
|
586
|
+
role="bold"></emphasis></term>
|
587
|
+
|
588
|
+
<listitem>
|
589
|
+
<para>A general-purpose tag provided for where you would use
|
590
|
+
<emphasis role="bold">bold</emphasis> type to emphasize a word or
|
591
|
+
phrase. (Note that <ulink role="orm:hideurl"
|
592
|
+
url="http://oreilly.com/oreilly/author/stylesheet.html">O’Reilly
|
593
|
+
house style</ulink> prefers italics for emphasis.)</para>
|
594
|
+
</listitem>
|
595
|
+
</varlistentry>
|
596
|
+
|
597
|
+
<varlistentry>
|
598
|
+
<term><phrase role="roman"><phrase
|
599
|
+
role="roman"></phrase></term>
|
600
|
+
|
601
|
+
<listitem>
|
602
|
+
<para>Provided for use within italicized text where you would
|
603
|
+
ordinarily use <phrase role="roman">italics</phrase> to emphasize
|
604
|
+
a word or phrase.</para>
|
605
|
+
</listitem>
|
606
|
+
</varlistentry>
|
607
|
+
|
608
|
+
<varlistentry>
|
609
|
+
<term role="plain"><filename><filename></filename></term>
|
610
|
+
|
611
|
+
<listitem>
|
612
|
+
<para>Used for the name of a file, directory, or path (e.g.,
|
613
|
+
<filename>/usr/bin</filename>).</para>
|
614
|
+
</listitem>
|
615
|
+
</varlistentry>
|
616
|
+
|
617
|
+
<varlistentry>
|
618
|
+
<term role="plain"><keycap><keycap></keycap></term>
|
619
|
+
|
620
|
+
<listitem>
|
621
|
+
<para>The text printed on a physical key on a computer keyboard
|
622
|
+
(e.g., <keycap>Return</keycap>).</para>
|
623
|
+
</listitem>
|
624
|
+
</varlistentry>
|
625
|
+
|
626
|
+
<varlistentry>
|
627
|
+
<term role="plain"><literal><literal></literal></term>
|
628
|
+
|
629
|
+
<listitem>
|
630
|
+
<para>Any stretch of text that must appear in <literal>constant
|
631
|
+
width</literal> font.</para>
|
632
|
+
</listitem>
|
633
|
+
</varlistentry>
|
634
|
+
|
635
|
+
<varlistentry>
|
636
|
+
<term
|
637
|
+
role="plain"><replaceable><replaceable></replaceable></term>
|
638
|
+
|
639
|
+
<listitem>
|
640
|
+
<para>Text that should be replaced with user-supplied values or by
|
641
|
+
values determined by context. Appears in <replaceable>constant
|
642
|
+
width italic</replaceable>.</para>
|
643
|
+
</listitem>
|
644
|
+
</varlistentry>
|
645
|
+
|
646
|
+
<varlistentry>
|
647
|
+
<term role="plain"><subscript><subscript></subscript></term>
|
648
|
+
|
649
|
+
<listitem>
|
650
|
+
<para>A subscript character.</para>
|
651
|
+
</listitem>
|
652
|
+
</varlistentry>
|
653
|
+
|
654
|
+
<varlistentry>
|
655
|
+
<term
|
656
|
+
role="plain"><superscript><superscript></superscript></term>
|
657
|
+
|
658
|
+
<listitem>
|
659
|
+
<para>A superscript character.</para>
|
660
|
+
</listitem>
|
661
|
+
</varlistentry>
|
662
|
+
|
663
|
+
<varlistentry>
|
664
|
+
<term role="plain"><emphasis><ulink
|
665
|
+
url="ulink.org"/></emphasis></term>
|
666
|
+
|
667
|
+
<listitem>
|
668
|
+
<para>Several styles of <literal>ulink</literal>s and various URL
|
669
|
+
markup/rendering options are supported. See <xref
|
670
|
+
linkend="inserting_hyperlinks" /> for more details. (Note that
|
671
|
+
these will become hyperlinks in online versions, so for fake or
|
672
|
+
example URLs, use <literal><emphasis></literal> or
|
673
|
+
<literal><uri></literal> instead.)</para>
|
674
|
+
</listitem>
|
675
|
+
</varlistentry>
|
676
|
+
|
677
|
+
<varlistentry>
|
678
|
+
<term role="plain"><userinput><userinput></userinput></term>
|
679
|
+
|
680
|
+
<listitem>
|
681
|
+
<para><userinput>Data entered by the user</userinput>, typically
|
682
|
+
at a prompt line. Use with
|
683
|
+
<replaceable><replaceable></replaceable> if needed:
|
684
|
+
<userinput><userinput><<replaceable>replaceable</replaceable>><userinput></userinput></para>
|
685
|
+
</listitem>
|
686
|
+
</varlistentry>
|
687
|
+
</variablelist>
|
688
|
+
|
689
|
+
<sect3 id="verbatim_caveats">
|
690
|
+
<title>Caveats about inline markup in verbatim environments</title>
|
691
|
+
|
692
|
+
<para>Although inline markup within verbatim blocks
|
693
|
+
(<literal>programlisting</literal>s or <literal>screen</literal>s) is
|
694
|
+
valid DocBook, we ask that you follow some guidelines to prevent
|
695
|
+
rendering problems downstream. When using inline markup on multiple
|
696
|
+
code lines, close it before each linebreak and reopen if continuing on
|
697
|
+
the next line. For example, change this:</para>
|
698
|
+
|
699
|
+
<programlisting><emphasis role="bold"> GLuint m_gridTexture;
|
700
|
+
IResourceManager* m_resourceManager;
|
701
|
+
</emphasis>};</programlisting>
|
702
|
+
|
703
|
+
<para>to this:</para>
|
704
|
+
|
705
|
+
<programlisting><emphasis role="bold"> GLuint m_gridTexture;</emphasis>
|
706
|
+
<emphasis role="bold"> IResourceManager* m_resourceManager;</emphasis>
|
707
|
+
};</programlisting>
|
708
|
+
|
709
|
+
<para>To ensure proper rendering, we also ask that you don’t add
|
710
|
+
newlines at the beginning or end of code blocks. This is because
|
711
|
+
<emphasis>all</emphasis> linebreaks and whitespace are preserved in
|
712
|
+
verbatim blocks, including leading and trailing space. For example,
|
713
|
+
the following listing will render with extra blank lines at the top
|
714
|
+
and bottom, because of the linebreaks following the opening
|
715
|
+
<literal><programlisting></literal> tag and preceding the
|
716
|
+
closing <literal></programlisting></literal> tag:</para>
|
717
|
+
|
718
|
+
<programlisting><programlisting>
|
719
|
+
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
|
720
|
+
locationManager.delegate = self;
|
721
|
+
[locationManager startUpdatingLocation];
|
722
|
+
} else {
|
723
|
+
NSLog(@"Location services not enabled.");
|
724
|
+
}
|
725
|
+
</programlisting></programlisting>
|
726
|
+
|
727
|
+
<para>Although we have tools to remove the extraneous whitespace once
|
728
|
+
the files are in Production, we prefer not to run global changes on
|
729
|
+
code content, so it’s best if you avoid adding it in the first place.
|
730
|
+
Mark up the above like this instead:</para>
|
731
|
+
|
732
|
+
<programlisting><programlisting>CLLocationManager *locationManager = [[CLLocationManager alloc] init];
|
733
|
+
locationManager.delegate = self;
|
734
|
+
[locationManager startUpdatingLocation];
|
735
|
+
} else {
|
736
|
+
NSLog(@"Location services not enabled.");
|
737
|
+
}</programlisting></programlisting>
|
738
|
+
</sect3>
|
739
|
+
</sect2>
|
740
|
+
|
741
|
+
<sect2 id="inserting_figures">
|
742
|
+
<title>Figures</title>
|
743
|
+
|
744
|
+
<para>Figures are similar to tables and examples in that they can be
|
745
|
+
either formal or informal. Formal figures have a title (aka caption), an
|
746
|
+
autogenerated numeric label, and (per O’Reilly house style) an explicit
|
747
|
+
cross-reference. Note that you do not need to number the figure in the
|
748
|
+
XML; the O’Reilly stylesheets autogenerate the number in both the figure
|
749
|
+
label and all <literal>xref</literal>s to it. Formal figures are more
|
750
|
+
common than informal figures in O’Reilly books. Unless you have a
|
751
|
+
special reason for using an informal figure (e.g., if it’s impractical
|
752
|
+
for the image to have a title), you should use a formal figure.</para>
|
753
|
+
|
754
|
+
<para>Find more information on how to prepare the image files themselves
|
755
|
+
in the <ulink
|
756
|
+
url="https://prod.oreilly.com/external/illustrations/illustrations_guidelines.html">O’Reilly
|
757
|
+
Media Illustration Guidelines</ulink>.</para>
|
758
|
+
|
759
|
+
<para>Here’s an example of proper <literal>figure</literal>
|
760
|
+
markup:</para>
|
761
|
+
|
762
|
+
<programlisting><figure id="docbook_duck_fig">
|
763
|
+
<title>The DocBook duck</title>
|
764
|
+
<mediaobject>
|
765
|
+
<imageobject>
|
766
|
+
<imagedata fileref="figs/docbook_duck.png width="4.8in"/>
|
767
|
+
</imageobject>
|
768
|
+
</mediaobject>
|
769
|
+
</figure></programlisting>
|
770
|
+
|
771
|
+
<note>
|
772
|
+
<para>If you are working on files from an earlier edition of a book,
|
773
|
+
you may see the more complex figure markup that we use in Production
|
774
|
+
(it includes a second <literal>imageobject</literal>, among other
|
775
|
+
things). For any new figures you add, you can stick with the simpler
|
776
|
+
markup shown here.</para>
|
777
|
+
</note>
|
778
|
+
|
779
|
+
<para><xref linkend="docbook_duck_fig" /> shows how the above markup
|
780
|
+
renders.</para>
|
781
|
+
|
782
|
+
<figure id="docbook_duck_fig">
|
783
|
+
<title>The DocBook duck</title>
|
784
|
+
|
785
|
+
<mediaobject>
|
786
|
+
<imageobject role="web">
|
787
|
+
<imagedata fileref="figs/docbook_duck.png" format="PNG"
|
788
|
+
width="4.8in" />
|
789
|
+
</imageobject>
|
790
|
+
</mediaobject>
|
791
|
+
</figure>
|
792
|
+
|
793
|
+
<para>The <literal>width</literal> attribute value in the
|
794
|
+
<literal>imagedata</literal> is a quick way to make large images “fit”
|
795
|
+
within the PDF page while you’re writing your manuscript. (Note that
|
796
|
+
this is strictly optional, and for your own convenience; it’s not
|
797
|
+
necessary for Production.) See <xref linkend="scaling_images"
|
798
|
+
xrefstyle="select:nopage" /> next and <xref linkend="inline_graphics" />
|
799
|
+
for more about image sizing.</para>
|
800
|
+
|
801
|
+
<para>Make sure to add your image files to the SVN repo (typically in
|
802
|
+
the <filename>figs/</filename> directory). Then set the
|
803
|
+
<literal>fileref</literal> and <literal>format</literal> attributes in
|
804
|
+
the XML markup so that they match the image file names and types. For
|
805
|
+
example, if an image is named <filename>battery.png</filename> in the
|
806
|
+
repo, it should be referenced in the XML as
|
807
|
+
<filename>battery.png</filename>, not
|
808
|
+
<filename>Battery.png</filename>.</para>
|
809
|
+
|
810
|
+
<para>The <literal>informalfigure</literal> markup is essentially the
|
811
|
+
same as a <literal>figure</literal>, but without the
|
812
|
+
<literal>id</literal> attribute or <literal>title</literal>
|
813
|
+
element.</para>
|
814
|
+
|
815
|
+
<sect3 id="scaling_images">
|
816
|
+
<title>Scaling images</title>
|
817
|
+
|
818
|
+
<para>When your book goes into Production, O’Reilly’s Illustration
|
819
|
+
staff will handle processing the images you submit, including scaling
|
820
|
+
them to the appropriate size. However, for the purposes of generating
|
821
|
+
draft PDF documents, you can scale your images using the <literal
|
822
|
+
moreinfo="none">width</literal> attribute of the <literal
|
823
|
+
moreinfo="none">imagedata</literal> element, which scales the image
|
824
|
+
proportionally to the width value supplied. For example, to set a
|
825
|
+
width of 4.8 inches (the maximum width for Animal Guide books), you’d
|
826
|
+
add a <literal moreinfo="none">width</literal> attribute value of
|
827
|
+
<literal>4.8in</literal>.</para>
|
828
|
+
|
829
|
+
<para><xref linkend="maximum_widths" /> contains a list of maximum
|
830
|
+
widths you can use to scale images to fit your book’s template.</para>
|
831
|
+
|
832
|
+
<table id="maximum_widths">
|
833
|
+
<title>Maximum widths for figures in different book
|
834
|
+
templates</title>
|
835
|
+
|
836
|
+
<tgroup cols="2">
|
837
|
+
<thead>
|
838
|
+
<row>
|
839
|
+
<entry>Book series</entry>
|
840
|
+
|
841
|
+
<entry>Maximum width value (in inches)</entry>
|
842
|
+
</row>
|
843
|
+
</thead>
|
844
|
+
|
845
|
+
<tbody>
|
846
|
+
<row>
|
847
|
+
<entry>Animal Guide, Cookbook, Theory in Practice</entry>
|
848
|
+
|
849
|
+
<entry><literal>4.8in</literal></entry>
|
850
|
+
</row>
|
851
|
+
|
852
|
+
<row>
|
853
|
+
<entry>Nutshell (and other books with a 6×9 inch trim
|
854
|
+
size)</entry>
|
855
|
+
|
856
|
+
<entry><literal>4.3in</literal></entry>
|
857
|
+
</row>
|
858
|
+
|
859
|
+
<row>
|
860
|
+
<entry>Pocket Reference</entry>
|
861
|
+
|
862
|
+
<entry><literal>2.8in</literal></entry>
|
863
|
+
</row>
|
864
|
+
</tbody>
|
865
|
+
</tgroup>
|
866
|
+
</table>
|
867
|
+
|
868
|
+
<para>For more complete under-the-hood info, see <ulink
|
869
|
+
url="http://www.sagehill.net/docbookxsl/ImageSizing.html">http://www.sagehill.net/docbookxsl/ImageSizing.html</ulink>.
|
870
|
+
(Note that not everything described there will work for O’Reilly’s
|
871
|
+
<phrase role="keep-together">toolchain</phrase>.)</para>
|
872
|
+
</sect3>
|
873
|
+
|
874
|
+
<sect3 id="inline_graphics">
|
875
|
+
<title>Inline graphics</title>
|
876
|
+
|
877
|
+
<para>If you need to add inline graphics (e.g., small icons that are
|
878
|
+
part of the main text) to a file, instead of using
|
879
|
+
<literal>figure</literal> or <literal>informalfigure</literal>, use an
|
880
|
+
<literal>inlinemediaobject</literal> element with the following
|
881
|
+
markup:</para>
|
882
|
+
|
883
|
+
<programlisting><inlinemediaobject>
|
884
|
+
<imageobject>
|
885
|
+
<imagedata fileref="figs/icons_0501.png" width="0.12in"/>
|
886
|
+
</imageobject>
|
887
|
+
</inlinemediaobject></programlisting>
|
888
|
+
|
889
|
+
<para>Although setting the <literal>width</literal> attribute of a
|
890
|
+
<literal>figure</literal> is optional, setting the
|
891
|
+
<literal>width</literal> for a <literal>inlinemediaobject</literal> is
|
892
|
+
required, so that the processor knows how much space to allocate for
|
893
|
+
it. The <literal>width</literal> value of an inline graphic will, of
|
894
|
+
course, be much smaller than that of a figure (e.g.,
|
895
|
+
<literal>width="0.12in"</literal> versus
|
896
|
+
<literal>width="4.8in"</literal>).</para>
|
897
|
+
|
898
|
+
<para>To figure out the width of a graphic (or how much space it may
|
899
|
+
occupy in your PDF), use a web browser, Adobe Acrobat, or any other
|
900
|
+
program that shows you an image or PDF’s dimensions.</para>
|
901
|
+
|
902
|
+
<para>Depending on the surrounding text, you may want to add a space
|
903
|
+
before and after the <literal>inlinemediaobject</literal>. For
|
904
|
+
example, add spaces if it’s between words like “mumble
|
905
|
+
<replaceable>ICON</replaceable> something” but not if it’s punctuated
|
906
|
+
like “mumble (<replaceable>ICON</replaceable>) something.”</para>
|
907
|
+
</sect3>
|
908
|
+
|
909
|
+
<sect3>
|
910
|
+
<title>ASCII art</title>
|
911
|
+
|
912
|
+
<para>ASCII art may be usable, but it does create ambiguities for
|
913
|
+
Tools staff who perform an “intake” on your files when they come into
|
914
|
+
production, as well as the illustrators. Please see detailed
|
915
|
+
guidelines and examples at <ulink
|
916
|
+
url="https://prod.oreilly.com/external/tools/docbook/prod/trunk/samples/ascii_art/">https://prod.oreilly.com/external/tools/docbook/prod/trunk/samples/ascii_art/</ulink>.</para>
|
917
|
+
</sect3>
|
918
|
+
|
919
|
+
<sect3>
|
920
|
+
<title>Accessibility</title>
|
921
|
+
|
922
|
+
<para>O’Reilly is committed to making electronic formats of its books
|
923
|
+
accessible to visually impaired readers. EPUB versions of our titles
|
924
|
+
contain alternative text descriptions for images (in the
|
925
|
+
<literal>alt</literal> attribute of <literal>img</literal> elements)
|
926
|
+
whenever possible.</para>
|
927
|
+
|
928
|
+
<para>By default, for formal <literal>figure</literal> elements, we
|
929
|
+
use the contents of the <literal>title</literal> element as the
|
930
|
+
<literal>alt</literal> text. However, you can supply your own custom
|
931
|
+
alt text for a <literal>figure</literal> by adding a
|
932
|
+
<literal>textobject</literal> element as a child of the figure’s
|
933
|
+
<literal>mediaobject</literal>, and enclosing the
|
934
|
+
<literal>alt</literal> text in a <literal>phrase</literal> element.
|
935
|
+
Here’s an example of the markup to use (<xref
|
936
|
+
linkend="figure_with_custom_alt_text" /> shows how it renders):</para>
|
937
|
+
|
938
|
+
<programlisting><figure id="figure_with_custom_alt_text">
|
939
|
+
<title>Figure image with custom alt text</title>
|
940
|
+
|
941
|
+
<mediaobject>
|
942
|
+
<imageobject>
|
943
|
+
<imagedata fileref="figs/universal_design_for_web_applications_cover.png"
|
944
|
+
width="2.4in"/>
|
945
|
+
</imageobject>
|
946
|
+
|
947
|
+
<textobject>
|
948
|
+
<phrase>Universal Design for Web Applications Cover</phrase>
|
949
|
+
</textobject>
|
950
|
+
</mediaobject>
|
951
|
+
</figure></programlisting>
|
952
|
+
|
953
|
+
<figure id="figure_with_custom_alt_text">
|
954
|
+
<title>Figure image with custom alt text</title>
|
955
|
+
|
956
|
+
<mediaobject>
|
957
|
+
<imageobject>
|
958
|
+
<imagedata fileref="figs/universal_design_for_web_applications_cover.png"
|
959
|
+
width="2.4in" />
|
960
|
+
</imageobject>
|
961
|
+
|
962
|
+
<textobject>
|
963
|
+
<phrase>Universal Design for Web Applications Cover</phrase>
|
964
|
+
</textobject>
|
965
|
+
</mediaobject>
|
966
|
+
</figure>
|
967
|
+
|
968
|
+
<para>For images you include in your book that do not have
|
969
|
+
<literal>title</literal> elements (e.g.,
|
970
|
+
<literal>informalfigure</literal>s and
|
971
|
+
<literal>inlinemediaobject</literal>s), we highly encourage you to
|
972
|
+
supply your own custom <literal>alt</literal> text in
|
973
|
+
<literal>textobject</literal>s (By default, we use the text “image
|
974
|
+
with no caption” as the <literal>alt</literal> text for
|
975
|
+
<literal>informalfigure</literal>s and leave <literal>alt</literal>
|
976
|
+
attributes empty for <literal>inlinemediaobject</literal>s). <xref
|
977
|
+
linkend="informalfigure_with_textobject" /> and <xref
|
978
|
+
linkend="inlinemediaobject_with_textobject" /> show examples of the
|
979
|
+
markup for an <literal>informalfigure</literal> and
|
980
|
+
<literal>inlinemediaobject</literal> with custom
|
981
|
+
<literal>alt</literal> text.</para>
|
982
|
+
|
983
|
+
<example id="informalfigure_with_textobject">
|
984
|
+
<title>informalfigure with textobject</title>
|
985
|
+
|
986
|
+
<programlisting><informalfigure id="informalfigure_with_custom_alt_text">
|
987
|
+
<mediaobject>
|
988
|
+
<imageobject>
|
989
|
+
<imagedata fileref="figs/universal_design_for_web_applications_cover.png"
|
990
|
+
width="2.4in"/>
|
991
|
+
</imageobject>
|
992
|
+
|
993
|
+
<textobject>
|
994
|
+
<phrase>Universal Design for Web Applications Cover</phrase>
|
995
|
+
</textobject>
|
996
|
+
</mediaobject>
|
997
|
+
</informalfigure></programlisting>
|
998
|
+
</example>
|
999
|
+
|
1000
|
+
<example id="inlinemediaobject_with_textobject">
|
1001
|
+
<title>inlinemediaobject with textobject</title>
|
1002
|
+
|
1003
|
+
<programlisting><inlinemediaobject>
|
1004
|
+
<imageobject>
|
1005
|
+
<imagedata fileref="figs/oreilly_logo.png" width="0.12in"/>
|
1006
|
+
</imageobject>
|
1007
|
+
<textobject>
|
1008
|
+
<phrase>O’Reilly Media, Inc. logo</phrase>
|
1009
|
+
</textobject>
|
1010
|
+
</inlinemediaobject></programlisting>
|
1011
|
+
</example>
|
1012
|
+
|
1013
|
+
<tip>
|
1014
|
+
<para>For some tips on writing good <literal>alt</literal> text,
|
1015
|
+
O’Reilly’s <ulink
|
1016
|
+
url="http://oreilly.com/catalog/9780596518745/"><emphasis>Universal
|
1017
|
+
Design for Web Applications</emphasis></ulink> is a great resource.
|
1018
|
+
In particular, see the section, “Keys to Writing Good Text
|
1019
|
+
Alternatives,” which <ulink
|
1020
|
+
url="http://my.safaribooksonline.com/9780596155681/keys_to_writing_good_text_alternatives">is
|
1021
|
+
available on Safari</ulink>. We’d also be happy to supply you with a
|
1022
|
+
PDF or EPUB of the book on request.</para>
|
1023
|
+
</tip>
|
1024
|
+
</sect3>
|
1025
|
+
</sect2>
|
1026
|
+
|
1027
|
+
<sect2>
|
1028
|
+
<title>Tables</title>
|
1029
|
+
|
1030
|
+
<para>There are two main types of tables: formal and informal. If your
|
1031
|
+
table requires a description, you expect to refer to it later elsewhere
|
1032
|
+
in the text, or it’s especially complex, you probably want to use a
|
1033
|
+
<literal>table</literal> element. Otherwise, consider an
|
1034
|
+
<literal>informaltable</literal> <phrase
|
1035
|
+
role="keep-together">element</phrase>.</para>
|
1036
|
+
|
1037
|
+
<sect3>
|
1038
|
+
<title>Formal tables</title>
|
1039
|
+
|
1040
|
+
<para>Here’s the markup for a formal <literal>table</literal> with a
|
1041
|
+
heading row:</para>
|
1042
|
+
|
1043
|
+
<programlisting><table id="example_table">
|
1044
|
+
<title>Example formal table</title>
|
1045
|
+
<tgroup>
|
1046
|
+
<thead>
|
1047
|
+
<row>
|
1048
|
+
<entry>Heading1</entry>
|
1049
|
+
<entry>Heading2</entry>
|
1050
|
+
</row>
|
1051
|
+
</thead>
|
1052
|
+
<tbody>
|
1053
|
+
<row>
|
1054
|
+
<entry>Text1</entry>
|
1055
|
+
<entry>Text2</entry>
|
1056
|
+
</row>
|
1057
|
+
<row>
|
1058
|
+
<entry>Text3</entry>
|
1059
|
+
<entry>Text4</entry>
|
1060
|
+
</row>
|
1061
|
+
</tbody>
|
1062
|
+
</tgroup>
|
1063
|
+
</table></programlisting>
|
1064
|
+
|
1065
|
+
<para><xref linkend="example_table" /> shows how it renders.</para>
|
1066
|
+
|
1067
|
+
<table id="example_table">
|
1068
|
+
<title>Example formal table</title>
|
1069
|
+
|
1070
|
+
<tgroup cols="2">
|
1071
|
+
<thead>
|
1072
|
+
<row>
|
1073
|
+
<entry>Heading1</entry>
|
1074
|
+
|
1075
|
+
<entry>Heading2</entry>
|
1076
|
+
</row>
|
1077
|
+
</thead>
|
1078
|
+
|
1079
|
+
<tbody>
|
1080
|
+
<row>
|
1081
|
+
<entry>Text1</entry>
|
1082
|
+
|
1083
|
+
<entry>Text2</entry>
|
1084
|
+
</row>
|
1085
|
+
|
1086
|
+
<row>
|
1087
|
+
<entry>Text3</entry>
|
1088
|
+
|
1089
|
+
<entry>Text4</entry>
|
1090
|
+
</row>
|
1091
|
+
</tbody>
|
1092
|
+
</tgroup>
|
1093
|
+
</table>
|
1094
|
+
|
1095
|
+
<para>The table’s title is different from its heading row
|
1096
|
+
(<literal>thead</literal>). The title describes the entire table,
|
1097
|
+
while the heading row contains information about each column. A formal
|
1098
|
+
table does not always need to have to have a heading row.</para>
|
1099
|
+
|
1100
|
+
<para>Tables can get <emphasis>much</emphasis> more complex than this
|
1101
|
+
example. See <ulink
|
1102
|
+
url="http://www.docbook.org/tdg/en/html/table.html">http://www.docbook.org/tdg/en/html/table.html</ulink>
|
1103
|
+
for details, though note that not everything discussed there will work
|
1104
|
+
with our toolchain or conform to O’Reilly’s house style (check with
|
1105
|
+
your editor about the latter).</para>
|
1106
|
+
</sect3>
|
1107
|
+
|
1108
|
+
<sect3>
|
1109
|
+
<title>Informal tables</title>
|
1110
|
+
|
1111
|
+
<para>The markup of an <literal>informaltable</literal> is similar to
|
1112
|
+
that of a <literal>table</literal>, but it does not have a
|
1113
|
+
<literal>title</literal> or (in most cases) <literal>id</literal>.
|
1114
|
+
Here’s an example.</para>
|
1115
|
+
|
1116
|
+
<informaltable frame="none">
|
1117
|
+
<tgroup cols="2">
|
1118
|
+
<tbody>
|
1119
|
+
<row>
|
1120
|
+
<entry>Text1</entry>
|
1121
|
+
|
1122
|
+
<entry>Text2</entry>
|
1123
|
+
</row>
|
1124
|
+
|
1125
|
+
<row>
|
1126
|
+
<entry>Text3</entry>
|
1127
|
+
|
1128
|
+
<entry>Text4</entry>
|
1129
|
+
</row>
|
1130
|
+
</tbody>
|
1131
|
+
</tgroup>
|
1132
|
+
</informaltable>
|
1133
|
+
|
1134
|
+
<para>This particular informal table doesn’t have a heading (no
|
1135
|
+
<literal>thead</literal>), but it would be valid to add one. Also, the
|
1136
|
+
bottom rule has been suppressed with the use of a
|
1137
|
+
<literal>frame="none"</literal> attribute; see the next section for
|
1138
|
+
details on table borders.</para>
|
1139
|
+
|
1140
|
+
<note>
|
1141
|
+
<para>Please check with your editor about O’Reilly house style
|
1142
|
+
before overriding table defaults, as table markup can be quite
|
1143
|
+
labor-intensive for you or Production staff to change back later
|
1144
|
+
on.</para>
|
1145
|
+
</note>
|
1146
|
+
</sect3>
|
1147
|
+
|
1148
|
+
<sect3>
|
1149
|
+
<title>Table frames and border lines</title>
|
1150
|
+
|
1151
|
+
<para>You can adjust the appearance of the gridlines and borders in
|
1152
|
+
<literal>table</literal>s and <literal>informaltable</literal>s. By
|
1153
|
+
default, in most series a table will render with a gray bottom border.
|
1154
|
+
If you set the <literal>frame</literal> attribute to
|
1155
|
+
<literal>all</literal>, all sides will be black. If you set the
|
1156
|
+
<literal>frame</literal> to <literal>none</literal>, the bottom rule
|
1157
|
+
will be suppressed.</para>
|
1158
|
+
|
1159
|
+
<para>You can control the interior cell borders by using the
|
1160
|
+
<literal>colsep</literal> and <literal>rowsep</literal> attributes on
|
1161
|
+
various elements in the table. Use them to toggle on or off borders,
|
1162
|
+
either to the right of (in the case of <literal>colsep</literal>) or
|
1163
|
+
below (in the case of <literal>rowsep</literal>) the cells in the
|
1164
|
+
element’s scope. For both attributes, a value of <literal>1</literal>
|
1165
|
+
draws the rule, and a value of <literal>0</literal> suppresses it.
|
1166
|
+
These don’t affect the outer table frame, which is controlled by the
|
1167
|
+
<literal>frame</literal> attribute.</para>
|
1168
|
+
</sect3>
|
1169
|
+
</sect2>
|
1170
|
+
|
1171
|
+
<sect2>
|
1172
|
+
<title>Lists</title>
|
1173
|
+
|
1174
|
+
<para>There are four common types of lists. The <ulink
|
1175
|
+
url="http://oreilly.com/oreilly/author/stylesheet.html#lists">O’Reilly
|
1176
|
+
Stylesheet and Word List</ulink> has more details about when to use
|
1177
|
+
them, but here’s the markup and an example of each.</para>
|
1178
|
+
|
1179
|
+
<sect3>
|
1180
|
+
<title>Simple list</title>
|
1181
|
+
|
1182
|
+
<para>Markup:</para>
|
1183
|
+
|
1184
|
+
<programlisting><simplelist>
|
1185
|
+
<member>This is a list of several short items.</member>
|
1186
|
+
<member>Usually one or a few words each.</member>
|
1187
|
+
</simplelist></programlisting>
|
1188
|
+
|
1189
|
+
<para>Rendering:</para>
|
1190
|
+
|
1191
|
+
<simplelist>
|
1192
|
+
<member>This is a list of several short items.</member>
|
1193
|
+
|
1194
|
+
<member>Usually one or a few words each.</member>
|
1195
|
+
</simplelist>
|
1196
|
+
</sect3>
|
1197
|
+
|
1198
|
+
<sect3>
|
1199
|
+
<title>Itemized list</title>
|
1200
|
+
|
1201
|
+
<para>Markup:</para>
|
1202
|
+
|
1203
|
+
<programlisting><itemizedlist>
|
1204
|
+
<listitem><para>This is a list.</para></listitem>
|
1205
|
+
<listitem><para>With bullets.</para></listitem>
|
1206
|
+
<itemizedlist></programlisting>
|
1207
|
+
|
1208
|
+
<para>Rendering:</para>
|
1209
|
+
|
1210
|
+
<itemizedlist>
|
1211
|
+
<listitem>
|
1212
|
+
<para>This is a list.</para>
|
1213
|
+
</listitem>
|
1214
|
+
|
1215
|
+
<listitem>
|
1216
|
+
<para>With bullets.</para>
|
1217
|
+
</listitem>
|
1218
|
+
</itemizedlist>
|
1219
|
+
|
1220
|
+
<para>In the case of an <literal>itemizedlist</literal> nested in an
|
1221
|
+
<literal>itemizedlist</literal>, the child list will use em dashes in
|
1222
|
+
place of bullets. If you want to use symbols other than em dashes or
|
1223
|
+
bullets, you can set the symbol for an entire
|
1224
|
+
<literal>itemizedlist</literal> by using the <literal>mark</literal>
|
1225
|
+
attribute, or for a single <literal>listitem</literal> by using the
|
1226
|
+
<literal>override</literal> attribute. For instance,
|
1227
|
+
<literal><itemizedlist mark="disc"></literal> causes an entire
|
1228
|
+
list to render with standard bullets.</para>
|
1229
|
+
|
1230
|
+
<note>
|
1231
|
+
<para>Again, check with your editor about O’Reilly house style
|
1232
|
+
before changing the defaults.</para>
|
1233
|
+
</note>
|
1234
|
+
|
1235
|
+
<para>Here’s a list of the options:</para>
|
1236
|
+
|
1237
|
+
<informaltable>
|
1238
|
+
<tgroup cols="2">
|
1239
|
+
<thead>
|
1240
|
+
<row>
|
1241
|
+
<entry>Attribute value</entry>
|
1242
|
+
|
1243
|
+
<entry>Symbol</entry>
|
1244
|
+
</row>
|
1245
|
+
</thead>
|
1246
|
+
|
1247
|
+
<tbody>
|
1248
|
+
<row>
|
1249
|
+
<entry><literal>none</literal></entry>
|
1250
|
+
|
1251
|
+
<entry></entry>
|
1252
|
+
</row>
|
1253
|
+
|
1254
|
+
<row>
|
1255
|
+
<entry><literal>disc</literal> (or
|
1256
|
+
<literal>bullet</literal>)</entry>
|
1257
|
+
|
1258
|
+
<entry><para>•</para></entry>
|
1259
|
+
</row>
|
1260
|
+
|
1261
|
+
<row>
|
1262
|
+
<entry><literal>endash</literal></entry>
|
1263
|
+
|
1264
|
+
<entry><para>–</para></entry>
|
1265
|
+
</row>
|
1266
|
+
|
1267
|
+
<row>
|
1268
|
+
<entry><literal>emdash</literal></entry>
|
1269
|
+
|
1270
|
+
<entry><para>—</para></entry>
|
1271
|
+
</row>
|
1272
|
+
|
1273
|
+
<row>
|
1274
|
+
<entry><literal>square</literal> (or
|
1275
|
+
<literal>box</literal>)</entry>
|
1276
|
+
|
1277
|
+
<entry><para>■</para></entry>
|
1278
|
+
</row>
|
1279
|
+
|
1280
|
+
<row>
|
1281
|
+
<entry><literal>smallblacksquare</literal></entry>
|
1282
|
+
|
1283
|
+
<entry><para>▪</para></entry>
|
1284
|
+
</row>
|
1285
|
+
|
1286
|
+
<row>
|
1287
|
+
<entry><literal>circle</literal> (or
|
1288
|
+
<literal>opencircle</literal>)</entry>
|
1289
|
+
|
1290
|
+
<entry><para>○</para></entry>
|
1291
|
+
</row>
|
1292
|
+
|
1293
|
+
<row>
|
1294
|
+
<entry><literal>whitesquare</literal></entry>
|
1295
|
+
|
1296
|
+
<entry><para>□</para></entry>
|
1297
|
+
</row>
|
1298
|
+
|
1299
|
+
<row>
|
1300
|
+
<entry><literal>smallwhitesquare</literal></entry>
|
1301
|
+
|
1302
|
+
<entry><para>▫</para></entry>
|
1303
|
+
</row>
|
1304
|
+
|
1305
|
+
<row>
|
1306
|
+
<entry><literal>round</literal> (or
|
1307
|
+
<literal>blackcircle</literal>)</entry>
|
1308
|
+
|
1309
|
+
<entry><para>●</para></entry>
|
1310
|
+
</row>
|
1311
|
+
</tbody>
|
1312
|
+
</tgroup>
|
1313
|
+
</informaltable>
|
1314
|
+
</sect3>
|
1315
|
+
|
1316
|
+
<sect3>
|
1317
|
+
<title>Ordered list</title>
|
1318
|
+
|
1319
|
+
<para>Markup:</para>
|
1320
|
+
|
1321
|
+
<programlisting><orderedlist>
|
1322
|
+
<listitem><para>This list uses numbers.</para></listitem>
|
1323
|
+
<listitem><para>Instead of bullets.</para></listitem>
|
1324
|
+
<orderedlist></programlisting>
|
1325
|
+
|
1326
|
+
<para>Rendering:</para>
|
1327
|
+
|
1328
|
+
<orderedlist>
|
1329
|
+
<listitem>
|
1330
|
+
<para>This list uses numbers.</para>
|
1331
|
+
</listitem>
|
1332
|
+
|
1333
|
+
<listitem>
|
1334
|
+
<para>Instead of bullets.</para>
|
1335
|
+
</listitem>
|
1336
|
+
</orderedlist>
|
1337
|
+
|
1338
|
+
<para>To continue the numbering of an <literal>orderedlist</literal>
|
1339
|
+
from a previous list, use a <literal
|
1340
|
+
role="keep-together">continuation</literal> attribute with a value of
|
1341
|
+
<literal>continues</literal>:</para>
|
1342
|
+
|
1343
|
+
<programlisting><orderedlist continuation="continues"></programlisting>
|
1344
|
+
|
1345
|
+
<?dbfo-need height=”1in”
|
1346
|
+
?>
|
1347
|
+
|
1348
|
+
<para>If an <literal>orderedlist</literal> has other lists nested
|
1349
|
+
within it, this may cause <literal><orderedlist
|
1350
|
+
continuation="continues"></literal> to start on the wrong number.
|
1351
|
+
In these cases, add an <literal>override</literal> attribute value of
|
1352
|
+
the number you’d like the <literal>listitem</literal> to start at on
|
1353
|
+
the misnumbered <literal>listitem</literal>. Your continued
|
1354
|
+
<literal>orderedlist</literal> should then begin on the correct
|
1355
|
+
number.</para>
|
1356
|
+
|
1357
|
+
<para>The default (<literal>continuation="restarts"</literal>) causes
|
1358
|
+
the numbering to begin at 1.</para>
|
1359
|
+
</sect3>
|
1360
|
+
|
1361
|
+
<sect3>
|
1362
|
+
<title>Variable list</title>
|
1363
|
+
|
1364
|
+
<para>A variable list is usually made up of pairs of items.</para>
|
1365
|
+
|
1366
|
+
<para>Markup:</para>
|
1367
|
+
|
1368
|
+
<programlisting><variablelist>
|
1369
|
+
<varlistentry>
|
1370
|
+
<term>The first part could be a term</term>
|
1371
|
+
<listitem><para>Followed by a definition.</para></listitem>
|
1372
|
+
</varlistentry>
|
1373
|
+
<varlistentry>
|
1374
|
+
<term>Or a name</term>
|
1375
|
+
<listitem><para>Followed by a description. Etc.</para></listitem>
|
1376
|
+
</varlistentry>
|
1377
|
+
</variablelist></programlisting>
|
1378
|
+
|
1379
|
+
<para>Rendering:</para>
|
1380
|
+
|
1381
|
+
<variablelist>
|
1382
|
+
<varlistentry>
|
1383
|
+
<term>The first part could be a term</term>
|
1384
|
+
|
1385
|
+
<listitem>
|
1386
|
+
<para>Followed by a definition.</para>
|
1387
|
+
</listitem>
|
1388
|
+
</varlistentry>
|
1389
|
+
|
1390
|
+
<varlistentry>
|
1391
|
+
<term>Or a name</term>
|
1392
|
+
|
1393
|
+
<listitem>
|
1394
|
+
<para>Followed by a description. Etc.</para>
|
1395
|
+
</listitem>
|
1396
|
+
</varlistentry>
|
1397
|
+
</variablelist>
|
1398
|
+
|
1399
|
+
<para>By default, the variable list <literal>term</literal> will
|
1400
|
+
render in italics. To remove the italics, add a
|
1401
|
+
<literal>role</literal> attribute of <literal>plain</literal>:</para>
|
1402
|
+
|
1403
|
+
<programlisting><term role="plain">Variable list term</term></programlisting>
|
1404
|
+
</sect3>
|
1405
|
+
</sect2>
|
1406
|
+
|
1407
|
+
<sect2>
|
1408
|
+
<title>Notes, Warnings, and Sidebars</title>
|
1409
|
+
|
1410
|
+
<para>You have the option of these three different block elements for
|
1411
|
+
supplemental information. Their use is fairly straightforward.</para>
|
1412
|
+
|
1413
|
+
<note>
|
1414
|
+
<para>Use <literal>note</literal> instead of
|
1415
|
+
<literal>tip</literal>.</para>
|
1416
|
+
</note>
|
1417
|
+
|
1418
|
+
<warning>
|
1419
|
+
<para>Use <literal>warning</literal> instead of
|
1420
|
+
<literal>caution</literal>.</para>
|
1421
|
+
</warning>
|
1422
|
+
|
1423
|
+
<para>Notes and warnings can contain <literal>para</literal>s,
|
1424
|
+
<literal>programlisting</literal>s, and lists. They should
|
1425
|
+
<emphasis>not</emphasis> contain figures, tables, or examples.</para>
|
1426
|
+
|
1427
|
+
<sidebar>
|
1428
|
+
<title>When to Use a Sidebar?</title>
|
1429
|
+
|
1430
|
+
<para>If a note or a warning covers a lot of information or includes
|
1431
|
+
complex elements, consider changing it to a sidebar. A sidebar can be
|
1432
|
+
much longer—even spanning several <phrase
|
1433
|
+
role="keep-together">pages—</phrase>and must have a title. It can
|
1434
|
+
contain tables and examples, but per house style it should not contain
|
1435
|
+
figures.</para>
|
1436
|
+
</sidebar>
|
1437
|
+
|
1438
|
+
<note>
|
1439
|
+
<para>The elements described in this section render differently
|
1440
|
+
according to the series stylesheet. For example, in Animal Guide
|
1441
|
+
books, a <literal>note</literal> generates a paw print icon and a
|
1442
|
+
<literal>warning</literal> generates a bear trap icon; in Theory In
|
1443
|
+
Practice books, these elements generate the text “NOTE” or “WARNING”.
|
1444
|
+
In Animal Guide books, sidebars appear in a box; in Theory In Practice
|
1445
|
+
books, sidebars have a top and bottom rule but no side rules.</para>
|
1446
|
+
</note>
|
1447
|
+
</sect2>
|
1448
|
+
|
1449
|
+
<sect2 id="inserting_hyperlinks">
|
1450
|
+
<title>Hyperlinks</title>
|
1451
|
+
|
1452
|
+
<para>The element for URLs is <literal>ulink</literal>. Here are the
|
1453
|
+
traditional markup options:</para>
|
1454
|
+
|
1455
|
+
<variablelist>
|
1456
|
+
<varlistentry>
|
1457
|
+
<term>No CDATA</term>
|
1458
|
+
|
1459
|
+
<listitem>
|
1460
|
+
<programlisting><ulink url="http://www.oreilly.com"/></programlisting>
|
1461
|
+
|
1462
|
+
<para>Looks like: <ulink
|
1463
|
+
url="http://www.oreilly.com"></ulink></para>
|
1464
|
+
</listitem>
|
1465
|
+
</varlistentry>
|
1466
|
+
|
1467
|
+
<varlistentry>
|
1468
|
+
<term>With CDATA different from <literal>url</literal></term>
|
1469
|
+
|
1470
|
+
<listitem>
|
1471
|
+
<programlisting><ulink url="http://www.oreilly.com">O'Reilly</ulink></programlisting>
|
1472
|
+
|
1473
|
+
<para>Looks like: <ulink
|
1474
|
+
url="http://www.oreilly.com">O’Reilly</ulink></para>
|
1475
|
+
</listitem>
|
1476
|
+
</varlistentry>
|
1477
|
+
</variablelist>
|
1478
|
+
|
1479
|
+
<para><literal>ulink</literal>s render differently in the print and web
|
1480
|
+
PDFs (see <xref linkend="web_pdfs" />). Suppose you have markup like the
|
1481
|
+
following:</para>
|
1482
|
+
|
1483
|
+
<programlisting><para><ulink url="http://www.macports.org">MacPorts</ulink> is a great tool for
|
1484
|
+
installing open source software on OS X.</para></programlisting>
|
1485
|
+
|
1486
|
+
<para>In the print book, the URL will render in parentheses following
|
1487
|
+
the text “MacPorts”, like so:</para>
|
1488
|
+
|
1489
|
+
<informalfigure>
|
1490
|
+
<mediaobject>
|
1491
|
+
<imageobject role="web">
|
1492
|
+
<imagedata fileref="figs/hyperlink_print.png" format="PNG"
|
1493
|
+
scale="55" />
|
1494
|
+
</imageobject>
|
1495
|
+
</mediaobject>
|
1496
|
+
</informalfigure>
|
1497
|
+
|
1498
|
+
<para>In the web PDF (i.e., the online PDF we sell on <ulink
|
1499
|
+
role="orm:hideurl" url="http://www.oreilly.com">oreilly.com</ulink>),
|
1500
|
+
the hyperlink will be clickable and display in blue, like so:</para>
|
1501
|
+
|
1502
|
+
<informalfigure>
|
1503
|
+
<mediaobject>
|
1504
|
+
<imageobject role="web">
|
1505
|
+
<imagedata fileref="figs/hyperlink_web.png" format="PNG"
|
1506
|
+
scale="55" />
|
1507
|
+
</imageobject>
|
1508
|
+
</mediaobject>
|
1509
|
+
</informalfigure>
|
1510
|
+
|
1511
|
+
<para>When you create <literal>ulink</literal>s, make sure the
|
1512
|
+
<literal>url</literal> attribute contains a full URL, including the
|
1513
|
+
protocol—e.g., <emphasis>http://www.macports.org</emphasis> instead of
|
1514
|
+
<emphasis>www.macports.org</emphasis>. This is important because the URL
|
1515
|
+
is not actually valid without the protocol: while many browsers are
|
1516
|
+
smart enough to silently add it for you, readers trying to follow a link
|
1517
|
+
to it downstream may get an error.</para>
|
1518
|
+
|
1519
|
+
<note>
|
1520
|
+
<para>Don’t use <literal><ulink></literal> markup for fake or
|
1521
|
+
example URLs, as the hyperlinks may confuse readers (and
|
1522
|
+
link-harvesting tools that may be used on your content downstream).
|
1523
|
+
Instead, use <literal><emphasis></literal> or
|
1524
|
+
<literal><uri></literal> as semantically appropriate.</para>
|
1525
|
+
</note>
|
1526
|
+
|
1527
|
+
<sect3>
|
1528
|
+
<title>Additional ulink rendering</title>
|
1529
|
+
|
1530
|
+
<para>Recent updates to the O’Reilly stylesheets allow you to mark up
|
1531
|
+
<literal>ulink</literal>s so that they render in several additional
|
1532
|
+
ways for web and print PDFs. To see what these options look like and
|
1533
|
+
get markup examples, see the samples <ulink
|
1534
|
+
url="https://prod.oreilly.com/external/tools/docbook/prod/trunk/samples/urls/">here</ulink>.
|
1535
|
+
The default rendering is demonstrated in
|
1536
|
+
<filename>web_default.pdf</filename> and
|
1537
|
+
<filename>print_default.pdf</filename>.</para>
|
1538
|
+
|
1539
|
+
<para>Two other rendering options—the option to hide URLs globally or
|
1540
|
+
to have them appear in footnotes—are shown in
|
1541
|
+
<filename>print_globalhide.pdf</filename> and
|
1542
|
+
<filename>print_usefootnotes.pdf</filename>. To make use of these,
|
1543
|
+
send a request to <email>toolsreq@oreilly.com</email> and we’ll set up
|
1544
|
+
the stylesheet parameter for you. Note that if we do that, all URLs
|
1545
|
+
throughout the book will be <phrase
|
1546
|
+
role="keep-together">affected</phrase>; we can’t set up URL footnote
|
1547
|
+
rendering for a single chapter or section.</para>
|
1548
|
+
</sect3>
|
1549
|
+
</sect2>
|
1550
|
+
|
1551
|
+
<sect2>
|
1552
|
+
<title>Footnotes</title>
|
1553
|
+
|
1554
|
+
<para>A <literal>footnote</literal> generates a superscript symbol
|
1555
|
+
wherever it is placed in the text, and the body of the footnote appears
|
1556
|
+
at the bottom of the page. The symbols are generated in a five-symbol
|
1557
|
+
cycle, starting over at the beginning of each chapter. So the first
|
1558
|
+
symbol in a chapter is always an asterisk,<footnote>
|
1559
|
+
<para>Asterisk</para>
|
1560
|
+
</footnote> and the rest occur like so: dagger,<footnote>
|
1561
|
+
<para>Dagger</para>
|
1562
|
+
</footnote> double dagger,<footnote>
|
1563
|
+
<para>Double dagger</para>
|
1564
|
+
</footnote> section sign,<footnote>
|
1565
|
+
<para>Section sign</para>
|
1566
|
+
</footnote> vertical lines,<footnote>
|
1567
|
+
<para>Vertical lines</para>
|
1568
|
+
</footnote> pound sign.<footnote>
|
1569
|
+
<para>Pound sign</para>
|
1570
|
+
</footnote></para>
|
1571
|
+
|
1572
|
+
<para>Table footnotes are lettered (a, b, c, etc.) and appear directly
|
1573
|
+
after the table (not at the bottom of the page). For example:</para>
|
1574
|
+
|
1575
|
+
<informaltable frame="none">
|
1576
|
+
<tgroup cols="2">
|
1577
|
+
<tbody>
|
1578
|
+
<row>
|
1579
|
+
<entry>Here is some text.<footnote>
|
1580
|
+
<para>Here’s a table footnote.</para>
|
1581
|
+
</footnote></entry>
|
1582
|
+
|
1583
|
+
<entry>A bit more text.</entry>
|
1584
|
+
</row>
|
1585
|
+
|
1586
|
+
<row>
|
1587
|
+
<entry>This is text.</entry>
|
1588
|
+
|
1589
|
+
<entry>You get the idea.<footnote>
|
1590
|
+
<para>Here’s another.</para>
|
1591
|
+
</footnote></entry>
|
1592
|
+
</row>
|
1593
|
+
</tbody>
|
1594
|
+
</tgroup>
|
1595
|
+
</informaltable>
|
1596
|
+
|
1597
|
+
<para>Footnotes should generally be inserted <emphasis>after</emphasis>
|
1598
|
+
punctuation, whether a period, comma, or colon. See the <ulink
|
1599
|
+
url="http://oreilly.com/oreilly/author/stylesheet.html#footnotes">O’Reilly
|
1600
|
+
Stylesheet and Word List</ulink> for guidelines.</para>
|
1601
|
+
|
1602
|
+
<para>We may be able to support the use of numbered footnotes via a
|
1603
|
+
stylesheet customization; please check with your editor if this is
|
1604
|
+
appropriate for your book.</para>
|
1605
|
+
</sect2>
|
1606
|
+
|
1607
|
+
<sect2>
|
1608
|
+
<title>Index Tags</title>
|
1609
|
+
|
1610
|
+
<para>O’Reilly provides professional indexing as a normal part of book
|
1611
|
+
production, but if for some reason you’d like to add index markers in
|
1612
|
+
your book, this section covers the proper markup. See O’Reilly’s <ulink
|
1613
|
+
url="https://prod.oreilly.com/external/tools/docbook/docs/authoring/other_info/docbook_indexing_guidelines.txt">DocBook
|
1614
|
+
Indexing Guidelines</ulink> for complete details.</para>
|
1615
|
+
|
1616
|
+
<para>To see the index in your PDF, add a line that says
|
1617
|
+
<literal><index/></literal> to your <filename>book.xml</filename>
|
1618
|
+
file before the closing <literal></book></literal> tag, like
|
1619
|
+
so:</para>
|
1620
|
+
|
1621
|
+
<programlisting><?xml version="1.0"?>
|
1622
|
+
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
1623
|
+
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
1624
|
+
<book>
|
1625
|
+
<title>Wikipedia: The Missing Manual</title>
|
1626
|
+
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bookinfo.xml"/>
|
1627
|
+
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ch00.xml"/>
|
1628
|
+
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ch01.xml"/>
|
1629
|
+
<!-- The rest of the chapter files are listed here -->
|
1630
|
+
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ch21.xml"/>
|
1631
|
+
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="appa.xml"/>
|
1632
|
+
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="appb.xml"/>
|
1633
|
+
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="appc.xml"/>
|
1634
|
+
<index/>
|
1635
|
+
</book></programlisting>
|
1636
|
+
|
1637
|
+
<para>It’s also useful if you add a <literal><remark></literal> in
|
1638
|
+
<filename>book.xml</filename> (see <xref linkend="adding_comments" />)
|
1639
|
+
explaining to Production whether you’re adding a few terms that you’d
|
1640
|
+
like the indexer to incorporate, or whether this should be used as the
|
1641
|
+
book’s complete index. Discuss these options with your editor
|
1642
|
+
first.</para>
|
1643
|
+
|
1644
|
+
<para>Here’s the basic index entry markup:</para>
|
1645
|
+
|
1646
|
+
<programlisting><indexterm><primary>index entry syntax, level 1</primary></indexterm></programlisting>
|
1647
|
+
|
1648
|
+
<para>Secondary entry (subentry) markup:</para>
|
1649
|
+
|
1650
|
+
<programlisting><indexterm>
|
1651
|
+
<primary>index entry syntax</primary>
|
1652
|
+
<secondary>for a subentry</secondary>
|
1653
|
+
</indexterm></programlisting>
|
1654
|
+
|
1655
|
+
<para>Tertiary entry (sub-subentry) markup:</para>
|
1656
|
+
|
1657
|
+
<programlisting><indexterm>
|
1658
|
+
<primary>index entry syntax</primary>
|
1659
|
+
<secondary>for a subentry</secondary>
|
1660
|
+
<tertiary>with a subentry</tertiary>
|
1661
|
+
</indexterm></programlisting>
|
1662
|
+
|
1663
|
+
<para>Index entry with a range markup:</para>
|
1664
|
+
|
1665
|
+
<programlisting>This book is full of geeky text with DocBook XML markup, which starts here:
|
1666
|
+
<indexterm class="startofrange" id="geekytext">
|
1667
|
+
<primary>geeky DocBook XML text</primary></indexterm>blah blah blah Ajax
|
1668
|
+
blah blah blah Ruby on Rails
|
1669
|
+
...
|
1670
|
+
and ends here<indexterm class="endofrange" startref="geekytext">.</programlisting>
|
1671
|
+
|
1672
|
+
<note>
|
1673
|
+
<para>The ending <literal>indexterm</literal> tag does not contain a
|
1674
|
+
<literal>primary</literal> or <literal>secondary</literal> entry, just
|
1675
|
+
a <literal>startref</literal> attribute that references the starting
|
1676
|
+
<literal>indexterm</literal> entry. Do not place the ending tag on its
|
1677
|
+
own line or the FO processor will add a blank line to the PDF.</para>
|
1678
|
+
</note>
|
1679
|
+
</sect2>
|
1680
|
+
</sect1>
|
1681
|
+
|
1682
|
+
<sect1>
|
1683
|
+
<title>Expressing Code in DocBook</title>
|
1684
|
+
|
1685
|
+
<para>In general, code blocks should be enclosed inside <literal
|
1686
|
+
moreinfo="none">programlisting</literal> elements, which may in turn be
|
1687
|
+
inside of <literal moreinfo="none">example</literal> elements (see the
|
1688
|
+
next section for more info). <literal
|
1689
|
+
moreinfo="none">programlisting</literal>s are verbatim environments, which
|
1690
|
+
means whitespace will be preserved. But you must either escape all
|
1691
|
+
characters that have special meaning in XML (such as <literal
|
1692
|
+
moreinfo="none"><</literal> and <literal
|
1693
|
+
moreinfo="none">></literal>), or use a <literal>CDATA</literal>
|
1694
|
+
block.<footnote>
|
1695
|
+
<para>You can use a <literal moreinfo="none">CDATA</literal> section
|
1696
|
+
as long as you don’t need inline markup within the code (see <xref
|
1697
|
+
linkend="verbatim_caveats" />). In a <literal
|
1698
|
+
moreinfo="none">CDATA</literal> section, any text between <literal
|
1699
|
+
moreinfo="none" role="keep-together"><![CDATA[</literal> and
|
1700
|
+
<literal moreinfo="none">]]></literal> is ignored by the XML
|
1701
|
+
parser. You can’t use <literal moreinfo="none">CDATA</literal>
|
1702
|
+
sections if you’re using the XMLmind editor, but on the other hand,
|
1703
|
+
you don’t need to worry about escaping special characters (as XXE
|
1704
|
+
takes care of that for you), which is probably the better end of the
|
1705
|
+
bargain.</para>
|
1706
|
+
</footnote> These obviously come up quite a bit in code, like <literal
|
1707
|
+
moreinfo="none">x <= 1</literal>.</para>
|
1708
|
+
|
1709
|
+
<para>If you want to manage your code in files separate from the
|
1710
|
+
manuscript, you can use <literal moreinfo="none">XInclude</literal>
|
1711
|
+
sections to point to your code files (O’Reilly also uses <literal
|
1712
|
+
moreinfo="none">XInclude</literal>s to organize the
|
1713
|
+
<filename>book.xml</filename>, as described in <xref
|
1714
|
+
linkend="organizing_files" />). In an <literal
|
1715
|
+
moreinfo="none">XInclude</literal> section, the code blocks are referenced
|
1716
|
+
in <literal moreinfo="none"><xi:include></literal>s and are ignored
|
1717
|
+
by the XML parser (they’re not dropped or anything, but the parser doesn’t
|
1718
|
+
try to interpret them as XML, as long as you include the
|
1719
|
+
<literal>parse="text"</literal> attribute):</para>
|
1720
|
+
|
1721
|
+
<programlisting format="linespecific"><programlisting>
|
1722
|
+
<xi:include
|
1723
|
+
xmlns:xi="http://www.w3.org/2001/XInclude"
|
1724
|
+
parse="text" href="hello.c" />
|
1725
|
+
</programlisting></programlisting>
|
1726
|
+
|
1727
|
+
<sect2>
|
1728
|
+
<title>Examples and programlistings</title>
|
1729
|
+
|
1730
|
+
<para>The <literal>example</literal> element is intended for larger
|
1731
|
+
blocks of code for which you want to have a title, a number, and an
|
1732
|
+
explicit cross-reference. <xref linkend="sample_example" /> shows a very
|
1733
|
+
basic one.</para>
|
1734
|
+
|
1735
|
+
<example id="sample_example">
|
1736
|
+
<title>Sample example</title>
|
1737
|
+
|
1738
|
+
<programlisting><!-- Code Goes Here --></programlisting>
|
1739
|
+
</example>
|
1740
|
+
|
1741
|
+
<para>Sometimes your code listings are more informal, just two- or
|
1742
|
+
three-line snippets that don’t require a title or cross-ref. For
|
1743
|
+
runnable code that fits this description, just use a
|
1744
|
+
<literal>programlisting</literal>.</para>
|
1745
|
+
|
1746
|
+
<para>Another option is a <literal>screen</literal>, although this
|
1747
|
+
element is less frequently used and is more specifically intended to
|
1748
|
+
display the output of a command rather than runnable code.</para>
|
1749
|
+
|
1750
|
+
<note>
|
1751
|
+
<para>An <literal>informalexample</literal> element exists as well,
|
1752
|
+
but it’s usually not needed. A <literal
|
1753
|
+
role="keep-together">programlisting</literal> or a
|
1754
|
+
<literal>screen</literal> should suffice for standard code
|
1755
|
+
listings.</para>
|
1756
|
+
</note>
|
1757
|
+
|
1758
|
+
<sidebar>
|
1759
|
+
<title>Characters Per Code Line Limitations</title>
|
1760
|
+
|
1761
|
+
<para>The maximum number of characters per line of code varies
|
1762
|
+
according to book series and where the code is positioned
|
1763
|
+
hierarchically (i.e., the nesting level in the DocBook markup). The
|
1764
|
+
following table lists the most common cases for each series.</para>
|
1765
|
+
|
1766
|
+
<note>
|
1767
|
+
<para>Please keep in mind that these are just the
|
1768
|
+
<emphasis>maximum</emphasis> characters <phrase
|
1769
|
+
role="keep-together">allowed</phrase>. You should review your PDFs
|
1770
|
+
and make your own judgments about the best way to present code
|
1771
|
+
blocks to the reader.</para>
|
1772
|
+
</note>
|
1773
|
+
|
1774
|
+
<informaltable>
|
1775
|
+
<tgroup cols="5">
|
1776
|
+
<colspec colname="col1" colnum="1" />
|
1777
|
+
|
1778
|
+
<colspec colname="col2" colnum="2" />
|
1779
|
+
|
1780
|
+
<colspec colname="col3" colnum="3" />
|
1781
|
+
|
1782
|
+
<colspec colname="col4" colnum="4" />
|
1783
|
+
|
1784
|
+
<colspec colname="col5" colnum="5" />
|
1785
|
+
|
1786
|
+
<thead>
|
1787
|
+
<row>
|
1788
|
+
<entry>Series</entry>
|
1789
|
+
|
1790
|
+
<entry>Body (top-level code)</entry>
|
1791
|
+
|
1792
|
+
<entry>Examples</entry>
|
1793
|
+
|
1794
|
+
<entry>Lists</entry>
|
1795
|
+
|
1796
|
+
<entry>Sidebars/notes/warnings</entry>
|
1797
|
+
</row>
|
1798
|
+
</thead>
|
1799
|
+
|
1800
|
+
<tbody>
|
1801
|
+
<row>
|
1802
|
+
<entry>Animal or Cookbook</entry>
|
1803
|
+
|
1804
|
+
<entry>85</entry>
|
1805
|
+
|
1806
|
+
<entry>90</entry>
|
1807
|
+
|
1808
|
+
<entry>80</entry>
|
1809
|
+
|
1810
|
+
<entry>80</entry>
|
1811
|
+
</row>
|
1812
|
+
|
1813
|
+
<row>
|
1814
|
+
<entry>Small Animal (6x9)</entry>
|
1815
|
+
|
1816
|
+
<entry>76</entry>
|
1817
|
+
|
1818
|
+
<entry>80</entry>
|
1819
|
+
|
1820
|
+
<entry>72</entry>
|
1821
|
+
|
1822
|
+
<entry>70</entry>
|
1823
|
+
</row>
|
1824
|
+
|
1825
|
+
<row>
|
1826
|
+
<entry>Theory in Practice</entry>
|
1827
|
+
|
1828
|
+
<entry>85</entry>
|
1829
|
+
|
1830
|
+
<entry>90</entry>
|
1831
|
+
|
1832
|
+
<entry>80</entry>
|
1833
|
+
|
1834
|
+
<entry>72</entry>
|
1835
|
+
</row>
|
1836
|
+
|
1837
|
+
<row>
|
1838
|
+
<entry>Nutshell</entry>
|
1839
|
+
|
1840
|
+
<entry>76</entry>
|
1841
|
+
|
1842
|
+
<entry>80</entry>
|
1843
|
+
|
1844
|
+
<entry>72</entry>
|
1845
|
+
|
1846
|
+
<entry>66</entry>
|
1847
|
+
</row>
|
1848
|
+
|
1849
|
+
<row>
|
1850
|
+
<entry>Pocket Reference</entry>
|
1851
|
+
|
1852
|
+
<entry>58</entry>
|
1853
|
+
|
1854
|
+
<entry>62</entry>
|
1855
|
+
|
1856
|
+
<entry>53</entry>
|
1857
|
+
|
1858
|
+
<entry>48</entry>
|
1859
|
+
</row>
|
1860
|
+
</tbody>
|
1861
|
+
</tgroup>
|
1862
|
+
</informaltable>
|
1863
|
+
|
1864
|
+
<para>Rendered examples of the above are located here:</para>
|
1865
|
+
|
1866
|
+
<simplelist>
|
1867
|
+
<member><ulink
|
1868
|
+
url="https://prod.oreilly.com/external/tools/docbook/prod/trunk/samples/code_lengths"></ulink></member>
|
1869
|
+
</simplelist>
|
1870
|
+
|
1871
|
+
<para>Please rebreak any code lines that exceed the maximum number of
|
1872
|
+
characters; otherwise, the code will run into the margin in your PDFs,
|
1873
|
+
which is unacceptable for print. It’s best to fix long code lines in
|
1874
|
+
the manuscript stage, while you still have access to the source;
|
1875
|
+
making such edits during Production is much more cumbersome for
|
1876
|
+
everyone involved.</para>
|
1877
|
+
|
1878
|
+
<para>To align or indent within your code, remember to use spaces,
|
1879
|
+
never tabs, because tabs don’t always translate to the same amount of
|
1880
|
+
space on different systems.</para>
|
1881
|
+
</sidebar>
|
1882
|
+
</sect2>
|
1883
|
+
|
1884
|
+
<sect2>
|
1885
|
+
<title>Annotating Your Code in DocBook</title>
|
1886
|
+
|
1887
|
+
<para>O’Reilly’s stylesheets support two different types of inline
|
1888
|
+
DocBook markup for annotating code blocks in <literal
|
1889
|
+
moreinfo="none">programlisting</literal> elements: line annotations and
|
1890
|
+
callouts. Here’s some more information on each. For more details, you
|
1891
|
+
may want to see <ulink
|
1892
|
+
url="http://www.sagehill.net/docbookxsl/AnnotateListing.html"></ulink>.</para>
|
1893
|
+
|
1894
|
+
<sect3>
|
1895
|
+
<title>Using line annotations in programlistings</title>
|
1896
|
+
|
1897
|
+
<para>You can add <literal moreinfo="none">lineannotation</literal>
|
1898
|
+
elements in <literal moreinfo="none">programlisting</literal> elements
|
1899
|
+
to place annotations adjacent to your code lines. Here’s an example of
|
1900
|
+
a <literal moreinfo="none">programlisting</literal> that contains line
|
1901
|
+
annotations:</para>
|
1902
|
+
|
1903
|
+
<programlisting format="linespecific"><programlisting> <lineannotation>The opening tag for a programlisting element.</lineannotation>
|
1904
|
+
<xi:include <lineannotation>An xinclude</lineannotation>
|
1905
|
+
xmlns:xi="http://www.w3.org/2001/XInclude"
|
1906
|
+
parse="text" href="hello.c" />
|
1907
|
+
</programlisting> <lineannotation>The closing tag for a programlisting element.</lineannotation></programlisting>
|
1908
|
+
|
1909
|
+
<para>O’Reilly’s stylesheets will, by default, render the <literal
|
1910
|
+
moreinfo="none">lineannotation</literal> elements in italic, but not
|
1911
|
+
constant width.</para>
|
1912
|
+
</sect3>
|
1913
|
+
|
1914
|
+
<sect3>
|
1915
|
+
<title>Using callouts in programlistings</title>
|
1916
|
+
|
1917
|
+
<para>If you want to have cross-references to specific lines of code
|
1918
|
+
outside your <literal moreinfo="none">programlisting</literal>s—for
|
1919
|
+
example, in discussion text following the code—you can use callouts to
|
1920
|
+
achieve this effect. To add callouts, you need to add <literal
|
1921
|
+
moreinfo="none">co</literal> elements to <literal
|
1922
|
+
moreinfo="none">programlisting</literal>s, which add callout markers
|
1923
|
+
inline in code. Then you need to create a <literal
|
1924
|
+
moreinfo="none">calloutlist</literal> element, which includes a set of
|
1925
|
+
<literal moreinfo="none">callout</literal> elements that include the
|
1926
|
+
explanation text. Here’s the example from before, reconfigured to use
|
1927
|
+
callouts instead of line annotations:</para>
|
1928
|
+
|
1929
|
+
<programlisting format="linespecific"><programlisting> <co
|
1930
|
+
id="opening_tag_co" linkends="opening_tag" />
|
1931
|
+
<xi:include <co id="xinclude_co" linkends="xinclude" />
|
1932
|
+
xmlns:xi="http://www.w3.org/2001/XInclude"
|
1933
|
+
parse="text" href="hello.c" />
|
1934
|
+
</programlisting> <co id="closing_tag_co" linkends="closing_tag" /></programlisting>
|
1935
|
+
|
1936
|
+
<calloutlist>
|
1937
|
+
<callout arearefs="opening_tag_co" id="opening_tag">
|
1938
|
+
<para>The opening tag for a <literal>programlisting</literal>
|
1939
|
+
element.</para>
|
1940
|
+
</callout>
|
1941
|
+
|
1942
|
+
<callout arearefs="xinclude_co" id="xinclude">
|
1943
|
+
<para>An <literal>XInclude</literal>.</para>
|
1944
|
+
</callout>
|
1945
|
+
|
1946
|
+
<callout arearefs="closing_tag_co" id="closing_tag">
|
1947
|
+
<para>The closing tag for a <literal>programlisting</literal>
|
1948
|
+
element.</para>
|
1949
|
+
</callout>
|
1950
|
+
</calloutlist>
|
1951
|
+
|
1952
|
+
<para>Each <literal moreinfo="none">co</literal> element above
|
1953
|
+
includes an optional <literal moreinfo="none">linkends</literal>
|
1954
|
+
attribute that points at the <literal
|
1955
|
+
moreinfo="none">callout</literal> elements that refer to it, forming a
|
1956
|
+
link between the callout marker and the callout text. Conversely, each
|
1957
|
+
<literal moreinfo="none">callout</literal> element requires an
|
1958
|
+
<literal moreinfo="none">arearefs</literal> attribute that points at
|
1959
|
+
the <literal moreinfo="none">co</literal> elements it refers to,
|
1960
|
+
forming a link between the callout and the callout marker.</para>
|
1961
|
+
|
1962
|
+
<para>The callout markers in both the code and the callout list will
|
1963
|
+
be rendered as clickable bidirectional cross-references if you use the
|
1964
|
+
markup above.</para>
|
1965
|
+
|
1966
|
+
<note>
|
1967
|
+
<para>We have a hack for using callouts with XIncluded code, which
|
1968
|
+
you can find at <ulink role="orm:hideurl:ital"
|
1969
|
+
url="https://prod.oreilly.com/external/tools/docbook/prod/trunk/samples/r_and_d/xincludes_and_callouts/">samples/r_and_d/xincludes_and_callouts/</ulink>.</para>
|
1970
|
+
</note>
|
1971
|
+
|
1972
|
+
<para>Optionally, you may include multiple <literal>arearefs</literal>
|
1973
|
+
in a single <literal>callout</literal>. To get the little black number
|
1974
|
+
icons to render on one line—instead of stacked vertically—add the
|
1975
|
+
processing instruction <literal><?dbfo
|
1976
|
+
label-width="<replaceable>N</replaceable>pc"?></literal> to the
|
1977
|
+
beginning of the <literal>calloutlist</literal>. Replace
|
1978
|
+
<replaceable>N</replaceable> with the width of the icon column
|
1979
|
+
according to how many icons you need to make room for:
|
1980
|
+
<literal>1.75pc</literal> works for two icons,
|
1981
|
+
<literal>2.5pc</literal> works for three, etc. (You can also replace
|
1982
|
+
<literal>pc</literal> with <literal>in</literal>,
|
1983
|
+
<literal>pt</literal>, or other standard units.) Here’s an example of
|
1984
|
+
two icons on a single line:</para>
|
1985
|
+
|
1986
|
+
<screen><programlisting> <co id="opening_tag_co2"
|
1987
|
+
linkends="opening_closing_tag2" />
|
1988
|
+
<xi:include <co id="xinclude_co2" linkends="xinclude2" />
|
1989
|
+
xmlns:xi="http://www.w3.org/2001/XInclude"
|
1990
|
+
parse="text" href="hello.c" />
|
1991
|
+
</programlisting> <co id="closing_tag_co2"
|
1992
|
+
linkends="opening_closing_tag2" /></screen>
|
1993
|
+
|
1994
|
+
<calloutlist>
|
1995
|
+
<?dbfo label-width="1.75pc"?>
|
1996
|
+
|
1997
|
+
<callout arearefs="opening_tag_co2 closing_tag_co2"
|
1998
|
+
id="opening_closing_tag2">
|
1999
|
+
<para>The opening and closing tags for a
|
2000
|
+
<literal>programlisting</literal> element.</para>
|
2001
|
+
</callout>
|
2002
|
+
|
2003
|
+
<callout arearefs="xinclude_co2" id="xinclude2">
|
2004
|
+
<para>An <literal>XInclude</literal>.</para>
|
2005
|
+
</callout>
|
2006
|
+
</calloutlist>
|
2007
|
+
|
2008
|
+
<para>The markup for the above looks like this:</para>
|
2009
|
+
|
2010
|
+
<programlisting><screen>&lt;programlisting&gt; <co id="opening_tag_co2"
|
2011
|
+
linkends="opening_closing_tag2"/>
|
2012
|
+
&lt;xi:include <co id="xinclude_co2" linkends="xinclude2"/>
|
2013
|
+
xmlns:xi="http://www.w3.org/2001/XInclude"
|
2014
|
+
parse="text" href="hello.c" /&gt;
|
2015
|
+
&lt;/programlisting&gt; <co id="closing_tag_co2" linkends="opening_closing_tag2"/>
|
2016
|
+
</screen>
|
2017
|
+
|
2018
|
+
<calloutlist>
|
2019
|
+
<?dbfo label-width="2.5pc"?>
|
2020
|
+
<callout arearefs="opening_tag_co2 closing_tag_co2" id="opening_closing_tag2">
|
2021
|
+
<para>The opening and closing tags for a <literal>programlisting</literal>
|
2022
|
+
element.</para>
|
2023
|
+
</callout>
|
2024
|
+
|
2025
|
+
<callout arearefs="xinclude_co2" id="xinclude_co2">
|
2026
|
+
<para>An <literal>XInclude</literal>.</para>
|
2027
|
+
</callout>
|
2028
|
+
</calloutlist></programlisting>
|
2029
|
+
|
2030
|
+
<para>Note that the first and third <literal>co</literal> elements,
|
2031
|
+
which both link to the first <literal>callout</literal>, have
|
2032
|
+
<literal>linkends</literal> that match the
|
2033
|
+
<literal>callout</literal>’s ID:
|
2034
|
+
<literal>opening_closing_tag2</literal>.</para>
|
2035
|
+
|
2036
|
+
<para>For more information on DocBook callout markup, see <ulink
|
2037
|
+
url="http://www.sagehill.net/docbookxsl/AnnotateListing.html#Callouts"></ulink>.
|
2038
|
+
However, please note that our toolchain does not support <literal
|
2039
|
+
moreinfo="none">areaspec</literal>/<literal
|
2040
|
+
moreinfo="none">area</literal>/<literal
|
2041
|
+
moreinfo="none">areaset</literal> elements to specify regions for
|
2042
|
+
callouts.</para>
|
2043
|
+
</sect3>
|
2044
|
+
|
2045
|
+
<sect3>
|
2046
|
+
<title>Other ways of annotating code</title>
|
2047
|
+
|
2048
|
+
<para>Although DocBook XML includes markup for adding line numbering
|
2049
|
+
to <literal moreinfo="none">programlisting</literal> elements,
|
2050
|
+
O’Reilly’s toolchain doesn’t support rendering of line numbers in this
|
2051
|
+
way. They don’t allow for good cross-referencing and can potentially
|
2052
|
+
cause problems when code is revised. For example, let’s say you used
|
2053
|
+
line numbering, and then in the text below you reference something in
|
2054
|
+
line 17. But then, later in the process, a tech reviewer notes a bug
|
2055
|
+
in lines 14–16, and you decide you don’t need those lines anyway, so
|
2056
|
+
you delete them. Line 17 then becomes line 14, so you’d have to change
|
2057
|
+
that reference in the text below, which is easy to overlook and is
|
2058
|
+
unlikely to be caught in production.</para>
|
2059
|
+
|
2060
|
+
<para>If you want to cross-reference code blocks by line number, we
|
2061
|
+
recommend using <phrase role="keep-together">callouts</phrase>
|
2062
|
+
instead; they are autonumbered and will adjust automatically if you
|
2063
|
+
shift code lines around.</para>
|
2064
|
+
</sect3>
|
2065
|
+
</sect2>
|
2066
|
+
</sect1>
|
2067
|
+
|
2068
|
+
<sect1 id="unicode">
|
2069
|
+
<title>Unicode for Special Characters</title>
|
2070
|
+
|
2071
|
+
<para>For special or nonstandard keyboard characters, use Unicode. The
|
2072
|
+
following table provides the values for some common characters; for all
|
2073
|
+
others, use the <ulink
|
2074
|
+
url="http://www.fileformat.info/info/unicode/char/search.htm">Unicode
|
2075
|
+
Character Search</ulink> (but keep in mind that we may not have fonts for
|
2076
|
+
more exotic characters; send email to <email>toolsreq@oreilly.com</email>
|
2077
|
+
if you have questions). If you’re using XMLmind with the ORM XXE
|
2078
|
+
Customizations file, most of these characters have shortcuts, and others
|
2079
|
+
are available via the Characters panel.</para>
|
2080
|
+
|
2081
|
+
<para>To add a Unicode character directly to XML in a text editor, use the
|
2082
|
+
entity <literal>&#x<replaceable>CODEPOINT</replaceable>;</literal>,
|
2083
|
+
where <replaceable>CODEPOINT</replaceable> is the four-digit hexadecimal
|
2084
|
+
number after U+ (e.g., for <phrase role="keep-together">U+20A0</phrase>,
|
2085
|
+
enter <literal>&#x20A0;</literal>). Letters that are part of the
|
2086
|
+
codepoint may be entered as either upper- or lowercase (i.e.,
|
2087
|
+
<literal>&#x03bb;</literal> is the same as
|
2088
|
+
<literal>&#x03BB;</literal>), but the <literal>x</literal> between the
|
2089
|
+
<literal>#</literal> symbol and the codepoint must be lowercase.</para>
|
2090
|
+
|
2091
|
+
<informaltable>
|
2092
|
+
<tgroup cols="2">
|
2093
|
+
<thead>
|
2094
|
+
<row>
|
2095
|
+
<entry>Character</entry>
|
2096
|
+
|
2097
|
+
<entry>Unicode value (hexadecimal codepoint)</entry>
|
2098
|
+
</row>
|
2099
|
+
</thead>
|
2100
|
+
|
2101
|
+
<tbody>
|
2102
|
+
<row>
|
2103
|
+
<entry>— (Em Dash)</entry>
|
2104
|
+
|
2105
|
+
<entry>U+2014</entry>
|
2106
|
+
</row>
|
2107
|
+
|
2108
|
+
<row>
|
2109
|
+
<entry>- (En Dash)</entry>
|
2110
|
+
|
2111
|
+
<entry>U+2013</entry>
|
2112
|
+
</row>
|
2113
|
+
|
2114
|
+
<row>
|
2115
|
+
<entry>“ (Curly Left Double Quotation Mark)</entry>
|
2116
|
+
|
2117
|
+
<entry>U+201C</entry>
|
2118
|
+
</row>
|
2119
|
+
|
2120
|
+
<row>
|
2121
|
+
<entry>” (Curly Right Double Quotation Mark)</entry>
|
2122
|
+
|
2123
|
+
<entry>U+201D</entry>
|
2124
|
+
</row>
|
2125
|
+
|
2126
|
+
<row>
|
2127
|
+
<entry>‘ (Curly Left Single Quotation Mark)</entry>
|
2128
|
+
|
2129
|
+
<entry>U+2018</entry>
|
2130
|
+
</row>
|
2131
|
+
|
2132
|
+
<row>
|
2133
|
+
<entry>’ (Curly Right Single Quotation Mark)</entry>
|
2134
|
+
|
2135
|
+
<entry>U+2019</entry>
|
2136
|
+
</row>
|
2137
|
+
|
2138
|
+
<row>
|
2139
|
+
<entry>× (MathMultiplier)</entry>
|
2140
|
+
|
2141
|
+
<entry>U+00D7</entry>
|
2142
|
+
</row>
|
2143
|
+
|
2144
|
+
<row>
|
2145
|
+
<entry>→ (CharMenuDelim)</entry>
|
2146
|
+
|
2147
|
+
<entry>U+2192</entry>
|
2148
|
+
</row>
|
2149
|
+
|
2150
|
+
<row>
|
2151
|
+
<entry>€ (Euro Currency Symbol)</entry>
|
2152
|
+
|
2153
|
+
<entry>U+20A0</entry>
|
2154
|
+
</row>
|
2155
|
+
|
2156
|
+
<row>
|
2157
|
+
<entry>✓ (Check Mark)</entry>
|
2158
|
+
|
2159
|
+
<entry>U+2713</entry>
|
2160
|
+
</row>
|
2161
|
+
|
2162
|
+
<row>
|
2163
|
+
<entry>✗ (Ballot X)</entry>
|
2164
|
+
|
2165
|
+
<entry>U+2717</entry>
|
2166
|
+
</row>
|
2167
|
+
|
2168
|
+
<row>
|
2169
|
+
<entry>⌘ (Place Of Interest Sign)</entry>
|
2170
|
+
|
2171
|
+
<entry>U+2318</entry>
|
2172
|
+
</row>
|
2173
|
+
|
2174
|
+
<row>
|
2175
|
+
<entry>↵ (Carriage Return Arrow)</entry>
|
2176
|
+
|
2177
|
+
<entry>U+21B5</entry>
|
2178
|
+
</row>
|
2179
|
+
</tbody>
|
2180
|
+
</tgroup>
|
2181
|
+
</informaltable>
|
2182
|
+
</sect1>
|
2183
|
+
|
2184
|
+
<sect1 id="adding_comments">
|
2185
|
+
<title>Adding Comments to Your Manuscript</title>
|
2186
|
+
|
2187
|
+
<para>You have two main options for adding comments to your manuscript:
|
2188
|
+
using standard XML comments (<literal><!--</literal>
|
2189
|
+
<literal>--></literal>) and using the <literal>remark</literal>
|
2190
|
+
element.</para>
|
2191
|
+
|
2192
|
+
<para>XML comments are particularly useful for commenting out large blocks
|
2193
|
+
of text—for example, text that is under review, or text that you don’t
|
2194
|
+
currently want to include in your manuscript. In the following example,
|
2195
|
+
the entire paragraph is commented out:</para>
|
2196
|
+
|
2197
|
+
<programlisting><!-- O’Reilly’s mission statement.
|
2198
|
+
<para>O’Reilly Media spreads the knowledge of innovators through its books,
|
2199
|
+
online services, magazines, research, and conferences. Since 1978, O’Reilly
|
2200
|
+
has been a chronicler and catalyst of leading-edge development, homing in
|
2201
|
+
on the technology trends that really matter and galvanizing their adoption
|
2202
|
+
by amplifying “faint signals” from the alpha geeks who are creating the future.
|
2203
|
+
An active participant in the technology community, the company has a long
|
2204
|
+
history of advocacy, meme-making, and evangelism.</para> --></programlisting>
|
2205
|
+
|
2206
|
+
<para><literal>remark</literal> elements are typically used by authors to
|
2207
|
+
direct specific comments to the editor or Production, such as in the
|
2208
|
+
following:</para>
|
2209
|
+
|
2210
|
+
<programlisting><remark>PRODUCTION: Please stet grammatical errors in the following</remark>
|
2211
|
+
|
2212
|
+
<para>I can haz cheezburger, plz?</para></programlisting>
|
2213
|
+
|
2214
|
+
<para>If you have specific comments for Production staff, we would
|
2215
|
+
appreciate you formatting them as <literal>remark</literal> elements and
|
2216
|
+
starting them with “PRODUCTION”, as done above. This is very helpful in
|
2217
|
+
distinguishing comments that should be addressed during Production from
|
2218
|
+
other comments directed toward editorial staff or tech reviewers.</para>
|
2219
|
+
|
2220
|
+
<para>By default, comments are not rendered in your PDF builds. <xref
|
2221
|
+
linkend="displaying_comments_in_pdfs" /> describes how to display
|
2222
|
+
them.</para>
|
2223
|
+
</sect1>
|
2224
|
+
</chapter>
|