| 1 | <?xml version="1.0" encoding="UTF-8"?> |
1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/xml-guide.xml,v 1.66 2006/11/29 15:48:57 nightmorph Exp $ --> |
2 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/xml-guide.xml,v 1.68 2008/03/09 13:13:15 neysx Exp $ --> |
| 3 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
3 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
| 4 | |
4 | |
| 5 | <guide link="/doc/en/xml-guide.xml"> |
5 | <guide> |
| 6 | <title>Gentoo XML Guide</title> |
6 | <title>Gentoo GuideXML Guide</title> |
| 7 | |
7 | |
| 8 | <author title="Author"> |
8 | <author title="Author"> |
| 9 | <mail link="neysx@gentoo.org">Xavier Neys</mail> |
9 | <mail link="neysx"/> |
| 10 | </author> |
10 | </author> |
| 11 | <author title="Author"> |
11 | <author title="Author"> |
| 12 | <mail link="drobbins@gentoo.org">Daniel Robbins</mail> |
12 | <mail link="drobbins@gentoo.org">Daniel Robbins</mail> |
| 13 | </author> |
13 | </author> |
| 14 | <author title="Author"><!-- zhen@gentoo.org --> |
14 | <author title="Author"><!-- zhen@gentoo.org --> |
| … | |
… | |
| 30 | |
30 | |
| 31 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
31 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
| 32 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
32 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
| 33 | <license/> |
33 | <license/> |
| 34 | |
34 | |
| 35 | <version>7</version> |
35 | <version>9</version> |
| 36 | <date>2006-05-11</date> |
36 | <date>2008-03-09</date> |
| 37 | |
37 | |
| 38 | <chapter> |
38 | <chapter> |
| 39 | <title>Guide basics</title> |
39 | <title>GuideXML basics</title> |
| 40 | <section> |
40 | <section> |
| 41 | <title>Guide XML design goals</title> |
41 | <title>GuideXML design goals</title> |
| 42 | <body> |
42 | <body> |
| 43 | |
43 | |
| 44 | <p> |
44 | <p> |
| 45 | The guide XML syntax is lightweight yet expressive, so that it is easy to |
45 | The guideXML syntax is lightweight yet expressive, so that it is easy to |
| 46 | learn yet also provides all the features we need for the creation of web |
46 | learn yet also provides all the features we need for the creation of web |
| 47 | documentation. The number of tags is kept to a minimum -- just those we need. |
47 | documentation. The number of tags is kept to a minimum -- just those we need. |
| 48 | This makes it easy to transform guide into other formats, such as DocBook |
48 | This makes it easy to transform guide into other formats, such as DocBook |
| 49 | XML/SGML or web-ready HTML. |
49 | XML/SGML or web-ready HTML. |
| 50 | </p> |
50 | </p> |
| 51 | |
51 | |
| 52 | <p> |
52 | <p> |
| 53 | The goal is to make it easy to <e>create</e> and <e>transform</e> guide XML |
53 | The goal is to make it easy to <e>create</e> and <e>transform</e> guideXML |
| 54 | documents. |
54 | documents. |
| 55 | </p> |
55 | </p> |
| 56 | |
56 | |
| 57 | </body> |
57 | </body> |
| 58 | </section> |
58 | </section> |
| … | |
… | |
| 75 | </body> |
75 | </body> |
| 76 | </section> |
76 | </section> |
| 77 | </chapter> |
77 | </chapter> |
| 78 | |
78 | |
| 79 | <chapter> |
79 | <chapter> |
| 80 | <title>Guide XML</title> |
80 | <title>GuideXML</title> |
| 81 | <section> |
81 | <section> |
| 82 | <title>Basic structure</title> |
82 | <title>Basic structure</title> |
| 83 | <body> |
83 | <body> |
| 84 | |
84 | |
| 85 | <p> |
85 | <p> |
| … | |
… | |
| 117 | <p> |
117 | <p> |
| 118 | On the first lines, we see the requisite tag that identifies this as an XML |
118 | On the first lines, we see the requisite tag that identifies this as an XML |
| 119 | document and specifies its DTD. The <c><!-- $Header$ --></c> line |
119 | document and specifies its DTD. The <c><!-- $Header$ --></c> line |
| 120 | will be automatically modified by the CVS server and helps to track revisions. |
120 | will be automatically modified by the CVS server and helps to track revisions. |
| 121 | Next, there's a <c><guide></c> tag -- the entire guide document is |
121 | Next, there's a <c><guide></c> tag -- the entire guide document is |
| 122 | enclosed within a <c><guide> </guide></c> pair. The <c>link</c> |
122 | enclosed within a <c><guide> </guide></c> pair. |
| 123 | attribute is compulsory and should preferably contain the absolute path to the |
123 | <br/> |
| 124 | document relatively to the document root even though the file name alone will |
124 | The <c>link</c> attribute is optional and should preferably contain the |
| 125 | work. It is mainly used to generate a link to a printer-friendly version of |
125 | absolute path to the document relatively to the document root even though the |
| 126 | your document. If you use a wrong value, the link to the printable version will |
126 | file name alone will work. It is only used to generate a link to a |
| 127 | either not work or point to a wrong document. Translated documents <e>must</e> |
127 | printer-friendly version of your document and check whether a translation is |
| 128 | specify the full path because it is also used to check whether a more recent |
128 | up-to-date. Our XSL back-engine passes the actual path to our XSL stylesheet. |
| 129 | original document exists. The <c>lang</c> attribute should be used to specify |
129 | The link attribute is only used as a fall-back value in case the XML is |
| 130 | the language code of your document. It is used to format the date and insert |
130 | processed by other means. |
| 131 | strings like "<e>Note</e>", "<e>Content</e>", etc. in the specified language. |
131 | <br/> |
| 132 | The default is English. |
132 | The <c>lang</c> attribute should be used to specify the language code of your |
|
|
133 | document. It is used to format the date and insert strings like "<e>Note</e>", |
|
|
134 | "<e>Content</e>", etc. in the specified language. The default is English. |
| 133 | </p> |
135 | </p> |
| 134 | |
136 | |
| 135 | <p> |
137 | <p> |
| 136 | Next, there's a <c><title></c> tag, used to set the title for the entire |
138 | Next, there's a <c><title></c> tag, used to set the title for the entire |
| 137 | guide document. |
139 | guide document. |
| … | |
… | |
| 142 | about the various authors of the document. Each <c><author></c> tag |
144 | about the various authors of the document. Each <c><author></c> tag |
| 143 | allows for an optional <c>title</c> element, used to specify the author's |
145 | allows for an optional <c>title</c> element, used to specify the author's |
| 144 | relationship to the document (author, co-author, editor, etc.). In this |
146 | relationship to the document (author, co-author, editor, etc.). In this |
| 145 | particular example, the authors' names are enclosed in another tag -- a |
147 | particular example, the authors' names are enclosed in another tag -- a |
| 146 | <c><mail></c> tag, used to specify an email address for this particular |
148 | <c><mail></c> tag, used to specify an email address for this particular |
| 147 | person. The <c><mail></c> tag is optional and can be omitted, and no |
149 | person. The <c><mail></c> tag is optional and can be omitted, and at |
| 148 | more than one <c><author></c> element is required per guide document. |
150 | least one <c><author></c> element is required per guide document. |
| 149 | </p> |
151 | </p> |
| 150 | |
152 | |
| 151 | <p> |
153 | <p> |
| 152 | Next, we come to the <c><abstract></c>, <c><version></c> and |
154 | Next, we come to the <c><abstract></c>, <c><version></c> and |
| 153 | <c><date></c> tags, used to specify a summary of the document, the |
155 | <c><date></c> tags, used to specify a summary of the document, the |
| … | |
… | |
| 155 | respectively. Dates that are invalid or not in the YYYY-MM-DD format will |
157 | respectively. Dates that are invalid or not in the YYYY-MM-DD format will |
| 156 | appear verbatim in the rendered document. |
158 | appear verbatim in the rendered document. |
| 157 | </p> |
159 | </p> |
| 158 | |
160 | |
| 159 | <p> |
161 | <p> |
| 160 | This rounds out the tags that should appear at the beginning of a guide |
162 | This sums up the tags that should appear at the beginning of a guide document. |
| 161 | document. Besides the <c><title></c> and <c><mail></c> tags, these |
163 | Besides the <c><title></c> and <c><mail></c> tags, these tags |
| 162 | tags shouldn't appear anywhere else except immediately inside the |
164 | shouldn't appear anywhere else except immediately inside the |
| 163 | <c><guide></c> tag, and for consistency it's recommended (but not |
165 | <c><guide></c> tag, and for consistency it's recommended (but not |
| 164 | required) that these tags appear before the content of the document. |
166 | required) that these tags appear before the content of the document. |
| 165 | </p> |
167 | </p> |
| 166 | |
168 | |
| 167 | <p> |
169 | <p> |
| … | |
… | |
| 214 | content of this particular section. We'll look at the tags that are allowed |
216 | content of this particular section. We'll look at the tags that are allowed |
| 215 | inside a <c><body></c> element in a bit. |
217 | inside a <c><body></c> element in a bit. |
| 216 | </p> |
218 | </p> |
| 217 | |
219 | |
| 218 | <note> |
220 | <note> |
| 219 | A <c><guide></c> element can contain multiple <c><chapter></c> |
221 | A <c><guide></c> element must contain at least one <c><chapter></c> |
| 220 | elements, and a <c><chapter></c> can contain multiple |
222 | elements, a <c><chapter></c> must contain at least one |
| 221 | <c><section></c> elements. However, a <c><section></c> |
223 | <c><section></c> elements and a <c><section></c> element must |
| 222 | element can only contain one <c><body></c> element. |
224 | contain at least one <c><body></c> element. |
| 223 | </note> |
225 | </note> |
| 224 | |
226 | |
| 225 | </body> |
227 | </body> |
| 226 | </section> |
228 | </section> |
| 227 | <section> |
229 | <section> |
| … | |
… | |
| 478 | <body> |
480 | <body> |
| 479 | |
481 | |
| 480 | <p> |
482 | <p> |
| 481 | We've taken a look at the <c><mail></c> tag earlier; it's used to link |
483 | We've taken a look at the <c><mail></c> tag earlier; it's used to link |
| 482 | some text with a particular email address, and takes the form <c><mail |
484 | some text with a particular email address, and takes the form <c><mail |
| 483 | link="foo@bar.com">Mr. Foo Bar</mail></c>. If you want to display the |
485 | link="foo.bar@example.com">Mr. Foo Bar</mail></c>. If you want to display the |
| 484 | email address, you can use <c><mail>foo@bar.com</mail></c>, this |
486 | email address, you can use <c><mail>foo.bar@example.com</mail></c>, this |
| 485 | would be displayed as <mail>foo@bar.com</mail>. |
487 | would be displayed as <mail>foo.bar@example.com</mail>. |
|
|
488 | </p> |
|
|
489 | |
|
|
490 | <p> |
|
|
491 | Shorter forms make it easier to use names and emails of Gentoo developers. Both |
|
|
492 | <c><mail>neysx</mail></c> and <c><mail link="neysx"/></c> |
|
|
493 | would appear as <mail>neysx</mail>. If you want to use a Gentoo dev's email |
|
|
494 | with a different content than his full name, use the second form with some |
|
|
495 | content. For instance, use a dev's first name: <c><mail |
|
|
496 | link="neysx">Xavier</mail></c> appears as <mail |
|
|
497 | link="neysx">Xavier</mail>. |
|
|
498 | <br/> |
|
|
499 | This is particularly useful when you want to name a developer whose name |
|
|
500 | contains "funny" characters that you can't type. |
| 486 | </p> |
501 | </p> |
| 487 | |
502 | |
| 488 | <p> |
503 | <p> |
| 489 | The <c><uri></c> tag is used to point to files/locations on the Internet. |
504 | The <c><uri></c> tag is used to point to files/locations on the Internet. |
| 490 | It has two forms -- the first can be used when you want to have the actual URI |
505 | It has two forms -- the first can be used when you want to have the actual URI |
| 491 | displayed in the body text, such as this link to |
506 | displayed in the body text, such as this link to |
| 492 | <uri>http://forums.gentoo.org</uri>. To create this link, I typed |
507 | <uri>http://forums.gentoo.org/</uri>. To create this link, I typed |
| 493 | <c><uri>http://forums.gentoo.org</uri></c>. The alternate form is |
508 | <c><uri>http://forums.gentoo.org/</uri></c>. The alternate form is |
| 494 | when you want to associate a URI with some other text -- for example, <uri |
509 | when you want to associate a URI with some other text -- for example, <uri |
| 495 | link="http://forums.gentoo.org">the Gentoo Forums</uri>. To create <e>this</e> |
510 | link="http://forums.gentoo.org/">the Gentoo Forums</uri>. To create |
| 496 | link, I typed <c><uri link="http://forums.gentoo.org">the Gentoo |
511 | <e>this</e> link, I typed <c><uri link="http://forums.gentoo.org/">the |
| 497 | Forums</uri></c>. You don't need to write <c>http://www.gentoo.org/</c> |
512 | Gentoo Forums</uri></c>. You don't need to write |
| 498 | to link to other parts of the Gentoo web site. For instance, a link to the <uri |
513 | <c>http://www.gentoo.org/</c> to link to other parts of the Gentoo web site. |
| 499 | link="/doc/en/">documentation main index</uri> should be simply <c><uri |
514 | For instance, a link to the <uri link="/doc/en/">documentation main index</uri> |
| 500 | link="/doc/en/index.xml">documentation main index</uri></c>. You can |
515 | should be simply <c><uri link="/doc/en/index.xml">documentation main |
| 501 | even omit <c>index.xml</c> when you link to a directory index, e.g. <c><uri |
516 | index</uri></c>. You can even omit <c>index.xml</c> when you link to a |
| 502 | link="/doc/en/">documentation main index</uri></c>. |
517 | directory index, e.g. <c><uri link="/doc/en/">documentation main |
|
|
518 | index</uri></c>. Leaving the trailing slash saves an extra HTTP request. |
|
|
519 | </p> |
|
|
520 | |
|
|
521 | <p> |
|
|
522 | You should not use a <c><uri></c> tag with a <c>link</c> attribute that |
|
|
523 | starts with <c>mailto:</c>. In this case, use a <c><mail></c> tag. |
|
|
524 | </p> |
|
|
525 | |
|
|
526 | <p> |
|
|
527 | Please avoid the <uri link="http://en.wikipedia.org/wiki/Click_here">click here |
|
|
528 | syndrome</uri> as recommended by the <uri |
|
|
529 | link="http://www.w3.org/QA/Tips/noClickHere">W3C</uri>. |
| 503 | </p> |
530 | </p> |
| 504 | |
531 | |
| 505 | </body> |
532 | </body> |
| 506 | </section> |
533 | </section> |
| 507 | <section> |
534 | <section> |
| … | |
… | |
| 523 | <section> |
550 | <section> |
| 524 | <title>Tables</title> |
551 | <title>Tables</title> |
| 525 | <body> |
552 | <body> |
| 526 | |
553 | |
| 527 | <p> |
554 | <p> |
| 528 | Guide supports a simplified table syntax similar to that of HTML. To start a |
555 | GuideXML supports a simplified table syntax similar to that of HTML. To start a |
| 529 | table, use a <c><table></c> tag. Start a row with a <c><tr></c> |
556 | table, use a <c><table></c> tag. Start a row with a <c><tr></c> |
| 530 | tag. However, for inserting actual table data, we <e>don't</e> support the |
557 | tag. However, for inserting actual table data, we <e>don't</e> support the HTML |
| 531 | HTML <td> tag; instead, use the <c><th></c> if you are inserting a |
558 | <td> tag; instead, use the <c><th></c> if you are inserting a |
| 532 | header, and <c><ti></c> if you are inserting a normal informational |
559 | header, and <c><ti></c> if you are inserting a normal informational |
| 533 | block. You can use a <c><th></c> anywhere you can use a <c><ti></c> |
560 | block. You can use a <c><th></c> anywhere you can use a <c><ti></c> |
| 534 | -- there's no requirement that <c><th></c> elements appear only in the |
561 | -- there's no requirement that <c><th></c> elements appear only in the |
| 535 | first row. |
562 | first row. |
| 536 | </p> |
563 | </p> |
| … | |
… | |
| 540 | (<c><ti></c>) accept the <c>colspan</c> and <c>rowspan</c> attributes to |
567 | (<c><ti></c>) accept the <c>colspan</c> and <c>rowspan</c> attributes to |
| 541 | span their content across rows, columns or both. |
568 | span their content across rows, columns or both. |
| 542 | </p> |
569 | </p> |
| 543 | |
570 | |
| 544 | <p> |
571 | <p> |
| 545 | Furthermore, table items (<c><ti></c>) can be right-aligned or centered |
572 | Furthermore, table cells (<c><ti></c> & <c><th></c>) can be |
| 546 | with the <c>align</c> attribute. Table headers (<c><th></c>) are |
573 | right-aligned, left-aligned or centered with the <c>align</c> attribute. |
| 547 | automatically centered. |
|
|
| 548 | </p> |
574 | </p> |
| 549 | |
575 | |
| 550 | <table> |
576 | <table> |
| 551 | <tr> |
577 | <tr> |
| 552 | <th colspan="4">This title spans 4 columns</th> |
578 | <th align="center" colspan="4">This title spans 4 columns</th> |
| 553 | </tr> |
579 | </tr> |
| 554 | <tr> |
580 | <tr> |
| 555 | <th rowspan="6">This title spans 6 rows</th> |
581 | <th rowspan="6">This title spans 6 rows</th> |
| 556 | <ti>Item A1</ti> |
582 | <ti>Item A1</ti> |
| 557 | <ti>Item A2</ti> |
583 | <ti>Item A2</ti> |
| 558 | <ti>Item A3</ti> |
584 | <ti>Item A3</ti> |
| 559 | </tr> |
585 | </tr> |
| 560 | <tr> |
586 | <tr> |
| 561 | <ti align="center">Item B1</ti> |
587 | <ti align="center">Item B1</ti> |
| 562 | <th colspan="2" rowspan="2">Blocky 2x2 title</th> |
588 | <th colspan="2" rowspan="2" align="right">Blocky 2x2 title</th> |
| 563 | </tr> |
589 | </tr> |
| 564 | <tr> |
590 | <tr> |
| 565 | <ti align="right">Item C1</ti> |
591 | <ti align="right">Item C1</ti> |
| 566 | </tr> |
592 | </tr> |
| 567 | <tr> |
593 | <tr> |
| … | |
… | |
| 642 | <section> |
668 | <section> |
| 643 | <title>Intra-document references</title> |
669 | <title>Intra-document references</title> |
| 644 | <body> |
670 | <body> |
| 645 | |
671 | |
| 646 | <p> |
672 | <p> |
| 647 | Guide makes it really easy to reference other parts of the document using |
673 | GuideXML makes it really easy to reference other parts of the document using |
| 648 | hyperlinks. You can create a link pointing to <uri link="#doc_chap1">Chapter |
674 | hyperlinks. You can create a link pointing to <uri link="#doc_chap1">Chapter |
| 649 | One</uri> by typing <c><uri link="#doc_chap1">Chapter |
675 | One</uri> by typing <c><uri link="#doc_chap1">Chapter |
| 650 | One</uri></c>. To point to <uri link="#doc_chap1_sect2">section two of |
676 | One</uri></c>. To point to <uri link="#doc_chap1_sect2">section two of |
| 651 | Chapter One</uri>, type <c><uri link="#doc_chap1_sect2">section two of |
677 | Chapter One</uri>, type <c><uri link="#doc_chap1_sect2">section two of |
| 652 | Chapter One</uri></c>. To refer to figure 3 in chapter 1, type <c><uri |
678 | Chapter One</uri></c>. To refer to figure 3 in chapter 1, type |
| 653 | link="#doc_chap1_fig3">figure 1.3</uri></c>. Or, to refer to <uri |
679 | <c><uri link="#doc_chap1_fig3">figure 1.3</uri></c>. Or, to refer |
| 654 | link="#doc_chap2_pre2">code listing 2 in chapter 2</uri>, type <c><uri |
680 | to <uri link="#doc_chap2_pre2">code listing 2 in chapter 2</uri>, type |
| 655 | link="#doc_chap2_pre2">code listing 2.2</uri></c>. |
681 | <c><uri link="#doc_chap2_pre2">code listing 2.2</uri></c>. |
| 656 | </p> |
682 | </p> |
| 657 | |
683 | |
| 658 | <p> |
684 | <p> |
| 659 | However, some guides change often and using such "counting" can lead to broken |
685 | However, some guides change often and using such "counting" can lead to broken |
| 660 | links. In order to cope with this, you can define a name for a |
686 | links. In order to cope with this, you can define a name for a |
| … | |
… | |
| 709 | <pre caption="Disclaimer sample"> |
735 | <pre caption="Disclaimer sample"> |
| 710 | <?xml version="1.0" encoding="UTF-8"?> |
736 | <?xml version="1.0" encoding="UTF-8"?> |
| 711 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
737 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
| 712 | <!-- $Header$ --> |
738 | <!-- $Header$ --> |
| 713 | |
739 | |
| 714 | <guide link="/doc/en/gentoo-x86-install.xml" disclaimer="obsolete" redirect="/doc/en/handbook/handbook-x86.xml"> |
740 | <guide disclaimer="obsolete" redirect="/doc/en/handbook/handbook-x86.xml"> |
| 715 | <title>Gentoo x86 Installation Guide</title> |
741 | <title>Gentoo x86 Installation Guide</title> |
| 716 | |
742 | |
| 717 | <author title="Author"> |
743 | <author title="Author"> |
| 718 | ... |
744 | ... |
| 719 | </pre> |
745 | </pre> |
| 720 | |
746 | |
| 721 | </body> |
747 | </body> |
| 722 | </section> |
748 | </section> |
|
|
749 | <section> |
|
|
750 | <title>FAQs</title> |
|
|
751 | <body> |
|
|
752 | |
|
|
753 | <p> |
|
|
754 | FAQ documents need to start with a list of questions with links to their |
|
|
755 | answers. Creating such a list is both time-consuming and error-prone. The list |
|
|
756 | can be created automatically if you use a <c>faqindex</c> element as the first |
|
|
757 | chapter of your document. This element has the same structure as a |
|
|
758 | <c>chapter</c> to allow some introductory text. The structure of the document |
|
|
759 | is expected to be split into chapters (at least one chapter) containing |
|
|
760 | sections, each section containing one question specified in its <c>title</c> |
|
|
761 | element with the answer in its <c>body</c>. The FAQ index will appear as one |
|
|
762 | section per chapter and one link per question. |
|
|
763 | </p> |
|
|
764 | |
|
|
765 | <p> |
|
|
766 | A quick look at a <uri link="/doc/en/faq.xml">FAQ</uri> and <uri |
|
|
767 | link="/doc/en/faq.xml?passthru=1">its source</uri> should make the above |
|
|
768 | obvious. |
|
|
769 | </p> |
|
|
770 | |
|
|
771 | </body> |
|
|
772 | </section> |
| 723 | </chapter> |
773 | </chapter> |
| 724 | |
774 | |
| 725 | <chapter> |
775 | <chapter> |
|
|
776 | <title>Handbook Format</title> |
|
|
777 | <section> |
|
|
778 | <title>Guide vs Book</title> |
|
|
779 | <body> |
|
|
780 | |
|
|
781 | <p> |
|
|
782 | For high-volume documentation, such as the <uri |
|
|
783 | link="/doc/en/handbook/handbook-x86.xml?part=1">Installation Instructions</uri>, a |
|
|
784 | broader format was needed. We designed a GuideXML-compatible enhancement that |
|
|
785 | allows us to write modular and multi-page documentation. |
|
|
786 | </p> |
|
|
787 | |
|
|
788 | </body> |
|
|
789 | </section> |
|
|
790 | <section> |
|
|
791 | <title>Main File</title> |
|
|
792 | <body> |
|
|
793 | |
|
|
794 | <p> |
|
|
795 | The first change is the need for a "master" document. This document contains no |
|
|
796 | real content, but links to the individual documentation modules. The syntax |
|
|
797 | doesn't differ much from GuideXML: |
|
|
798 | </p> |
|
|
799 | |
|
|
800 | <pre caption="Example book usage"> |
|
|
801 | <?xml version='1.0' encoding='UTF-8'?> |
|
|
802 | <!DOCTYPE book SYSTEM "/dtd/book.dtd"> |
|
|
803 | <!-- $Header$ --> |
|
|
804 | |
|
|
805 | <<i>book</i>> |
|
|
806 | <title>Example Book Usage</title> |
|
|
807 | |
|
|
808 | <author...> |
|
|
809 | ... |
|
|
810 | </author> |
|
|
811 | |
|
|
812 | <abstract> |
|
|
813 | ... |
|
|
814 | </abstract> |
|
|
815 | |
|
|
816 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
|
|
817 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
|
|
818 | <license/> |
|
|
819 | |
|
|
820 | <version>...</version> |
|
|
821 | <date>...</date> |
|
|
822 | </pre> |
|
|
823 | |
|
|
824 | <p> |
|
|
825 | So far no real differences (except for the <c><book></c> instead of |
|
|
826 | <c><guide></c> tag). Instead of starting with the individual |
|
|
827 | <c><chapter></c>s, you define a <c><part></c>, which is the |
|
|
828 | equivalent of a separate part in a book: |
|
|
829 | </p> |
|
|
830 | |
|
|
831 | <pre caption="Defining a part"> |
|
|
832 | <part> |
|
|
833 | <title>Part One</title> |
|
|
834 | <abstract> |
|
|
835 | ... |
|
|
836 | </abstract> |
|
|
837 | |
|
|
838 | <comment>(Defining the several chapters)</comment> |
|
|
839 | </part> |
|
|
840 | </pre> |
|
|
841 | |
|
|
842 | <p> |
|
|
843 | Each part is accompanied by a <c><title></c> and an |
|
|
844 | <c><abstract></c> which gives a small introduction to the part. |
|
|
845 | </p> |
|
|
846 | |
|
|
847 | <p> |
|
|
848 | Inside each part, you define the individual <c><chapter></c>s. Each |
|
|
849 | chapter <e>must</e> be a separate document. As a result it is no surprise that |
|
|
850 | a special tag (<c><include></c>) is added to allow including the separate |
|
|
851 | document. |
|
|
852 | </p> |
|
|
853 | |
|
|
854 | <pre caption="Defining a chapter"> |
|
|
855 | <chapter> |
|
|
856 | <title>Chapter One</title> |
|
|
857 | |
|
|
858 | <include href="path/to/chapter-one.xml"/> |
|
|
859 | |
|
|
860 | </chapter> |
|
|
861 | </pre> |
|
|
862 | |
|
|
863 | </body> |
|
|
864 | </section> |
|
|
865 | <section> |
|
|
866 | <title>Designing the Individual Chapters</title> |
|
|
867 | <body> |
|
|
868 | |
|
|
869 | <p> |
|
|
870 | The content of an individual chapter is structured as follows: |
|
|
871 | </p> |
|
|
872 | |
|
|
873 | <pre caption="Chapter Syntax"> |
|
|
874 | <?xml version='1.0' encoding='UTF-8'?> |
|
|
875 | <!DOCTYPE sections SYSTEM "/dtd/book.dtd"> |
|
|
876 | <!-- $Header$ --> |
|
|
877 | |
|
|
878 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
|
|
879 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
|
|
880 | |
|
|
881 | <sections> |
|
|
882 | |
|
|
883 | <abstract> |
|
|
884 | This is a small explanation on chapter one. |
|
|
885 | </abstract> |
|
|
886 | |
|
|
887 | <version>...</version> |
|
|
888 | <date>...</date> |
|
|
889 | |
|
|
890 | <comment>(Define the several <section> and <subsection>)</comment> |
|
|
891 | |
|
|
892 | </sections> |
|
|
893 | </pre> |
|
|
894 | |
|
|
895 | <p> |
|
|
896 | Inside each chapter you can define <c><section></c>s (equivalent of |
|
|
897 | <c><chapter></c> in a Guide) and <c><subsection></c>s (equivalent |
|
|
898 | of <c><section></c> in a Guide). |
|
|
899 | </p> |
|
|
900 | |
|
|
901 | <p> |
|
|
902 | Each individual chapter should have its own date and version elements. The |
|
|
903 | latest date of all chapters and master document will be displayed when a user |
|
|
904 | browses through all parts of the book. |
|
|
905 | </p> |
|
|
906 | |
|
|
907 | </body> |
|
|
908 | </section> |
|
|
909 | </chapter> |
|
|
910 | |
|
|
911 | <chapter> |
|
|
912 | <title>Advanced Handbook Features</title> |
|
|
913 | <section> |
|
|
914 | <title>Global Values</title> |
|
|
915 | <body> |
|
|
916 | |
|
|
917 | <p> |
|
|
918 | Sometimes, the same values are repeated many times in several parts of a |
|
|
919 | handbook. Global search and replace operations tend to forget some or introduce |
|
|
920 | unwanted changes. Besides, it can be useful to define different values to be |
|
|
921 | used in shared chapters depending on which handbook includes the chapter. |
|
|
922 | </p> |
|
|
923 | |
|
|
924 | <p> |
|
|
925 | Global values can be defined in a handbook master file and used in all included |
|
|
926 | chapters. |
|
|
927 | </p> |
|
|
928 | |
|
|
929 | <p> |
|
|
930 | To define global values, add a <c><values></c> element to the handbook |
|
|
931 | master file. Each value is then defined in a <c><key></c> element whose |
|
|
932 | <c>id</c> attribute identifies the value, i.e. it is the name of your variable. |
|
|
933 | The content of the <c><key></c> is its value. |
|
|
934 | </p> |
|
|
935 | |
|
|
936 | <p> |
|
|
937 | The following example defines three values in a handbook master file: |
|
|
938 | </p> |
|
|
939 | |
|
|
940 | <pre caption="Define values in a handbook"> |
|
|
941 | <?xml version='1.0' encoding='UTF-8'?> |
|
|
942 | <!DOCTYPE book SYSTEM "/dtd/book.dtd"> |
|
|
943 | <!-- $Header$ --> |
|
|
944 | |
|
|
945 | <book> |
|
|
946 | <title>Example Book Usage</title> |
|
|
947 | |
|
|
948 | <i><values> |
|
|
949 | <key id="arch">x86</key> |
|
|
950 | <key id="min-cd-name">install-x86-minimal-2007.0-r1.iso</key> |
|
|
951 | <key id="min-cd-size">57</key> |
|
|
952 | </values></i> |
|
|
953 | |
|
|
954 | <author...> |
|
|
955 | ... |
|
|
956 | </author> |
|
|
957 | |
|
|
958 | ... |
|
|
959 | </pre> |
|
|
960 | |
|
|
961 | <p> |
|
|
962 | The defined values can then be used throughout the handbook with the in-line |
|
|
963 | <c><keyval id="key_id"/></c> element. Specify the name of the key in its |
|
|
964 | <c>id</c> attribute, e.g. <keyval id="min-cd-name"/> would be replaced by |
|
|
965 | "install-x86-minimal-2007.0-r1.iso" in our example. |
|
|
966 | </p> |
|
|
967 | |
|
|
968 | <pre caption="Using defined values"> |
|
|
969 | <p> |
|
|
970 | The Minimal Installation CD is called <c><i><keyval id="min-cd-name"/></i></c> |
|
|
971 | and takes up only <i><keyval id="min-cd-size"/></i> MB of diskspace. You can use this |
|
|
972 | Installation CD to install Gentoo, but <e>only</e> with a working Internet |
|
|
973 | connection. |
|
|
974 | </p> |
|
|
975 | </pre> |
|
|
976 | |
|
|
977 | <p> |
|
|
978 | To make life easier on our translators, only use actual values, i.e. content |
|
|
979 | that does not need to be translated. For instance, we defined the |
|
|
980 | <c>min-cd-size</c> value to <c>57</c> and not <c>57 MB</c>. |
|
|
981 | </p> |
|
|
982 | |
|
|
983 | </body> |
|
|
984 | </section> |
|
|
985 | <section> |
|
|
986 | <title>Conditional Elements</title> |
|
|
987 | <body> |
|
|
988 | |
|
|
989 | <p> |
|
|
990 | Chapters that are shared by several handbooks such as our <uri |
|
|
991 | link="/doc/en/handbook/">Installation Handbooks</uri> often have small |
|
|
992 | differences depending on which handbook includes them. Instead of adding |
|
|
993 | content that is irrelevant to some handbooks, authors can add a condition to |
|
|
994 | the following elements: <c><section></c>, <c><subsection></c>, |
|
|
995 | <c><body></c>, <c><note></c>, <c><impo></c>, |
|
|
996 | <c><warn></c>, <c><pre></c>, <c><p></c>, |
|
|
997 | <c><table></c>, <c><tr></c>, <c><ul></c>, <c><ol></c> |
|
|
998 | and <c><li></c>. |
|
|
999 | </p> |
|
|
1000 | |
|
|
1001 | <p> |
|
|
1002 | The condition must be an <uri |
|
|
1003 | link="http://en.wikipedia.org/wiki/XPath">XPATH</uri> expression that will be |
|
|
1004 | evaluated when transforming the XML. If it evaluates to <c>true</c>, the |
|
|
1005 | element is processed, if not, it is ignored. The condition is specified in a |
|
|
1006 | <c>test</c> attribute. |
|
|
1007 | </p> |
|
|
1008 | |
|
|
1009 | <p> |
|
|
1010 | The following example uses the <c>arch</c> value that is defined in each |
|
|
1011 | handbook master file to condition some content: |
|
|
1012 | </p> |
|
|
1013 | |
|
|
1014 | <pre caption="Using conditional elements"> |
|
|
1015 | <body test="contains('AMD64 x86',func:keyval('arch'))"> |
|
|
1016 | |
|
|
1017 | <p> |
|
|
1018 | This paragraph applies to both x86 and AMD64 architectures. |
|
|
1019 | </p> |
|
|
1020 | |
|
|
1021 | <p test="func:keyval('arch')='x86'"> |
|
|
1022 | This paragraph only applies to the x86 architecture. |
|
|
1023 | </p> |
|
|
1024 | |
|
|
1025 | <p test="func:keyval('arch')='AMD64'"> |
|
|
1026 | This paragraph only applies to the AMD64 architecture. |
|
|
1027 | </p> |
|
|
1028 | |
|
|
1029 | <p test="func:keyval('arch')='PPC'"> |
|
|
1030 | This paragraph will never be seen! |
|
|
1031 | The whole body is skipped because of the first condition. |
|
|
1032 | </p> |
|
|
1033 | |
|
|
1034 | </body> |
|
|
1035 | |
|
|
1036 | <body test="contains('AMD64 PPC64',func:keyval('arch'))"> |
|
|
1037 | |
|
|
1038 | <p> |
|
|
1039 | This paragraph applies to the AMD64, PPC64 <comment>and PPC</comment> architectures because |
|
|
1040 | the 'AMD64 PPC64' string does contain 'PPC'. |
|
|
1041 | </p> |
|
|
1042 | |
|
|
1043 | <note test="func:keyval('arch')='AMD64' or func:keyval('arch')='PPC64'"> |
|
|
1044 | This note only applies to the AMD64 and PPC64 architectures. |
|
|
1045 | </note> |
|
|
1046 | |
|
|
1047 | </body> |
|
|
1048 | </pre> |
|
|
1049 | |
|
|
1050 | </body> |
|
|
1051 | </section> |
|
|
1052 | </chapter> |
|
|
1053 | |
|
|
1054 | <chapter id="codingstyle"> |
| 726 | <title>Coding Style</title> |
1055 | <title>Coding Style</title> |
| 727 | <section> |
1056 | <section> |
| 728 | <title>Introduction</title> |
1057 | <title>Introduction</title> |
| 729 | <body> |
1058 | <body> |
| 730 | |
1059 | |
| … | |
… | |
| 875 | </body> |
1204 | </body> |
| 876 | </section> |
1205 | </section> |
| 877 | </chapter> |
1206 | </chapter> |
| 878 | |
1207 | |
| 879 | <chapter> |
1208 | <chapter> |
| 880 | <title>Handbook Format</title> |
|
|
| 881 | <section> |
|
|
| 882 | <title>Guide vs Book</title> |
|
|
| 883 | <body> |
|
|
| 884 | |
|
|
| 885 | <p> |
|
|
| 886 | For high-volume documentation, such as the <uri |
|
|
| 887 | link="/doc/en/handbook/handbook-x86.xml?part=1">Installation Instructions</uri>, a |
|
|
| 888 | broader format was needed. We designed a GuideXML-compatible enhancement that |
|
|
| 889 | allows us to write modular and multi-page documentation. |
|
|
| 890 | </p> |
|
|
| 891 | |
|
|
| 892 | </body> |
|
|
| 893 | </section> |
|
|
| 894 | <section> |
|
|
| 895 | <title>Main File</title> |
|
|
| 896 | <body> |
|
|
| 897 | |
|
|
| 898 | <p> |
|
|
| 899 | The first change is the need for a "master" document. This document contains no |
|
|
| 900 | real content, but links to the individual documentation modules. The syntax |
|
|
| 901 | doesn't differ much from GuideXML: |
|
|
| 902 | </p> |
|
|
| 903 | |
|
|
| 904 | <pre caption="Example book usage"> |
|
|
| 905 | <?xml version='1.0' encoding='UTF-8'?> |
|
|
| 906 | <!DOCTYPE book SYSTEM "/dtd/book.dtd"> |
|
|
| 907 | <!-- $Header$ --> |
|
|
| 908 | |
|
|
| 909 | <<i>book</i> link="example.xml"> |
|
|
| 910 | <title>Example Book Usage</title> |
|
|
| 911 | |
|
|
| 912 | <author...> |
|
|
| 913 | ... |
|
|
| 914 | </author> |
|
|
| 915 | |
|
|
| 916 | <abstract> |
|
|
| 917 | ... |
|
|
| 918 | </abstract> |
|
|
| 919 | |
|
|
| 920 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
|
|
| 921 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
|
|
| 922 | <license/> |
|
|
| 923 | |
|
|
| 924 | <version>...</version> |
|
|
| 925 | <date>...</date> |
|
|
| 926 | </pre> |
|
|
| 927 | |
|
|
| 928 | <p> |
|
|
| 929 | So far no real differences (except for the <c><book></c> instead of |
|
|
| 930 | <c><guide></c> tag). Instead of starting with the individual |
|
|
| 931 | <c><chapter></c>s, you define a <c><part></c>, which is the |
|
|
| 932 | equivalent of a separate part in a book: |
|
|
| 933 | </p> |
|
|
| 934 | |
|
|
| 935 | <pre caption="Defining a part"> |
|
|
| 936 | <part> |
|
|
| 937 | <title>Part One</title> |
|
|
| 938 | <abstract> |
|
|
| 939 | ... |
|
|
| 940 | </abstract> |
|
|
| 941 | |
|
|
| 942 | <comment>(Defining the several chapters)</comment> |
|
|
| 943 | </part> |
|
|
| 944 | </pre> |
|
|
| 945 | |
|
|
| 946 | <p> |
|
|
| 947 | Each part is accompanied by a <c><title></c> and an |
|
|
| 948 | <c><abstract></c> which gives a small introduction to the part. |
|
|
| 949 | </p> |
|
|
| 950 | |
|
|
| 951 | <p> |
|
|
| 952 | Inside each part, you define the individual <c><chapter></c>s. Each |
|
|
| 953 | chapter <e>must</e> be a separate document. As a result it is no surprise that |
|
|
| 954 | a special tag (<c><include></c>) is added to allow including the separate |
|
|
| 955 | document. |
|
|
| 956 | </p> |
|
|
| 957 | |
|
|
| 958 | <pre caption="Defining a chapter"> |
|
|
| 959 | <chapter> |
|
|
| 960 | <title>Chapter One</title> |
|
|
| 961 | <abstract> |
|
|
| 962 | This is a small explanation on chapter one. |
|
|
| 963 | </abstract> |
|
|
| 964 | |
|
|
| 965 | <include href="path/to/chapter-one.xml"/> |
|
|
| 966 | |
|
|
| 967 | </chapter> |
|
|
| 968 | </pre> |
|
|
| 969 | |
|
|
| 970 | </body> |
|
|
| 971 | </section> |
|
|
| 972 | <section> |
|
|
| 973 | <title>Designing the Individual Chapters</title> |
|
|
| 974 | <body> |
|
|
| 975 | |
|
|
| 976 | <p> |
|
|
| 977 | The content of an individual chapter is structured as follows: |
|
|
| 978 | </p> |
|
|
| 979 | |
|
|
| 980 | <pre caption="Chapter Syntax"> |
|
|
| 981 | <?xml version='1.0' encoding='UTF-8'?> |
|
|
| 982 | <!DOCTYPE sections SYSTEM "/dtd/book.dtd"> |
|
|
| 983 | <!-- $Header$ --> |
|
|
| 984 | |
|
|
| 985 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
|
|
| 986 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
|
|
| 987 | |
|
|
| 988 | <sections> |
|
|
| 989 | |
|
|
| 990 | <version>...</version> |
|
|
| 991 | <date>...</date> |
|
|
| 992 | |
|
|
| 993 | <comment>(Define the several <section> and <subsection>)</comment> |
|
|
| 994 | |
|
|
| 995 | </sections> |
|
|
| 996 | </pre> |
|
|
| 997 | |
|
|
| 998 | <p> |
|
|
| 999 | Inside each chapter you can define <c><section></c>s (equivalent of |
|
|
| 1000 | <c><chapter></c> in a Guide) and <c><subsection></c>s (equivalent |
|
|
| 1001 | of <c><section></c> in a Guide). |
|
|
| 1002 | </p> |
|
|
| 1003 | |
|
|
| 1004 | <p> |
|
|
| 1005 | Each individual chapter should have its own date and version elements. The |
|
|
| 1006 | latest date of all chapters and master document will be displayed when a user |
|
|
| 1007 | browses through all parts of the book. |
|
|
| 1008 | </p> |
|
|
| 1009 | |
|
|
| 1010 | </body> |
|
|
| 1011 | </section> |
|
|
| 1012 | </chapter> |
|
|
| 1013 | |
|
|
| 1014 | <chapter> |
|
|
| 1015 | <title>Resources</title> |
1209 | <title>Resources</title> |
| 1016 | <section> |
1210 | <section> |
| 1017 | <title>Start writing</title> |
1211 | <title>Start writing</title> |
| 1018 | <body> |
1212 | <body> |
| 1019 | |
1213 | |
| 1020 | <p> |
1214 | <p> |
| 1021 | Guide has been specially designed to be "lean and mean" so that developers can |
1215 | GuideXML has been specially designed to be "lean and mean" so that developers |
| 1022 | spend more time writing documentation and less time learning the actual XML |
1216 | can spend more time writing documentation and less time learning the actual XML |
| 1023 | syntax. Hopefully, this will allow developers who aren't unusually "doc-savvy" |
1217 | syntax. Hopefully, this will allow developers who aren't unusually "doc-savvy" |
| 1024 | to start writing quality Gentoo documentation. You might be interested |
1218 | to start writing quality Gentoo documentation. You might be interested in our |
| 1025 | in our <uri link="/proj/en/gdp/doc/doc-tipsntricks.xml">Documentation |
1219 | <uri link="/proj/en/gdp/doc/doc-tipsntricks.xml">Documentation Development Tips |
| 1026 | Development Tips & Tricks</uri>. If you'd like to help (or have any |
1220 | & Tricks</uri>. If you'd like to help (or have any questions about |
| 1027 | questions about guide), please post a message to the <uri |
1221 | GuideXML), please post a message to the <uri |
| 1028 | link="/main/en/lists.xml">gentoo-doc mailing list</uri> stating what you'd |
1222 | link="/main/en/lists.xml">gentoo-doc mailing list</uri> stating what you'd like |
| 1029 | like to tackle. Have fun! |
1223 | to tackle. Have fun! |
| 1030 | </p> |
1224 | </p> |
| 1031 | |
1225 | |
| 1032 | </body> |
1226 | </body> |
| 1033 | </section> |
1227 | </section> |
| 1034 | </chapter> |
1228 | </chapter> |