/[gentoo]/xml/htdocs/doc/en/xml-guide.xml
Gentoo

Diff of /xml/htdocs/doc/en/xml-guide.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.3 Revision 1.33
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<?xml-stylesheet href="/xsl/guide.xsl" type="text/xsl"?> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/xml-guide.xml,v 1.33 2004/09/24 20:46:42 swift Exp $ -->
3
4<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
5 4
6<guide link="/doc/en/xml-guide.xml"> 5<guide link="/doc/en/xml-guide.xml">
7<title>Gentoo Linux Documentation Guide</title> 6<title>Gentoo Linux XML Guide</title>
8<author title="Chief Architect"><mail link="drobbins@gentoo.org">Daniel Robbins</mail></author>
9 7
8<author title="Author">
9 <mail link="drobbins@gentoo.org">Daniel Robbins</mail>
10</author>
11<author title="Author"><!-- zhen@gentoo.org -->
12 John P. Davis
13</author>
14<author title="Editor">
15 <mail link="peesh@gentoo.org">Jorge Paulo</mail>
16</author>
17<author title="Editor">
18 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
19</author>
20
21<abstract>
10<abstract>This guide shows you how to compose web documentation using the new lightweight Gentoo guide 22This guide shows you how to compose web documentation using the new lightweight
11XML syntax. This syntax is the official format for Gentoo Linux documentation, and this document 23Gentoo GuideXML syntax. This syntax is the official format for Gentoo Linux
12itself was created using guide XML. This guide assumes a basic working knowledge of XML and HTML. 24documentation, and this document itself was created using GuideXML. This guide
25assumes a basic working knowledge of XML and HTML.
13</abstract> 26</abstract>
14 27
28<!-- The content of this document is licensed under the CC-BY-SA license -->
29<!-- See http://creativecommons.org/licenses/by-sa/2.0 -->
30<license/>
31
15<version>1.0</version> 32<version>2.11</version>
16<date>07 Mar 2002</date> 33<date>August 12, 2004</date>
17 34
18<chapter> 35<chapter>
19<title>Guide basics</title> 36<title>Guide basics</title>
20
21<section> 37<section>
22<title>Guide XML design goals</title> 38<title>Guide XML design goals</title>
23<body> 39<body>
24 40
41<p>
25<p> The guide XML syntax is lightweight yet expressive, so that it is easy to 42The guide XML syntax is lightweight yet expressive, so that it is easy to
26learn yet also provides all the features we need for the creation of web 43learn yet also provides all the features we need for the creation of web
27documentation. The number of tags is kept to a minimum -- just those we need. 44documentation. The number of tags is kept to a minimum -- just those we need.
28This makes it easy to transform guide into other formats, such as DocBook 45This makes it easy to transform guide into other formats, such as DocBook
29XML/SGML or web-ready HTML. </p> 46XML/SGML or web-ready HTML.
47</p>
30 48
49<p>
31<p>The goal is to make it easy to <e>create</e> and <e>transform</e> guide XML 50The goal is to make it easy to <e>create</e> and <e>transform</e> guide XML
32documents.</p> 51documents.
52</p>
33 53
34</body> 54</body>
35</section>
36
37<section> 55</section>
38<title>How to transform guide XML into HTML</title> 56<section>
57<title>Further Resources</title>
39<body> 58<body>
40 59
41<p> Before we take a look at the guide syntax itself, it's helpful to know how
42guide XML is transformed into web-ready HTML. To do this, we use a special
43file called <path>guide-main.xsl</path>, along with a command-line XSLT processing
44tool (also called an "engine"). The <path>guide-main.xsl</path> file describes
45exactly how to transform the contents of the source guide XML document to
46create the target HTML file. Two popular XSLT processors are <c>sabcmd</c>
47(included in the <path>app-text/sablotron</path> package) and <c>xsltproc</c>
48(found in the <path>dev-libs/libxslt</path> package). From experience, we've
49found that <c>xsltproc</c> is the higher-quality and more feature-rich XSLT
50processor. </p>
51
52<p> Once you have either <c>xsltproc</c> or <c>sabcmd</c> installed, you're
53ready to convert guide XML into web-ready HTML. Here's how it works. First,
54download the latest snapshot of our Web site from
55<uri>http://www.gentoo.org/projects/xml.html</uri>, found in the <uri
56link="http://www.gentoo.org/projects/guide-xml-latest.tar.gz">xml-guide-latest.tar.gz</uri>
57file. Extract the tarball. Inside it, you'll find a <path>gentoo-src</path>
58directory, as well as a <path>gentoo-src/xml</path> directory, etc. Now, find
59<path>gentoo-src/xml/install.xml</path>. (The new user installation guide).
60This will be our source XML guide document. The easiest way to perform the
61transformation is to change directories to the location of the
62<path>guide-main.xsl</path> file. Then, execute <c>xsltproc</c> as follows:
63</p> 60<p>
64 61If you are planning on contributing documentation to Gentoo, or you want to test
65<pre> 62GuideXML, please read the <uri
66# <i>cd gentoo-web/xsl</i> 63link="http://www.gentoo.org/doc/en/doc-tipsntricks.xml">Tips and Tricks</uri>
67# <i>xsltproc guide-main.xsl ../xml/install.xml &gt; /tmp/install.html</i> 64which contains tips and tricks for documentation development.
68</pre>
69
70<p> If all went well, you should have a web-ready version of
71<path>install.xml</path> at <path>/tmp/install.html</path>. For this document
72to display properly in a web browser, you may have to copy some files from
73<path>gentoo-web</path> to <path>/tmp</path>, such
74as <path>css/main-new.css</path> and (to be safe) the entire <path>images</path>
75directory.
76</p> 65</p>
77 66
78</body> 67</body>
79</section> 68</section>
80</chapter> 69</chapter>
70
81<chapter> 71<chapter>
82 <title>Guide XML</title> 72<title>Guide XML</title>
83<section> 73<section>
84<title>Basic structure</title> 74<title>Basic structure</title>
85<body> 75<body>
86 76
77<p>
87<p>Now that you know how to transform guide XML, you're ready to start learning 78Now that you know how to transform guide XML, you're ready to start learning
88the guide XML syntax. We'll start with the the initial tags used in a guide 79the GuideXML syntax. We'll start with the the initial tags used in a guide
89XML document: </p> 80XML document:
81</p>
90 82
91<pre caption="The initial part of a guide XML document"> 83<pre caption="The initial part of a guide XML document">
92&lt;?xml version='1.0'?&gt; 84&lt;?xml version='1.0' encoding="UTF-8"?&gt;
93&lt;guide&gt; 85&lt;!DOCTYPE guide SYSTEM "/dtd/guide.dtd"&gt;
86&lt;guide link="relative_link_to_your_guide"&gt;
94&lt;title&gt;<i>Gentoo Linux Documentation Guide</i>&lt;/title&gt; 87&lt;title&gt;<i>Gentoo Linux Documentation Guide</i>&lt;/title&gt;
95&lt;author title="<i>Chief Architect</i>"&gt;&lt;mail link="<i>drobbins@gentoo.org</i>"&gt; 88&lt;author title="<i>Author</i>"&gt;
96 <i>Daniel Robbins</i>&lt;/mail&gt; 89 &lt;mail link="<i>yourname@gentoo.org</i>"&gt;<i>Your Name</i>&lt;/mail&gt;
97&lt;/author&gt; 90&lt;/author&gt;
98&lt;author title="<i>Editor</i>"&gt;&lt;mail link="<i>thomasfl@gentoo.org</i>"&gt;
99 <i>Thomas Flavel</i>&lt;/mail&gt;
100&lt;/author&gt;
101 91
92&lt;abstract&gt;
102&lt;abstract&gt;<i>This guide shows you how to compose web documentation using 93<i>This guide shows you how to compose web documentation using
103our new lightweight Gentoo guide XML syntax. This syntax is the official 94our new lightweight Gentoo GuideXML syntax. This syntax is the official
104format for Gentoo Linux web documentation, and this document itself was created 95format for Gentoo Linux web documentation, and this document itself was created
105using guide XML.</i> &lt;/abstract&gt; 96using GuideXML.</i>
97&lt;/abstract&gt;
98
99&lt;!-- The content of this document is licensed under the CC-BY-SA license --&gt;
100&lt;!-- See http://creativecommons.org/licenses/by-sa/2.0 --&gt;
101&lt;license/&gt;
106 102
107&lt;version&gt;<i>1.0</i>&lt;/version&gt; 103&lt;version&gt;<i>1.0</i>&lt;/version&gt;
108&lt;date&gt;<i>29 Mar 2001</i>&lt;/date&gt; 104&lt;date&gt;<i>29 Mar 2001</i>&lt;/date&gt;
109</pre> 105</pre>
110 106
107<p>
111<p>On the first, line, we see the requisite tag that identifies this as an XML 108On the first, line, we see the requisite tag that identifies this as an XML
112document. Following it, there's a <c>&lt;guide&gt;</c> tag -- the entire 109document. Following it, there's a <c>&lt;guide&gt;</c> tag -- the entire
113guide document is enclosed within a <c>&lt;guide&gt; &lt;/guide&gt;</c> pair. 110guide document is enclosed within a <c>&lt;guide&gt; &lt;/guide&gt;</c> pair.
114Next, there's a <c>&lt;title&gt;</c> tag, used to set the title for the entire 111Next, there's a <c>&lt;title&gt;</c> tag, used to set the title for the entire
115guide document. </p> 112guide document.
113</p>
116 114
115<p>
117<p>Then, we come to the <c>&lt;author&gt;</c> tags, which contain information 116Then, we come to the <c>&lt;author&gt;</c> tags, which contain information
118about the various authors of the document. Each <c>&lt;author&gt;</c> tag 117about the various authors of the document. Each <c>&lt;author&gt;</c> tag
119allows for an optional <c>title=</c> element, used to specify the author's 118allows for an optional <c>title=</c> element, used to specify the author's
120relationship to the document (author, co-author, editor, etc.). In this 119relationship to the document (author, co-author, editor, etc.). In this
121particular example, the authors' names are enclosed in another tag -- a 120particular example, the authors' names are enclosed in another tag -- a
122<c>&lt;mail&gt;</c> tag, used to specify an email address for this particular 121<c>&lt;mail&gt;</c> tag, used to specify an email address for this particular
123person. The <c>&lt;mail&gt;</c> tag is optional and can be omitted, and no 122person. The <c>&lt;mail&gt;</c> tag is optional and can be omitted, and no
124more than one <c>&lt;author&gt;</c> element is required per guide document. 123more than one <c>&lt;author&gt;</c> element is required per guide document.
125</p> 124</p>
126 125
126<p>
127<p>Next, we come to the <c>&lt;abstract&gt;</c>, <c>&lt;version&gt;</c> and 127Next, we come to the <c>&lt;abstract&gt;</c>, <c>&lt;version&gt;</c> and
128<c>&lt;date&gt;</c> tags, used to specify a summary of the document, the 128<c>&lt;date&gt;</c> tags, used to specify a summary of the document, the
129current version number, and the current version date (in DD MMM YYYY format) 129current version number, and the current version date (in DD MMM YYYY format)
130respectively. This rounds out the tags that should appear at the beginning of 130respectively. This rounds out the tags that should appear at the beginning of
131a guide document. Besides the <c>&lt;title&gt;</c> and <c>&lt;mail&gt;</c> 131a guide document. Besides the <c>&lt;title&gt;</c> and <c>&lt;mail&gt;</c>
132tags, these tags shouldn't appear anywhere else except immediately inside the 132tags, these tags shouldn't appear anywhere else except immediately inside the
133<c>&lt;guide&gt;</c> tag, and for consistency it's recommended (but not 133<c>&lt;guide&gt;</c> tag, and for consistency it's recommended (but not
134required) that these tags appear before the content of the document. </p> 134required) that these tags appear before the content of the document.
135</p>
135 136
136</body> 137<p>
137</section> 138Finally we have the <c>&lt;license/&gt;</c> tag, used to publish the
139document under the <uri link="http://creativecommons.org/licenses/by-sa/2.0/">Creative
140Commons - Attribution / Share Alike</uri> license as required by the <uri
141link="/doc/en/doc-policy.xml">Documentation Policy</uri>.
142</p>
138 143
144</body>
145</section>
139<section> 146<section>
140<title>Chapters and sections</title> 147<title>Chapters and sections</title>
141<body> 148<body>
149
150<p>
142<p>Once the initial tags have been specified, you're ready to start adding 151Once the initial tags have been specified, you're ready to start adding
143the structural elements of the document. Guide documents are divided into 152the structural elements of the document. Guide documents are divided into
144chapters, and each chapter can hold one or more sections. Every chapter 153chapters, and each chapter can hold one or more sections. Every chapter
145and section has a title. Here's an example chapter with a single section, 154and section has a title. Here's an example chapter with a single section,
146consisting of a paragraph. If you append this XML to the XML in the <uri link="#doc_pre2">previous 155consisting of a paragraph. If you append this XML to the XML in the <uri link="#doc_chap2_pre1">previous
147excerpt</uri> and append a <c>&lt;/guide&gt;</c> to the end of the file, you'll have a valid 156excerpt</uri> and append a <c>&lt;/guide&gt;</c> to the end of the file, you'll have a valid
148(if minimal) guide document: 157(if minimal) guide document:
149</p> 158</p>
150 159
151<pre> 160<pre>
152&lt;chapter&gt; 161&lt;chapter&gt;
153&lt;title&gt;<i>This is my chapter</i>&lt;/title&gt; 162&lt;title&gt;<i>This is my chapter</i>&lt;/title&gt;
154&lt;section&gt; 163&lt;section&gt;
155 &lt;title&gt;<i>This is section one of my chapter</i>&lt;/title&gt; 164&lt;title&gt;<i>This is section one of my chapter</i>&lt;/title&gt;
156 &lt;body&gt; 165&lt;body&gt;
166
167&lt;p&gt;
157 &lt;p&gt;<i>This is the actual text content of my section.</i>&lt;/p&gt; 168<i>This is the actual text content of my section.</i>
169&lt;/p&gt;
170
158 &lt;/body&gt; 171&lt;/body&gt;
159&lt;/section&gt; 172&lt;/section&gt;
160&lt;/chapter&gt; 173&lt;/chapter&gt;
161</pre> 174</pre>
162 175
176<p>
163<p>Above, I set the chapter title by adding a child <c>&lt;title&gt;</c> 177Above, I set the chapter title by adding a child <c>&lt;title&gt;</c>
164element to the <c>&lt;chapter&gt;</c> element. Then, I created a section by 178element to the <c>&lt;chapter&gt;</c> element. Then, I created a section by
165adding a <c>&lt;section&gt;</c> element. If you look inside the 179adding a <c>&lt;section&gt;</c> element. If you look inside the
166<c>&lt;section&gt;</c> element, you'll see that it has two child elements -- a 180<c>&lt;section&gt;</c> element, you'll see that it has two child elements -- a
167<c>&lt;title&gt;</c> and a <c>&lt;body&gt;</c>. While the <c>&lt;title&gt;</c> 181<c>&lt;title&gt;</c> and a <c>&lt;body&gt;</c>. While the <c>&lt;title&gt;</c>
168is nothing new, the <c>&lt;body&gt;</c> is -- it contains the actual text 182is nothing new, the <c>&lt;body&gt;</c> is -- it contains the actual text
169content of this particular section. We'll look at the tags that are allowed 183content of this particular section. We'll look at the tags that are allowed
170inside a <c>&lt;body&gt;</c> element in a bit. </p> 184inside a <c>&lt;body&gt;</c> element in a bit.
185</p>
171 186
187<note>
172<note>A <c>&lt;guide&gt;</c> element can contain multiple 188A <c>&lt;guide&gt;</c> element can contain multiple <c>&lt;chapter&gt;</c>
173<c>&lt;chapter&gt;</c> elements, and a <c>&lt;chapter&gt;</c> can contain 189elements, and a <c>&lt;chapter&gt;</c> can contain multiple
174multiple <c>&lt;section&gt;</c> elements. However, a <c>&lt;section&gt;</c> 190<c>&lt;section&gt;</c> elements. However, a <c>&lt;section&gt;</c>
175element can only contain one <c>&lt;body&gt;</c> element. </note> 191element can only contain one <c>&lt;body&gt;</c> element.
192</note>
176 193
177</body> 194</body>
178</section> 195</section>
179
180<section> 196<section>
181<title>An example &lt;body&gt;</title> 197<title>An example &lt;body&gt;</title>
182<body> 198<body>
199
183<p> 200<p>
184Now, it's time to learn how to mark up actual content. Here's the XML code for an example <c>&lt;body&gt;</c> element: 201Now, it's time to learn how to mark up actual content. Here's the XML code for an example <c>&lt;body&gt;</c> element:
185</p> 202</p>
203
186<pre> 204<pre>
187&lt;p&gt; 205&lt;p&gt;
188This is a paragraph. &lt;path&gt;/etc/passwd&lt;/path&gt; is a file. 206This is a paragraph. &lt;path&gt;/etc/passwd&lt;/path&gt; is a file.
189&lt;uri&gt;http://www.gentoo.org&lt;/uri&gt; is my favorite website. 207&lt;uri&gt;http://www.gentoo.org&lt;/uri&gt; is my favorite website.
190Type &lt;c&gt;ls&lt;/c&gt; if you feel like it. I &lt;e&gt;really&lt;/e&gt; want to go to sleep now. 208Type &lt;c&gt;ls&lt;/c&gt; if you feel like it. I &lt;e&gt;really&lt;/e&gt; want to go to sleep now.
197Make HTML/XML easier to read by using selective emphasis: 215Make HTML/XML easier to read by using selective emphasis:
198&lt;foo&gt;&lt;i&gt;bar&lt;/i&gt;&lt;/foo&gt; 216&lt;foo&gt;&lt;i&gt;bar&lt;/i&gt;&lt;/foo&gt;
199 217
200&lt;codenote&gt;This is how to insert an inline note into the code block&lt;/codenote&gt; 218&lt;codenote&gt;This is how to insert an inline note into the code block&lt;/codenote&gt;
201&lt;/pre&gt; 219&lt;/pre&gt;
202&lt;note&gt;This is a note.&lt;/note&gt; 220
203&lt;warn&gt;This is a warning.&lt;/warn&gt; 221&lt;note&gt;
204&lt;impo&gt;This is important.&lt;/impo&gt; 222This is a note.
223&lt;/note&gt;
224
225&lt;warn&gt;
226This is a warning.
227&lt;/warn&gt;
228
229&lt;impo&gt;
230This is important.
231&lt;/impo&gt;
205</pre> 232</pre>
233
234<p>
206<p>Now, here's how this <c>&lt;body&gt;</c> element is rendered:</p> 235Now, here's how this <c>&lt;body&gt;</c> element is rendered:
236</p>
207 237
208<p> 238<p>
209This is a paragraph. <path>/etc/passwd</path> is a file. 239This is a paragraph. <path>/etc/passwd</path> is a file.
210<uri>http://www.gentoo.org</uri> is my favorite website. 240<uri>http://www.gentoo.org</uri> is my favorite website.
211Type <c>ls</c> if you feel like it. I <e>really</e> want to go to sleep now. 241Type <c>ls</c> if you feel like it. I <e>really</e> want to go to sleep now.
218Make HTML/XML easier to read by using selective emphasis: 248Make HTML/XML easier to read by using selective emphasis:
219&lt;foo&gt;<i>bar</i>&lt;/foo&gt; 249&lt;foo&gt;<i>bar</i>&lt;/foo&gt;
220 250
221<codenote>This is how to insert an inline note into the code block</codenote> 251<codenote>This is how to insert an inline note into the code block</codenote>
222</pre> 252</pre>
223<note>This is a note.</note>
224<warn>This is a warning.</warn>
225<impo>This is important.</impo>
226</body>
227</section>
228 253
254<note>
255This is a note.
256</note>
257
258<warn>
259This is a warning.
260</warn>
261
262<impo>
263This is important.
264</impo>
265
266</body>
267</section>
229<section> 268<section>
230<title>The &lt;body&gt; tags</title> 269<title>The &lt;body&gt; tags</title>
231<body> 270<body>
232 271
272<p>
233<p> We introduced a lot of new tags in the previous section -- here's what you 273We introduced a lot of new tags in the previous section -- here's what you
234need to know. The <c>&lt;p&gt;</c> (paragraph), <c>&lt;pre&gt;</c> (code 274need to know. The <c>&lt;p&gt;</c> (paragraph), <c>&lt;pre&gt;</c> (code
235block), <c>&lt;note&gt;</c>, <c>&lt;warn&gt;</c> (warning) and 275block), <c>&lt;note&gt;</c>, <c>&lt;warn&gt;</c> (warning) and
236<c>&lt;impo&gt;</c> (important) tags all can contain one or more lines of text. 276<c>&lt;impo&gt;</c> (important) tags all can contain one or more lines of text.
237Besides the <c>&lt;table&gt;</c> element (which we'll cover in just a bit), 277Besides the <c>&lt;table&gt;</c> element (which we'll cover in just a bit),
238these are the only tags that should appear immediately inside a 278these are the only tags that should appear immediately inside a
239<c>&lt;body&gt;</c> element. Another thing -- these tags <e>should not</e> be 279<c>&lt;body&gt;</c> element. Another thing -- these tags <e>should not</e> be
240stacked -- in other words, don't put a <c>&lt;note&gt;</c> element inside a 280stacked -- in other words, don't put a <c>&lt;note&gt;</c> element inside a
241<c>&lt;p&gt;</c> element. As you might guess, the <c>&lt;pre&gt;</c> element 281<c>&lt;p&gt;</c> element. As you might guess, the <c>&lt;pre&gt;</c> element
242preserves its whitespace exactly, making it well-suited for code excerpts.</p> 282preserves its whitespace exactly, making it well-suited for code excerpts.
283You can also name the <c>&lt;pre&gt;</c> tag:
284</p>
285
286<pre caption = "Named &lt;pre&gt;">
287&lt;pre caption = "Output of uptime"&gt;
288# &lt;i&gt;uptime&lt;/i&gt;
28916:50:47 up 164 days, 2:06, 5 users, load average: 0.23, 0.20, 0.25
290&lt;/pre&gt;
291</pre>
243 292
244</body> 293</body>
245</section> 294</section>
246<section> 295<section>
247<title>&lt;path&gt;, &lt;c&gt; and &lt;e&gt;</title> 296<title>&lt;path&gt;, &lt;c&gt; and &lt;e&gt;</title>
248<body> 297<body>
249 298
299<p>
250<p>The <c>&lt;path&gt;</c>, <c>&lt;c&gt;</c> and <c>&lt;e&gt;</c> elements can 300The <c>&lt;path&gt;</c>, <c>&lt;c&gt;</c> and <c>&lt;e&gt;</c> elements can
251be used inside any child <c>&lt;body&gt;</c> tag, except for 301be used inside any child <c>&lt;body&gt;</c> tag, except for
252<c>&lt;pre&gt;</c>. </p> 302<c>&lt;pre&gt;</c>.
303</p>
253 304
305<p>
254<p>The <c>&lt;path&gt;</c> element is used to mark text that refers to an 306The <c>&lt;path&gt;</c> element is used to mark text that refers to an
255<e>on-disk file</e> -- either an <e>absolute or relative path</e>, or a <e>simple filename</e>. 307<e>on-disk file</e> -- either an <e>absolute or relative path</e>, or a
256This element is generally rendered with a monospaced font to offset it from the 308<e>simple filename</e>. This element is generally rendered with a monospaced
257standard paragraph type. </p> 309font to offset it from the standard paragraph type.
310</p>
258 311
312<p>
259<p>The <c>&lt;c&gt;</c> element is used to mark up a <e>command</e> or <e>user 313The <c>&lt;c&gt;</c> element is used to mark up a <e>command</e> or <e>user
260input</e>. Think of <c>&lt;c&gt;</c> as a way to alert the reader to something 314input</e>. Think of <c>&lt;c&gt;</c> as a way to alert the reader to something
261that they can type in that will perform some kind of action. For example, all 315that they can type in that will perform some kind of action. For example, all
262the XML tags displayed in this document are enclosed in a <c>&lt;c&gt;</c> 316the XML tags displayed in this document are enclosed in a <c>&lt;c&gt;</c>
263element because they represent something that the user could type in that is 317element because they represent something that the user could type in that is
264not a path. By using <c>&lt;c&gt;</c> elements, you'll help your readers 318not a path. By using <c>&lt;c&gt;</c> elements, you'll help your readers
265quickly identify commands that they need to type in. Also, because 319quickly identify commands that they need to type in. Also, because
266<c>&lt;c&gt;</c> elements are already offset from regular text, <e>it is rarely 320<c>&lt;c&gt;</c> elements are already offset from regular text, <e>it is rarely
267necessary to surround user input with double-quotes</e>. For example, don't 321necessary to surround user input with double-quotes</e>. For example, don't
268refer to a "<c>&lt;c&gt;</c>" element like I did in this sentence. Avoiding 322refer to a "<c>&lt;c&gt;</c>" element like I did in this sentence. Avoiding
269the use of unnecessary double-quotes makes a document more readable -- and adorable!</p> 323the use of unnecessary double-quotes makes a document more readable -- and
324adorable!
325</p>
270 326
327<p>
271<p><c>&lt;e&gt;</c> is used to apply emphasis to a word or phrase; for example: 328<c>&lt;e&gt;</c> is used to apply emphasis to a word or phrase; for example:
272I <e>really</e> should use semicolons more often. As you can see, this text is 329I <e>really</e> should use semicolons more often. As you can see, this text is
273offset from the regular paragraph type for emphasis. This helps to give your 330offset from the regular paragraph type for emphasis. This helps to give your
274prose more <e>punch</e>!</p> 331prose more <e>punch</e>!
332</p>
275 333
276</body> 334</body>
277</section> 335</section>
278
279<section> 336<section>
280<title>&lt;mail&gt; and &lt;uri&gt;</title> 337<title>&lt;mail&gt; and &lt;uri&gt;</title>
281<body> 338<body>
282 339
340<p>
283<p>We've taken a look at the <c>&lt;mail&gt;</c> tag earlier; it's used to link some text 341We've taken a look at the <c>&lt;mail&gt;</c> tag earlier; it's used to link
284with a particular email address, and takes the form <c>&lt;mail link="foo@bar.com"&gt;Mr. Foo Bar&lt;/mail&gt;</c>.</p> 342some text with a particular email address, and takes the form <c>&lt;mail
343link="foo@bar.com"&gt;Mr. Foo Bar&lt;/mail&gt;</c>.
344</p>
285 345
346<p>
286<p>The <c>&lt;uri&gt;</c> tag is used to point to files/locations on the 347The <c>&lt;uri&gt;</c> tag is used to point to files/locations on the
287Internet. It has two forms -- the first can be used when you want to have the 348Internet. It has two forms -- the first can be used when you want to have the
288actual URI displayed in the body text, such as this link to 349actual URI displayed in the body text, such as this link to
289<uri>http://www.gentoo.org</uri>. To create this link, I typed 350<uri>http://www.gentoo.org</uri>. To create this link, I typed
290<c>&lt;uri&gt;http://www.gentoo.org&lt;/uri&gt;</c>. The alternate form is 351<c>&lt;uri&gt;http://www.gentoo.org&lt;/uri&gt;</c>. The alternate form is
291when you want to associate a URI with some other text -- for example, <uri 352when you want to associate a URI with some other text -- for example, <uri
292link="http://www.gentoo.org">the Gentoo Linux website</uri>. To create <e>this</e> 353link="http://www.gentoo.org">the Gentoo Linux website</uri>. To create
293link, I typed <c>&lt;uri link="http://www.gentoo.org"&gt;the Gentoo Linux website&lt;/uri&gt;</c>. 354<e>this</e> link, I typed <c>&lt;uri link="http://www.gentoo.org"&gt;the
355Gentoo Linux website&lt;/uri&gt;</c>.
294</p> 356</p>
295 357
296</body> 358</body>
297</section> 359</section>
298
299<section> 360<section>
300<title>Figures</title> 361<title>Figures</title>
301 362
302<body> 363<body>
303 364
365<p>
304<p>Here's how to insert a figure into a document -- <c>&lt;figure 366Here's how to insert a figure into a document -- <c>&lt;figure
305link="mygfx.png" short="my picture" caption="my favorite picture of all 367link="mygfx.png" short="my picture" caption="my favorite picture of all
306time"/&gt;</c>. The <c>link=</c> attribute points to the actual graphic image, 368time"/&gt;</c>. The <c>link=</c> attribute points to the actual graphic image,
307the <c>short=</c> attribute specifies a short description (currently used for 369the <c>short=</c> attribute specifies a short description (currently used for
308the image's HTML <c>alt=</c> attribute), and a caption. Not too difficult 370the image's HTML <c>alt=</c> attribute), and a caption. Not too difficult
309:) We also support the standard HTML-style &lt;img src="foo.gif"/&gt; tag 371:) We also support the standard HTML-style &lt;img src="foo.gif"/&gt; tag
310for adding images without captions, borders, etc.</p> 372for adding images without captions, borders, etc.
373</p>
311 374
312</body> 375</body>
313</section> 376</section>
314<section> 377<section>
315<title>Tables and lists</title> 378<title>Tables and lists</title>
316<body> 379<body>
317 380
381<p>
318<p>Guide supports a simplified table syntax similar to that of HTML. To start 382Guide supports a simplified table syntax similar to that of HTML. To start
319a table, use a <c>&lt;table&gt;</c> tag. Start a row with a <c>&lt;tr&gt;</c> 383a table, use a <c>&lt;table&gt;</c> tag. Start a row with a <c>&lt;tr&gt;</c>
320tag. However, for inserting actual table data, we <e>don't</e> support the 384tag. However, for inserting actual table data, we <e>don't</e> support the
321HTML &lt;td&gt; tag; instead, use the <c>&lt;th&gt;</c> if you are inserting a 385HTML &lt;td&gt; tag; instead, use the <c>&lt;th&gt;</c> if you are inserting a
322header, and <c>&lt;ti&gt;</c> if you are inserting a normal informational 386header, and <c>&lt;ti&gt;</c> if you are inserting a normal informational
323block. You can use a <c>&lt;th&gt;</c> anywhere you can use a <c>&lt;ti&gt;</c> -- 387block. You can use a <c>&lt;th&gt;</c> anywhere you can use a <c>&lt;ti&gt;</c>
324there's no requirement that <c>&lt;th&gt;</c> elements appear only in the 388-- there's no requirement that <c>&lt;th&gt;</c> elements appear only in the
325first row. Currently, these tags don't support any attributes, but some will 389first row. Currently, these tags don't support any attributes, but some will
326be added (such as a <c>caption=</c> attribute for <c>&lt;table&gt;</c>) soon. 390be added (such as a <c>caption=</c> attribute for <c>&lt;table&gt;</c>) soon.
327</p> 391</p>
328 392
393<p>
329<p> To create ordered or unordered lists, simply use the HTML-style 394To create ordered or unordered lists, simply use the HTML-style
330<c>&lt;ol&gt;</c>, <c>&lt;ul&gt;</c> and <c>&lt;li&gt;</c> tags. List tags 395<c>&lt;ol&gt;</c>, <c>&lt;ul&gt;</c> and <c>&lt;li&gt;</c> tags. List tags
331should only appear inside a <c>&lt;p&gt;</c>, <c>&lt;ti&gt;</c>, 396should only appear inside a <c>&lt;body&gt;</c>, <c>&lt;ul&gt;</c> or
332<c>&lt;note&gt;</c>, <c>&lt;warn&gt;</c> or <c>&lt;impo&gt;</c> tag. </p> 397<c>&lt;ol&gt;</c> tag.
398</p>
333 399
334</body> 400</body>
335</section> 401</section>
336
337<section> 402<section>
338<title>Intra-document references</title> 403<title>Intra-document references</title>
339<body> 404<body>
340 405
406<p>
341<p>Guide makes it really easy to reference other parts of the document using 407Guide makes it really easy to reference other parts of the document using
342hyperlinks. You can create a link pointing to <uri link="#doc_chap1">Chapter 408hyperlinks. You can create a link pointing to <uri link="#doc_chap1">Chapter
343One</uri> by typing <c>&lt;uri link="#doc_chap1"&gt;Chapter 409One</uri> by typing <c>&lt;uri link="#doc_chap1"&gt;Chapter
344One&lt;/uri&gt;</c>. To point to <uri link="#doc_chap1_sect2">section two of 410One&lt;/uri&gt;</c>. To point to <uri link="#doc_chap1_sect2">section two of
345Chapter One</uri>, type <c>&lt;uri link="#doc_chap1_sect2"&gt;section two of 411Chapter One</uri>, type <c>&lt;uri link="#doc_chap1_sect2"&gt;section two of
346Chapter One&lt;/uri&gt;</c>. To refer to figure 3 in chapter 1, type <c>&lt;uri 412Chapter One&lt;/uri&gt;</c>. To refer to figure 3 in chapter 1, type <c>&lt;uri
347link="doc_chap1_fig3"&gt;figure 1.3&lt;/uri&gt;</c>. Or, to refer to <uri link="#doc_chap2_pre2">code listing 2 in chapter 2</uri>, 413link="doc_chap1_fig3"&gt;figure 1.3&lt;/uri&gt;</c>. Or, to refer to <uri
414link="#doc_chap2_pre2">code listing 2 in chapter 2</uri>, type <c>&lt;uri
348type <c>&lt;uri link="doc_chap2_pre2"&gt;code listing 2.2&lt;/uri&gt;</c>. We'll be 415link="doc_chap2_pre2"&gt;code listing 2.2&lt;/uri&gt;</c>. We'll be
349adding other auto-link abilities (such as table support) soon.</p> 416adding other auto-link abilities (such as table support) soon.
417</p>
418
419<p>
420However, some guides change often and using such "counting" can lead to broken
421links. In order to cope with this, you can define a name for a
422<c>&lt;chapter&gt;</c> or <c>&lt;section&gt;</c> by using the <c>id</c>
423attribute, and then point to that attribute, like this:
424</p>
425
426<pre caption="Using the id attribute">
427&lt;chapter id="foo"&gt;
428&lt;title&gt;This is foo!&lt;/title&gt;
429...
430&lt;p&gt;
431More information can be found in the &lt;uri link="#foo"&gt;foo chapter&lt;/uri&gt;
432&lt;/p&gt;
433</pre>
350 434
351</body> 435</body>
352</section> 436</section>
353</chapter> 437</chapter>
438
439<chapter>
440<title>Coding Style</title>
441<section>
442<title>Introduction</title>
443<body>
444
445<p>
446Since all Gentoo Documentation is a joint effort and several people will
447most likely change existing documentation, a coding style is needed.
448A coding style contains two sections. The first one is regarding
449internal coding - how the xml-tags are placed. The second one is
450regarding the content - how not to confuse the reader.
451</p>
452
453<p>
454Both sections are described next.
455</p>
456
457</body>
458</section>
459<section>
460<title>Internal Coding Style</title>
461<body>
462
463<p>
464<b>Newlines</b> must be placed immediately after <e>every</e>
465GuideXML-tag (both opening as closing), except for:
466<c>&lt;version&gt;</c>, <c>&lt;date&gt;</c>, <c>&lt;title&gt;</c>,
467<c>&lt;th&gt;</c>, <c>&lt;ti&gt;</c>,
468<c>&lt;li&gt;</c>, <c>&lt;i&gt;</c>, <c>&lt;e&gt;</c>,
469<c>&lt;uri&gt;</c>, <c>&lt;path&gt;</c>, <c>&lt;b&gt;</c>,
470<c>&lt;comment&gt;</c>, <c>&lt;codenote&gt;</c>, <c>&lt;mail&gt;</c>.
471</p>
472
473<p>
474<b>Blank lines</b> must be placed immediately after <e>every</e>
475<c>&lt;body&gt;</c> (opening tag only) and before <e>every</e>
476<c>&lt;chapter&gt;</c>, <c>&lt;p&gt;</c>, <c>&lt;table&gt;</c>,
477<c>&lt;author&gt;</c> (set), <c>&lt;pre&gt;</c>, <c>&lt;ul&gt;</c>,
478<c>&lt;ol&gt;</c>, <c>&lt;warn&gt;</c>, <c>&lt;note&gt;</c> and
479<c>&lt;impo&gt;</c> (opening tags only).
480</p>
481
482<p>
483<b>Word-wrapping</b> must be applied at 80 characters except inside
484<c>&lt;pre&gt;</c>. Only when there is no other choice can be deviated from
485this rule (for instance when a URL exceeds the maximum amount of characters).
486The editor must then wrap whenever the first whitespace occurs.
487</p>
488
489<p>
490<b>Indentation</b> may not be used, except with the XML-constructs of which
491the parent XML-tags are <c>&lt;tr&gt;</c> (from <c>&lt;table&gt;</c>),
492<c>&lt;ul&gt;</c>, <c>&lt;ol&gt;</c> and <c>&lt;author&gt;</c>. If indentation
493is used, it <e>must</e> be two spaces for each indentation. That means <e>no</e>
494tabs and <e>not</e> more spaces.
495</p>
496
497<p>
498In case word-wrapping happens in <c>&lt;ti&gt;</c>, <c>&lt;th&gt;</c> or
499<c>&lt;li&gt;</c> constructs, indentation must be used for the content.
500</p>
501
502<p>
503An example for indentation is:
504</p>
505
506<pre caption = "Indentation Example">
507&lt;table&gt;
508&lt;tr&gt;
509 &lt;th&gt;Foo&lt;/th&gt;
510 &lt;th&gt;Bar&lt;/th&gt;
511&lt;/tr&gt;
512&lt;tr&gt;
513 &lt;ti&gt;This is an example for indentation.&lt;/ti&gt;
514 &lt;ti&gt;
515 In case text cannot be shown within an 80-character wide line, you
516 must use indentation if the parent tag allows it.
517 &lt;/ti&gt;
518&lt;/tr&gt;
519&lt;/table&gt;
520
521&lt;ul&gt;
522 &lt;li&gt;First option&lt;/li&gt;
523 &lt;li&gt;Second option&lt;/li&gt;
524&lt;/ul&gt;
525</pre>
526
527<p>
528<b>Attributes</b> may not have spaces in between the attribute, the
529&quot;=&quot; mark, and the attribute value. As an example:
530</p>
531
532<pre caption="Attributes">
533<comment>Wrong :</comment> &lt;pre caption = "Attributes"&gt;
534<comment>Correct:</comment> &lt;pre caption="Attributes"&gt;
535</pre>
536
537</body>
538</section>
539<section>
540<title>External Coding Style</title>
541<body>
542
543<p>
544Inside tables (<c>&lt;table&gt;</c>) and listings (<c>&lt;ul&gt;</c> and
545<c>&lt;ol&gt;</c>), periods (&quot;.&quot;) should not be used unless multiple
546sentences are used. In that case, every sentence should end with a period (or
547other reading marks).
548</p>
549
550<p>
551Every sentence, including those inside tables and listings, should start
552with a capital letter.
553</p>
554
555<pre caption="Periods and capital letters">
556&lt;ul&gt;
557 &lt;li&gt;No period&lt;/li&gt;
558 &lt;li&gt;With period. Multiple sentences, remember?&lt;/li&gt;
559&lt;/ul&gt;
560</pre>
561
562<p>
563Code Listings should <e>always</e> have a <c>caption</c>.
564</p>
565
566<p>
567Try to use <c>&lt;uri&gt;</c> with the <c>link</c> attribute as much as
568possible. In other words, the <uri link="http://www.gentoo.org">Gentoo
569Website</uri> is preferred over <uri>http://www.gentoo.org</uri>.
570</p>
571
572<p>
573When you comment something inside a <c>&lt;pre&gt;</c> construct, only use
574<c>&lt;codenote&gt;</c> if the content is a C or C++ code snippet. Otherwise,
575use <c>&lt;comment&gt;</c> and parantheses. Also place the comment <e>before</e>
576the subject of the comment.
577</p>
578
579<pre caption="Comment example">
580<comment>(Substitute "john" with your user name)</comment>
581# <i>id john</i>
582</pre>
583
584</body>
585</section>
586</chapter>
587
588<chapter>
589<title>Handbook Format</title>
590<section>
591<title>Guide vs Book</title>
592<body>
593
594<p>
595For high-volume documentation, such as the <uri
596link="/doc/en/handbook/handbook-x86.xml?part=1">Installation Instructions</uri>, a
597broader format was needed. We designed a GuideXML-compatible enhancement that
598allows us to write modular and multi-page documentation.
599</p>
600
601</body>
602</section>
603<section>
604<title>Main File</title>
605<body>
606
607<p>
608The first change is the need for a "master" document. This document contains no
609real content, but links to the individual documentation modules. The syntaxis
610doesn't differ much from GuideXML:
611</p>
612
613<pre caption="Example book usage">
614&lt;?xml version='1.0' encoding='UTF-8'?&gt;
615&lt;!DOCTYPE book SYSTEM "/dtd/book.dtd"&gt;
616
617&lt;<i>book</i> link="example.xml"&gt;
618&lt;title&gt;Example Book Usage&lt;/title&gt;
619
620&lt;author...&gt;
621 ...
622&lt;/author&gt;
623
624&lt;abstract&gt;
625 ...
626&lt;/abstract&gt;
627
628&lt;!-- The content of this document is licensed under the CC-BY-SA license --&gt;
629&lt;!-- See http://creativecommons.org/licenses/by-sa/2.0 --&gt;
630&lt;license/&gt;
631
632&lt;version&gt;...&lt;/version&gt;
633&lt;date&gt;...&lt;/date&gt;
634</pre>
635
636<p>
637So far no real differences (except for the <c>&lt;book&gt;</c> instead of
638<c>&lt;guide&gt;</c> tag). Instead of starting with the individual
639<c>&lt;chapter&gt;</c>'s, you define a <c>&lt;part&gt;</c>, which is the
640equivalent of a separate part in a book:
641</p>
642
643<pre caption="Defining a part">
644&lt;part&gt;
645&lt;title&gt;Part One&lt;/title&gt;
646&lt;abstract&gt;
647 ...
648&lt;/abstract&gt;
649
650<comment>(Defining the several chapters)</comment>
651&lt;/part&gt;
652</pre>
653
654<p>
655Each part is accompanied by a <c>&lt;title&gt;</c> and an
656<c>&lt;abstract&gt;</c> which gives a small introduction to the part.
657</p>
658
659<p>
660Inside each part, you define the individual <c>&lt;chapter&gt;</c>'s. Each
661chapter <e>must</e> be a separate document. As a result it is no surprise that a
662special tag (<c>&lt;include&gt;</c>) is added to allow including the separate
663document.
664</p>
665
666<pre caption="Defining a chapter">
667&lt;chapter&gt;
668&lt;title&gt;Chapter One&lt;/title&gt;
669&lt;abstract&gt;
670 This is a small explanation on chapter one.
671&lt;/abstract&gt;
672
673 &lt;include href="path/to/chapter-one.xml"/&gt;
674
675&lt;/chapter&gt;
676</pre>
677
678</body>
679</section>
680<section>
681<title>Designing the Individual Chapters</title>
682<body>
683
684<p>
685The content of an individual chapter is structured as follows:
686</p>
687
688<pre caption="Chapter Syntax">
689&lt;?xml version='1.0' encoding='UTF-8'?&gt;
690&lt;!DOCTYPE sections SYSTEM "/dtd/book.dtd"&gt;
691
692&lt;!-- The content of this document is licensed under the CC-BY-SA license --&gt;
693&lt;!-- See http://creativecommons.org/licenses/by-sa/2.0 --&gt;
694
695&lt;sections&gt;
696
697<comment>(Define the several &lt;section&gt; and &lt;subsection&gt;)</comment>
698
699&lt;/sections&gt;
700</pre>
701
702<p>
703Inside each chapter you can define <c>&lt;section&gt;</c>'s (equivalent of
704<c>&lt;chapter&gt;</c> in a Guide) and <c>&lt;subsection&gt;</c>'s (equivalent
705of <c>&lt;section&gt;</c> in a Guide).
706</p>
707
708</body>
709</section>
710</chapter>
711
354<chapter> 712<chapter>
355<title>Resources</title> 713<title>Resources</title>
356<section> 714<section>
357 <title>Start writing</title> 715<title>Start writing</title>
358 <body> 716<body>
717
718<p>
359 <p>Guide has been specially designed to be "lean and mean" so that developers 719Guide has been specially designed to be "lean and mean" so that developers
360 can spend more time writing documentation and less time learning the actual XML 720can spend more time writing documentation and less time learning the actual XML
361 syntax. Hopefully, this will allow developers who aren't unusually "doc-savvy" 721syntax. Hopefully, this will allow developers who aren't unusually "doc-savvy"
362 to start writing quality Gentoo Linux documentation. If you'd like to help (or have any questions about guide), please 722to start writing quality Gentoo Linux documentation. If you'd like to help (or
363 post a message to <mail link="gentoo-dev@gentoo.org">the gentoo-dev mailing list</mail> 723have any questions about guide), please post a message to the <mail
364 stating what you'd like to tackle. 724link="gentoo-doc@gentoo.org">gentoo-doc mailing list</mail> stating what you'd
365 Have fun!</p> 725like to tackle. Have fun!
726</p>
727
366 </body> 728</body>
367</section> 729</section>
368</chapter> 730</chapter>
369</guide> 731</guide>
370 732

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.33

  ViewVC Help
Powered by ViewVC 1.1.20