| 1 |
=============== |
| 2 |
Hacking Guide |
| 3 |
=============== |
| 4 |
|
| 5 |
1. Introduction |
| 6 |
|
| 7 |
The GIMP documentation project uses docbook xml files to create the GIMP |
| 8 |
manual / online help. Since there are different approaches how to create |
| 9 |
and edit such files as well as different tools involved, there is a strong |
| 10 |
need for the xml files to be well formatted. |
| 11 |
Additionally there are a couple of technical reasons (diff, git) that |
| 12 |
suggest a general style guide for the xml files. This is a recommendation |
| 13 |
for such a style guide. It is mainly based on the styles that can be found |
| 14 |
in the xml files that build the current documentation, as well as on the |
| 15 |
discussion on the gimp-doc mailing list. |
| 16 |
|
| 17 |
2. XML style guide by rules |
| 18 |
|
| 19 |
§1. General |
| 20 |
§1.1. All docbook files for the documentation need to be well formed and |
| 21 |
have to comply validation against |
| 22 |
http://www.docbook.org/xml/4.3/docbookx.dtd. |
| 23 |
§1.2. All docbook files use UTF-8 character encoding. |
| 24 |
|
| 25 |
§2. Length of lines |
| 26 |
§2.1. The length of line should not exceed 80 characters. Exceptions |
| 27 |
might be made for text that is technically not able to be wrapped |
| 28 |
(Chinese text does rarely contain space characters, so it can't be |
| 29 |
wrapped without introducing unwanted whitespaces) and attributes of |
| 30 |
elements. |
| 31 |
|
| 32 |
§3. Elements and new lines |
| 33 |
§3.1. Element tagnames are written all lowercase. |
| 34 |
§3.2. All tags (opening and closing) start on a new line. For |
| 35 |
exceptions see §3.3. |
| 36 |
§3.3. Elements listed in Appendix I (inline elements) do not need to |
| 37 |
start their opening and closing tags on a new line, as long as their |
| 38 |
content does not exceed 80 characters. |
| 39 |
|
| 40 |
§4. Element attributes |
| 41 |
§4.1. Element attributes are written all lowercase. |
| 42 |
§4.2. Element attributes values are enclosed in double quotes ( " ). |
| 43 |
|
| 44 |
§5. Indentation |
| 45 |
§5.1. Use only Space characters for indentation. Tab characters should not |
| 46 |
be used. |
| 47 |
§5.2. Indentation width is two spaces. |
| 48 |
§5.3. Indentation is done for the content of all tags that start a new line. |
| 49 |
§5.4. Indentation should be increased if an element is a child of the |
| 50 |
previous element. |
| 51 |
|
| 52 |
3 XML style guide by example |
| 53 |
|
| 54 |
Example for §1 General |
| 55 |
Following the rules in §1 each xml file of the GIMP manual starts with: |
| 56 |
|
| 57 |
<?xml version='1.0' encoding='UTF-8'?> |
| 58 |
<!DOCTYPE abcd |
| 59 |
PUBLIC '-//OASIS//DTD DocBook XML V4.3//EN' |
| 60 |
'http://www.docbook.org/xml/4.3/docbookx.dtd'> |
| 61 |
|
| 62 |
where abcd is the root element of the file (usually book, sect1 of sect2). |
| 63 |
|
| 64 |
Example for §2. Length of lines |
| 65 |
// to be done |
| 66 |
|
| 67 |
Example for §3. Elements and new lines |
| 68 |
// to be done |
| 69 |
|
| 70 |
Example for §4. Element attributes |
| 71 |
// to be done |
| 72 |
|
| 73 |
Example for §5. Indentation |
| 74 |
// to be done |
| 75 |
|
| 76 |
Appendix I Inline elements |
| 77 |
<abbrev> |
| 78 |
<accel> |
| 79 |
<acronym> |
| 80 |
<action> |
| 81 |
<anchor> |
| 82 |
<application> |
| 83 |
<citation> |
| 84 |
<citerefentry> |
| 85 |
<citetitle> |
| 86 |
<classname> |
| 87 |
<command> |
| 88 |
<computeroutput> |
| 89 |
<constant> |
| 90 |
<database> |
| 91 |
<email> |
| 92 |
<emphasis> |
| 93 |
<envar> |
| 94 |
<errorcode> |
| 95 |
<errorname> |
| 96 |
<filename> |
| 97 |
<firstterm> |
| 98 |
<footnote> |
| 99 |
<forignphrase> |
| 100 |
<function> |
| 101 |
<guibutton> |
| 102 |
<guiicon> |
| 103 |
<guilabel> |
| 104 |
<guimenu> |
| 105 |
<guimenuitem> |
| 106 |
<guisubmenu> |
| 107 |
<glossterm> |
| 108 |
<hardware> |
| 109 |
<inlineequation> |
| 110 |
<inlinemediaobject> |
| 111 |
<interface> |
| 112 |
<interfacedefinition> |
| 113 |
<keycap> |
| 114 |
<keycode> |
| 115 |
<keycombo> |
| 116 |
<keysym> |
| 117 |
<link> |
| 118 |
<literal> |
| 119 |
<markup> |
| 120 |
<medialabel> |
| 121 |
<menuchoice> |
| 122 |
<mousebutton> |
| 123 |
<msgtext> |
| 124 |
<olink> |
| 125 |
<option> |
| 126 |
<optional> |
| 127 |
<parameter> |
| 128 |
<phrase> |
| 129 |
<prompt> |
| 130 |
<property> |
| 131 |
<quote> |
| 132 |
<replaceable> |
| 133 |
<returnvalue> |
| 134 |
<shortcut> |
| 135 |
<structfield> |
| 136 |
<structname> |
| 137 |
<subsrcipt> |
| 138 |
<superscript> |
| 139 |
<symbol> |
| 140 |
<systemitem> |
| 141 |
<token> |
| 142 |
<trademark> |
| 143 |
<type> |
| 144 |
<ulink> |
| 145 |
<userinput> |
| 146 |
<varname> |
| 147 |
<wordasword> |
| 148 |
<xref> |