/[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.18
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"?>
3
4<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
5 3
6<guide link="/doc/en/xml-guide.xml"> 4<guide link="/doc/en/xml-guide.xml">
7<title>Gentoo Linux Documentation Guide</title> 5<title>Gentoo Linux XML Guide</title>
8<author title="Chief Architect"><mail link="drobbins@gentoo.org">Daniel Robbins</mail></author>
9 6
7<author title="Author">
8 <mail link="drobbins@gentoo.org">Daniel Robbins</mail>
9</author>
10<author title="Author">
11 <mail link="zhen@gentoo.org">John P. Davis</mail>
12</author>
13<author title="Editor">
14 <mail link="peesh@gentoo.org">Jorge Paulo</mail>
15</author>
16
17<license/>
18<abstract>
10<abstract>This guide shows you how to compose web documentation using the new lightweight Gentoo guide 19This 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 20Gentoo 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. 21documentation, and this document itself was created using GuideXML. This guide
22assumes a basic working knowledge of XML and HTML.
13</abstract> 23</abstract>
14 24
15<version>1.0</version> 25<version>2.2</version>
16<date>07 Mar 2002</date> 26<date>October 15, 2003</date>
17 27
18<chapter> 28<chapter>
19<title>Guide basics</title> 29<title>Guide basics</title>
20
21<section> 30<section>
22<title>Guide XML design goals</title> 31<title>Guide XML design goals</title>
23<body> 32<body>
24 33
34<p>
25<p> The guide XML syntax is lightweight yet expressive, so that it is easy to 35The 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 36learn 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. 37documentation. 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 38This makes it easy to transform guide into other formats, such as DocBook
29XML/SGML or web-ready HTML. </p> 39XML/SGML or web-ready HTML.
40</p>
30 41
42<p>
31<p>The goal is to make it easy to <e>create</e> and <e>transform</e> guide XML 43The goal is to make it easy to <e>create</e> and <e>transform</e> guide XML
32documents.</p> 44documents.
45</p>
33 46
34</body> 47</body>
35</section> 48</section>
36
37<section> 49<section>
38<title>How to transform guide XML into HTML</title> 50<title>How to transform guide XML into HTML</title>
39<body> 51<body>
40 52
53<p>
41<p> Before we take a look at the guide syntax itself, it's helpful to know how 54Before 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 55guide 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 56file called <path>guide.xsl</path>, along with a command-line XSLT processing
44tool (also called an "engine"). The <path>guide-main.xsl</path> file describes 57tool (also called an "engine"). The <path>guide.xsl</path> file describes
45exactly how to transform the contents of the source guide XML document to 58exactly 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> 59create the target HTML file. The processing tool that Gentoo Linux uses
47(included in the <path>app-text/sablotron</path> package) and <c>xsltproc</c> 60is called <c>xsltproc</c>, which is found in the <i>libxslt</i> package.
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> 61</p>
64 62
63<pre caption="Installing libxslt">
64# <i>emerge libxslt</i>
65<pre> 65</pre>
66# <i>cd gentoo-web/xsl</i> 66
67<p>
68Now that we have the way, we need the means, so to speak. In other words,
69we need some Gentoo XML documents to transform. Gentoo has two types of tarballs
70that are available for download:
71</p>
72
73<p>
74<b>The first type contains the entire up-to-date Gentoo Linux website</b>.
75Included are our XSL templates, so if you are planning to transform any
76documentation, you will need this tarball. The tarball can be found <uri
77link="http://www.gentoo.org/dyn/arch/xml-guide-latest.tar.gz">here</uri>.
78</p>
79
80<p>
81<b>The second type contains daily snapshots our XML documentation source</b>
82in every language that we offer. Please note that it is impossible to transform
83documentation with this tarball, so please download the web tarball if you want
84to fully develop your own documentation. These tarballs are especially useful
85for translators. These tarballs can be found <uri
86link="http://www.gentoo.org/dyn/doc-snapshots">here</uri>.
87</p>
88
89<p>
90After the web tarball is downloaded and extracted, go to the directory where
91the tarball was extracted, and enter the <path>htdocs</path> directory. Browse
92around and get comfortable with the layout, but note the <path>xsl</path> and
93<path>doc</path> directories. As you might have guessed, the XSL stylesheets are
94in <path>xsl</path>, and our documentation is in <path>doc</path>. For testing
95purposes, we will be using the Gentoo Linux CD Installation Guide, located at
96<path>doc/en/gentoo-x86-install.xml</path>. Now that the locations of the XSL
97and XML file are known, we can do some transforming with <c>xsltproc</c>.
98</p>
99
100<pre caption="Transforming gentoo-x86-install.xml">
67# <i>xsltproc guide-main.xsl ../xml/install.xml &gt; /tmp/install.html</i> 101# <i>xsltproc xsl/guide.xsl doc/en/gentoo-x86-install.xml &gt; /tmp/install.html</i>
68</pre> 102</pre>
69 103
104<p>
70<p> If all went well, you should have a web-ready version of 105If 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 106<path>gentoo-x86-install.xml</path> at <path>/tmp/install.html</path>. For
72to display properly in a web browser, you may have to copy some files from 107this document to display properly in a web browser, you may have to copy some
73<path>gentoo-web</path> to <path>/tmp</path>, such 108files from <path>htdocs</path> to <path>/tmp</path>, such as
74as <path>css/main-new.css</path> and (to be safe) the entire <path>images</path> 109<path>css/main.css</path> and (to be safe) the entire <path>images</path>
75directory. 110directory.
76</p> 111</p>
77 112
78</body> 113</body>
79</section> 114</section>
80</chapter> 115</chapter>
116
81<chapter> 117<chapter>
82 <title>Guide XML</title> 118<title>Guide XML</title>
83<section> 119<section>
84<title>Basic structure</title> 120<title>Basic structure</title>
85<body> 121<body>
86 122
123<p>
87<p>Now that you know how to transform guide XML, you're ready to start learning 124Now 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 125the GuideXML syntax. We'll start with the the initial tags used in a guide
89XML document: </p> 126XML document:
127</p>
90 128
91<pre caption="The initial part of a guide XML document"> 129<pre caption="The initial part of a guide XML document">
92&lt;?xml version='1.0'?&gt; 130&lt;?xml version='1.0' encoding="UTF-8"?&gt;
93&lt;guide&gt; 131&lt;guide link="relative_link_to_your_guide"&gt;
94&lt;title&gt;<i>Gentoo Linux Documentation Guide</i>&lt;/title&gt; 132&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; 133&lt;author title="<i>Chief Architect</i>"&gt;
96 <i>Daniel Robbins</i>&lt;/mail&gt; 134 &lt;mail link="<i>drobbins@gentoo.org</i>"&gt;<i>Daniel Robbins</i>&lt;/mail&gt;
97&lt;/author&gt; 135&lt;/author&gt;
98&lt;author title="<i>Editor</i>"&gt;&lt;mail link="<i>thomasfl@gentoo.org</i>"&gt; 136&lt;author title="<i>Editor</i>"&gt;
99 <i>Thomas Flavel</i>&lt;/mail&gt; 137 &lt;mail link="<i>thomasfl@gentoo.org</i>"&gt;<i>Thomas Flavel</i>&lt;/mail&gt;
100&lt;/author&gt; 138&lt;/author&gt;
101 139
140&lt;abstract&gt;
102&lt;abstract&gt;<i>This guide shows you how to compose web documentation using 141<i>This guide shows you how to compose web documentation using
103our new lightweight Gentoo guide XML syntax. This syntax is the official 142our new lightweight Gentoo GuideXML syntax. This syntax is the official
104format for Gentoo Linux web documentation, and this document itself was created 143format for Gentoo Linux web documentation, and this document itself was created
105using guide XML.</i> &lt;/abstract&gt; 144using GuideXML.</i>
145&lt;/abstract&gt;
146
147&lt;license/&gt;
106 148
107&lt;version&gt;<i>1.0</i>&lt;/version&gt; 149&lt;version&gt;<i>1.0</i>&lt;/version&gt;
108&lt;date&gt;<i>29 Mar 2001</i>&lt;/date&gt; 150&lt;date&gt;<i>29 Mar 2001</i>&lt;/date&gt;
109</pre> 151</pre>
110 152
153<p>
111<p>On the first, line, we see the requisite tag that identifies this as an XML 154On 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 155document. 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. 156guide 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 157Next, there's a <c>&lt;title&gt;</c> tag, used to set the title for the entire
115guide document. </p> 158guide document.
159</p>
116 160
161<p>
117<p>Then, we come to the <c>&lt;author&gt;</c> tags, which contain information 162Then, 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 163about 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 164allows for an optional <c>title=</c> element, used to specify the author's
120relationship to the document (author, co-author, editor, etc.). In this 165relationship to the document (author, co-author, editor, etc.). In this
121particular example, the authors' names are enclosed in another tag -- a 166particular 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 167<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 168person. 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. 169more than one <c>&lt;author&gt;</c> element is required per guide document.
125</p> 170</p>
126 171
172<p>
127<p>Next, we come to the <c>&lt;abstract&gt;</c>, <c>&lt;version&gt;</c> and 173Next, 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 174<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) 175current 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 176respectively. 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> 177a 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 178tags, 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 179<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> 180required) that these tags appear before the content of the document.
181</p>
135 182
136</body> 183<p>
137</section> 184Finally we have the <c>&lt;license/&gt;</c> tag, used to publish the
185document under the <uri link="http://creativecommons.org/licenses/by-sa/1.0/">Creative
186Commons - Attribution / Share Alike</uri> license as required by the <uri
187link="/doc/en/doc-policy.xml">Documentation Policy</uri>.
188</p>
138 189
190</body>
191</section>
139<section> 192<section>
140<title>Chapters and sections</title> 193<title>Chapters and sections</title>
141<body> 194<body>
195
196<p>
142<p>Once the initial tags have been specified, you're ready to start adding 197Once the initial tags have been specified, you're ready to start adding
143the structural elements of the document. Guide documents are divided into 198the structural elements of the document. Guide documents are divided into
144chapters, and each chapter can hold one or more sections. Every chapter 199chapters, 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, 200and 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 201consisting 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 202excerpt</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: 203(if minimal) guide document:
149</p> 204</p>
150 205
151<pre> 206<pre>
152&lt;chapter&gt; 207&lt;chapter&gt;
153&lt;title&gt;<i>This is my chapter</i>&lt;/title&gt; 208&lt;title&gt;<i>This is my chapter</i>&lt;/title&gt;
154&lt;section&gt; 209&lt;section&gt;
155 &lt;title&gt;<i>This is section one of my chapter</i>&lt;/title&gt; 210&lt;title&gt;<i>This is section one of my chapter</i>&lt;/title&gt;
156 &lt;body&gt; 211&lt;body&gt;
212
213&lt;p&gt;
157 &lt;p&gt;<i>This is the actual text content of my section.</i>&lt;/p&gt; 214<i>This is the actual text content of my section.</i>
215&lt;/p&gt;
216
158 &lt;/body&gt; 217&lt;/body&gt;
159&lt;/section&gt; 218&lt;/section&gt;
160&lt;/chapter&gt; 219&lt;/chapter&gt;
161</pre> 220</pre>
162 221
222<p>
163<p>Above, I set the chapter title by adding a child <c>&lt;title&gt;</c> 223Above, 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 224element 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 225adding 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 226<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> 227<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 228is 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 229content 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> 230inside a <c>&lt;body&gt;</c> element in a bit.
231</p>
171 232
233<note>
172<note>A <c>&lt;guide&gt;</c> element can contain multiple 234A <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 235elements, and a <c>&lt;chapter&gt;</c> can contain multiple
174multiple <c>&lt;section&gt;</c> elements. However, a <c>&lt;section&gt;</c> 236<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> 237element can only contain one <c>&lt;body&gt;</c> element.
238</note>
176 239
177</body> 240</body>
178</section> 241</section>
179
180<section> 242<section>
181<title>An example &lt;body&gt;</title> 243<title>An example &lt;body&gt;</title>
182<body> 244<body>
245
183<p> 246<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: 247Now, 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> 248</p>
249
186<pre> 250<pre>
187&lt;p&gt; 251&lt;p&gt;
188This is a paragraph. &lt;path&gt;/etc/passwd&lt;/path&gt; is a file. 252This 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. 253&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. 254Type &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: 261Make HTML/XML easier to read by using selective emphasis:
198&lt;foo&gt;&lt;i&gt;bar&lt;/i&gt;&lt;/foo&gt; 262&lt;foo&gt;&lt;i&gt;bar&lt;/i&gt;&lt;/foo&gt;
199 263
200&lt;codenote&gt;This is how to insert an inline note into the code block&lt;/codenote&gt; 264&lt;codenote&gt;This is how to insert an inline note into the code block&lt;/codenote&gt;
201&lt;/pre&gt; 265&lt;/pre&gt;
202&lt;note&gt;This is a note.&lt;/note&gt; 266
203&lt;warn&gt;This is a warning.&lt;/warn&gt; 267&lt;note&gt;
204&lt;impo&gt;This is important.&lt;/impo&gt; 268This is a note.
269&lt;/note&gt;
270
271&lt;warn&gt;
272This is a warning.
273&lt;/warn&gt;
274
275&lt;impo&gt;
276This is important.
277&lt;/impo&gt;
205</pre> 278</pre>
279
280<p>
206<p>Now, here's how this <c>&lt;body&gt;</c> element is rendered:</p> 281Now, here's how this <c>&lt;body&gt;</c> element is rendered:
282</p>
207 283
208<p> 284<p>
209This is a paragraph. <path>/etc/passwd</path> is a file. 285This is a paragraph. <path>/etc/passwd</path> is a file.
210<uri>http://www.gentoo.org</uri> is my favorite website. 286<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. 287Type <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: 294Make HTML/XML easier to read by using selective emphasis:
219&lt;foo&gt;<i>bar</i>&lt;/foo&gt; 295&lt;foo&gt;<i>bar</i>&lt;/foo&gt;
220 296
221<codenote>This is how to insert an inline note into the code block</codenote> 297<codenote>This is how to insert an inline note into the code block</codenote>
222</pre> 298</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 299
300<note>
301This is a note.
302</note>
303
304<warn>
305This is a warning.
306</warn>
307
308<impo>
309This is important.
310</impo>
311
312</body>
313</section>
229<section> 314<section>
230<title>The &lt;body&gt; tags</title> 315<title>The &lt;body&gt; tags</title>
231<body> 316<body>
232 317
318<p>
233<p> We introduced a lot of new tags in the previous section -- here's what you 319We 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 320need 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 321block), <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. 322<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), 323Besides 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 324these 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 325<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 326stacked -- 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 327<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> 328preserves its whitespace exactly, making it well-suited for code excerpts.
329You can also name the <c>&lt;pre&gt;</c> tag:
330</p>
331
332<pre caption = "Named &lt;pre&gt;">
333&lt;pre caption = "Output of uptime"&gt;
334# &lt;i&gt;uptime&lt;/i&gt;
33516:50:47 up 164 days, 2:06, 5 users, load average: 0.23, 0.20, 0.25
336&lt;/pre&gt;
337</pre>
243 338
244</body> 339</body>
245</section> 340</section>
246<section> 341<section>
247<title>&lt;path&gt;, &lt;c&gt; and &lt;e&gt;</title> 342<title>&lt;path&gt;, &lt;c&gt; and &lt;e&gt;</title>
248<body> 343<body>
249 344
345<p>
250<p>The <c>&lt;path&gt;</c>, <c>&lt;c&gt;</c> and <c>&lt;e&gt;</c> elements can 346The <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 347be used inside any child <c>&lt;body&gt;</c> tag, except for
252<c>&lt;pre&gt;</c>. </p> 348<c>&lt;pre&gt;</c>.
349</p>
253 350
351<p>
254<p>The <c>&lt;path&gt;</c> element is used to mark text that refers to an 352The <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>. 353<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 354<e>simple filename</e>. This element is generally rendered with a monospaced
257standard paragraph type. </p> 355font to offset it from the standard paragraph type.
356</p>
258 357
358<p>
259<p>The <c>&lt;c&gt;</c> element is used to mark up a <e>command</e> or <e>user 359The <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 360input</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 361that 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> 362the 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 363element 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 364not 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 365quickly 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 366<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 367necessary 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 368refer 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> 369the use of unnecessary double-quotes makes a document more readable -- and
370adorable!
371</p>
270 372
373<p>
271<p><c>&lt;e&gt;</c> is used to apply emphasis to a word or phrase; for example: 374<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 375I <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 376offset from the regular paragraph type for emphasis. This helps to give your
274prose more <e>punch</e>!</p> 377prose more <e>punch</e>!
378</p>
275 379
276</body> 380</body>
277</section> 381</section>
278
279<section> 382<section>
280<title>&lt;mail&gt; and &lt;uri&gt;</title> 383<title>&lt;mail&gt; and &lt;uri&gt;</title>
281<body> 384<body>
282 385
386<p>
283<p>We've taken a look at the <c>&lt;mail&gt;</c> tag earlier; it's used to link some text 387We'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> 388some text with a particular email address, and takes the form <c>&lt;mail
389link="foo@bar.com"&gt;Mr. Foo Bar&lt;/mail&gt;</c>.
390</p>
285 391
392<p>
286<p>The <c>&lt;uri&gt;</c> tag is used to point to files/locations on the 393The <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 394Internet. 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 395actual URI displayed in the body text, such as this link to
289<uri>http://www.gentoo.org</uri>. To create this link, I typed 396<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 397<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 398when 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> 399link="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>. 400<e>this</e> link, I typed <c>&lt;uri link="http://www.gentoo.org"&gt;the
401Gentoo Linux website&lt;/uri&gt;</c>.
294</p> 402</p>
295 403
296</body> 404</body>
297</section> 405</section>
298
299<section> 406<section>
300<title>Figures</title> 407<title>Figures</title>
301 408
302<body> 409<body>
303 410
411<p>
304<p>Here's how to insert a figure into a document -- <c>&lt;figure 412Here's how to insert a figure into a document -- <c>&lt;figure
305link="mygfx.png" short="my picture" caption="my favorite picture of all 413link="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, 414time"/&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 415the <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 416the 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 417:) We also support the standard HTML-style &lt;img src="foo.gif"/&gt; tag
310for adding images without captions, borders, etc.</p> 418for adding images without captions, borders, etc.
419</p>
311 420
312</body> 421</body>
313</section> 422</section>
314<section> 423<section>
315<title>Tables and lists</title> 424<title>Tables and lists</title>
316<body> 425<body>
317 426
427<p>
318<p>Guide supports a simplified table syntax similar to that of HTML. To start 428Guide 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> 429a 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 430tag. 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 431HTML &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 432header, 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> -- 433block. 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 434-- 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 435first 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. 436be added (such as a <c>caption=</c> attribute for <c>&lt;table&gt;</c>) soon.
327</p> 437</p>
328 438
439<p>
329<p> To create ordered or unordered lists, simply use the HTML-style 440To 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 441<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>, 442should only appear inside a <c>&lt;p&gt;</c>, <c>&lt;ti&gt;</c>,
332<c>&lt;note&gt;</c>, <c>&lt;warn&gt;</c> or <c>&lt;impo&gt;</c> tag. </p> 443<c>&lt;note&gt;</c>, <c>&lt;warn&gt;</c> or <c>&lt;impo&gt;</c> tag.
444</p>
333 445
334</body> 446</body>
335</section> 447</section>
336
337<section> 448<section>
338<title>Intra-document references</title> 449<title>Intra-document references</title>
339<body> 450<body>
340 451
452<p>
341<p>Guide makes it really easy to reference other parts of the document using 453Guide 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 454hyperlinks. You can create a link pointing to <uri link="#doc_chap1">Chapter
343One</uri> by typing <c>&lt;uri link="#doc_chap1"&gt;Chapter 455One</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 456One&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 457Chapter 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 458Chapter 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>, 459link="doc_chap1_fig3"&gt;figure 1.3&lt;/uri&gt;</c>. Or, to refer to <uri
460link="#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 461link="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> 462adding other auto-link abilities (such as table support) soon.
463</p>
350 464
351</body> 465</body>
352</section> 466</section>
353</chapter> 467</chapter>
468
469<chapter>
470<title>Coding Style</title>
471<section>
472<title>Introduction</title>
473<body>
474
475<p>
476Since all Gentoo Documentation is a joint effort and several people will
477most likely change existing documentation, a coding style is needed.
478A coding style contains two sections. The first one is regarding
479internal coding - how the xml-tags are placed. The second one is
480regarding the content - how not to confuse the reader.
481</p>
482
483<p>
484Both sections are described next.
485</p>
486
487</body>
488</section>
489<section>
490<title>Internal Coding Style</title>
491<body>
492
493<p>
494<b>Newlines</b> must be placed immediately after <e>every</e>
495GuideXML-tag (both opening as closing), except for:
496<c>&lt;version&gt;</c>, <c>&lt;date&gt;</c>, <c>&lt;title&gt;</c>,
497<c>&lt;th&gt;</c>, <c>&lt;ti&gt;</c>,
498<c>&lt;li&gt;</c>, <c>&lt;i&gt;</c>, <c>&lt;e&gt;</c>,
499<c>&lt;uri&gt;</c>, <c>&lt;path&gt;</c>, <c>&lt;b&gt;</c>,
500<c>&lt;comment&gt;</c>, <c>&lt;codenote&gt;</c>, <c>&lt;mail&gt;</c>.
501</p>
502
503<p>
504<b>Blank lines</b> must be placed immediately after <e>every</e>
505<c>&lt;body&gt;</c> (opening tag only) and before <e>every</e>
506<c>&lt;chapter&gt;</c>, <c>&lt;p&gt;</c>, <c>&lt;table&gt;</c>,
507<c>&lt;author&gt;</c> (set), <c>&lt;pre&gt;</c>, <c>&lt;ul&gt;</c>,
508<c>&lt;ol&gt;</c>, <c>&lt;warn&gt;</c>, <c>&lt;note&gt;</c> and
509<c>&lt;impo&gt;</c> (opening tags only).
510</p>
511
512<p>
513<b>Word-wrapping</b> must be applied at 80 characters except inside
514<c>&lt;pre&gt;</c>. Only when there is no other choice can be deviated from
515this rule (for instance when a URL exceeds the maximum amount of characters).
516The editor must then wrap whenever the first whitespace occurs.
517</p>
518
519<p>
520<b>Indentation</b> may not be used, except with the XML-constructs of which
521the parent XML-tags are <c>&lt;tr&gt;</c> (from <c>&lt;table&gt;</c>),
522<c>&lt;ul&gt;</c> and <c>&lt;ol&gt;</c>. If indentation is used, it
523<e>must</e> be two spaces for each indentation. That means <e>no</e> tabs and
524<e>not</e> more spaces.
525</p>
526
527<p>
528In case word-wrapping happens in <c>&lt;ti&gt;</c>, <c>&lt;th&gt;</c> or
529<c>&lt;li&gt;</c> constructs, indentation must be used for the content.
530</p>
531
532<p>
533An example for indentation is:
534</p>
535
536<pre caption = "Indentation Example">
537&lt;table&gt;
538&lt;tr&gt;
539 &lt;th&gt;Foo&lt;/th&gt;
540 &lt;th&gt;Bar&lt;/th&gt;
541&lt;/tr&gt;
542&lt;tr&gt;
543 &lt;ti&gt;This is an example for indentation.&lt;/ti&gt;
544 &lt;ti&gt;
545 In case text cannot be shown within an 80-character wide line, you
546 must use indentation if the parent tag allows it.
547 &lt;/ti&gt;
548&lt;/tr&gt;
549&lt;/table&gt;
550
551&lt;ul&gt;
552 &lt;li&gt;First option&lt;/li&gt;
553 &lt;li&gt;Second option&lt;/li&gt;
554&lt;/ul&gt;
555</pre>
556
557<p>
558<b>Attributes</b> may not have spaces in between the attribute, the
559&quot;=&quot; mark, and the attribute value. As an example:
560</p>
561
562<pre caption="Attributes">
563<comment>Wrong :</comment> &lt;pre caption = "Attributes"&gt;
564<comment>Correct:</comment> &lt;pre caption="Attributes"&gt;
565</pre>
566
567</body>
568</section>
569<section>
570<title>External Coding Style</title>
571<body>
572
573<p>
574Inside tables (<c>&lt;table&gt;</c>) and listings (<c>&lt;ul&gt;</c> and
575<c>&lt;ol&gt;</c>), periods (&quot;.&quot;) should not be used unless multiple
576sentences are used. In that case, every sentence should end with a period (or
577other reading marks).
578</p>
579
580<p>
581Every sentence, including those inside tables and listings, should start
582with a capital letter.
583</p>
584
585<pre caption="Periods and capital letters">
586&lt;ul&gt;
587 &lt;li&gt;No period&lt;/li&gt;
588 &lt;li&gt;With period. Multiple sentences, remember?&lt;/li&gt;
589&lt;/ul&gt;
590</pre>
591
592<p>
593Code Listings should <e>always</e> have a <c>caption</c>.
594</p>
595
596<p>
597Try to use <c>&lt;uri&gt;</c> with the <c>link</c> attribute as much as
598possible. In other words, the <uri link="http://www.gentoo.org">Gentoo
599Website</uri> is preferred over <uri>http://www.gentoo.org</uri>.
600</p>
601
602<p>
603When you comment something inside a <c>&lt;pre&gt;</c> construct, only use
604<c>&lt;codenote&gt;</c> if the content is a C or C++ code snippet. Otherwise,
605use <c>&lt;comment&gt;</c> and parantheses. Also place the comment <e>before</e>
606the subject of the comment.
607</p>
608
609<pre caption="Comment example">
610<comment>(Substitute "john" with your user name)</comment>
611# <i>id john</i>
612</pre>
613
614</body>
615</section>
616</chapter>
617
354<chapter> 618<chapter>
355<title>Resources</title> 619<title>Resources</title>
356<section> 620<section>
357 <title>Start writing</title> 621<title>Start writing</title>
358 <body> 622<body>
623
624<p>
359 <p>Guide has been specially designed to be "lean and mean" so that developers 625Guide 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 626can 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" 627syntax. 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 628to 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> 629have any questions about guide), please post a message to the <mail
364 stating what you'd like to tackle. 630link="gentoo-doc@gentoo.org">gentoo-doc mailing list</mail> stating what you'd
365 Have fun!</p> 631like to tackle. Have fun!
632</p>
633
366 </body> 634</body>
367</section> 635</section>
368</chapter> 636</chapter>
369</guide> 637</guide>
370 638

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

  ViewVC Help
Powered by ViewVC 1.1.20