John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 1 | <chapter id="documentation"> |
| 2 | <title>Documenting Wine</title> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 3 | |
| 4 | <para> |
| 5 | Written by &name-jon-griffiths; <email>&email-jon-griffiths;</email> |
| 6 | </para> |
| 7 | |
| 8 | <para> |
| 9 | This chapter describes how you can help improve Wines documentation. |
| 10 | </para> |
| 11 | |
| 12 | <para> |
| 13 | Like most large scale volunteer projects, Wine is strongest in areas that are rewarding |
| 14 | for its volunteers to work in. The majority of contributors send code patches either |
| 15 | fixing bugs, adding new functionalty or otherwise improving the software components of |
| 16 | the distribution. A lesser number contribute in other ways, such as reporting bugs and |
| 17 | regressions, creating tests, providing organisational assistance, or helping to document |
| 18 | Wine. |
| 19 | </para> |
| 20 | |
| 21 | <para> |
| 22 | Documentation is important for many reasons, and is often the key to the end user having |
| 23 | a successful experience in installing, setting up and using software. Because Wine is a |
| 24 | complicated, evolving entity, providing quality up to date documentation is vital to |
| 25 | encourage more people to persevere with using and contributing to the project. |
| 26 | The following sections describe in detail how to go about adding to or updating Wines |
| 27 | existing documentation. |
| 28 | </para> |
| 29 | |
| 30 | <sect1 id="doc-overview"> |
| 31 | <title>An Overview Of Wine Documentation</title> |
| 32 | |
| 33 | <para> |
| 34 | The Wine source code tree comes with a large amount of documentation in the |
| 35 | <filename>documentation/</filename> subdirectory. This used to be a collection |
| 36 | of text files culled from various places such as the Wine Weekly News and the wine-devel |
| 37 | mailing list, but was reorganised some time ago into a number of books, each of which is |
| 38 | marked up using SGML. You are reading one of these books (the |
| 39 | <emphasis>Wine Developer's Guide</emphasis>) right now. |
| 40 | </para> |
| 41 | |
| 42 | <para> |
| 43 | Since being reorganised, the books have been updated and extended regularly. In their |
| 44 | current state they provide a good framework which over time can be expanded and kept |
| 45 | up to date. This means that most of the time when further documentation is added, it is |
| 46 | a simple matter of updating the content of an already existing file. The books |
| 47 | available at the time of writing are: |
| 48 | |
| 49 | <itemizedlist> |
| 50 | |
| 51 | <listItem><para> |
| 52 | The <emphasis>Wine User Guide</emphasis>. This book contains information for end users |
| 53 | on installing, configuring and running Wine. |
| 54 | </para></listitem> |
| 55 | |
| 56 | <listItem><para> |
| 57 | The <emphasis>Wine Developer's Guide</emphasis>. This book contains information and |
| 58 | guidelines for developers and contributors to the Wine project. |
| 59 | </para></listitem> |
| 60 | |
| 61 | <listItem><para> |
| 62 | The <emphasis>Winelib User's Guide</emphasis>. This book contains information for |
| 63 | developers using Winelib to port Win32 applications to Unix. |
| 64 | </para></listitem> |
| 65 | |
| 66 | <listItem><para> |
| 67 | The <emphasis>Wine Packagers Guide</emphasis>. This book contains information for |
| 68 | anyone who will be distributing Wine to end users in a prepackaged format. |
| 69 | </para></listitem> |
| 70 | |
| 71 | <listItem><para> |
| 72 | The <emphasis>Wine FAQ</emphasis>. This book contains frequently asked questions |
| 73 | about Wine with their answers. |
| 74 | </para></listitem> |
| 75 | </itemizedlist> |
| 76 | </para> |
| 77 | |
| 78 | <para> |
| 79 | Another source of documentation is the <emphasis>Wine API Guide</emphasis>. This is |
| 80 | generated information taken from special comments placed in the Wine source code. |
| 81 | When you update or add new API calls to Wine you should consider documenting them so |
| 82 | that developers can determine what the API does and how it should be used. |
| 83 | </para> |
| 84 | |
| 85 | <para> |
| 86 | The next sections describe how to create Wine API documentation and how to work with |
| 87 | SGML so you can add to the existing books. |
| 88 | </para> |
| 89 | </sect1> |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 90 | |
| 91 | <sect1 id="api-docs"> |
| 92 | <title>Writing Wine API Documentation</title> |
| 93 | |
| 94 | <para> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 95 | Written by &name-jon-griffiths; <email>&email-jon-griffiths;</email> |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 96 | </para> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 97 | |
| 98 | <sect2 id="api-docs-intro"> |
| 99 | <title>Introduction to API Documentation</title> |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 100 | <para> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 101 | Wine includes a large amount of documentation on the API functions |
| 102 | it implements. There are serveral reasons to want to document the Win32 |
| 103 | API: |
| 104 | <itemizedlist> |
| 105 | |
| 106 | <listItem><para> |
| 107 | To allow Wine developers to know what each function should do, should |
| 108 | they need to update or fix it. |
| 109 | </para></listitem> |
| 110 | |
| 111 | <listItem><para> |
| 112 | To allow Winelib users to understand the functions that are available |
| 113 | to their applications. |
| 114 | </para></listitem> |
| 115 | |
| 116 | <listItem><para> |
| 117 | To provide an alternative source of free documentation on the Win32 API. |
| 118 | </para></listitem> |
| 119 | |
| 120 | <listItem><para> |
| 121 | To provide more accurate documentation where the existing documentation |
| 122 | is accendentally or deliberately vague or misleading. |
| 123 | </para></listitem> |
| 124 | |
| 125 | </itemizedlist> |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 126 | </para> |
| 127 | |
| 128 | <para> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 129 | To this end, a semi formalised way of producing documentation from the Wine |
| 130 | source code has evolved. Since the primary users of API documentation are Wine |
| 131 | developers themselves, documentation is usually inserted into the source code |
| 132 | in the form of comments and notes. Good things to include in the documentation |
| 133 | of a function include: |
| 134 | <itemizedlist> |
| 135 | |
| 136 | <listItem><para> |
| 137 | The purpose of the function. |
| 138 | </para></listitem> |
| 139 | |
| 140 | <listItem><para> |
| 141 | The parameters of the function and their purpose. |
| 142 | </para></listitem> |
| 143 | |
| 144 | <listItem><para> |
| 145 | The return value of the function, in success as well as failure cases. |
| 146 | </para></listitem> |
| 147 | |
| 148 | <listItem><para> |
| 149 | Additional notes such as interaction with other parts of the system, differences |
| 150 | between Wines implementation and Win32s, errors in MSDN documentation, |
| 151 | undocumented cases and bugs that Wine corrects or is compatable with. |
| 152 | </para></listitem> |
| 153 | |
| 154 | </itemizedlist> |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 155 | </para> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 156 | |
| 157 | <para> |
| 158 | Good documentation helps developers be aware of the effects of making changes. It |
| 159 | also allows good tests to be written which cover all of the documented cases. |
| 160 | </para> |
| 161 | |
| 162 | <para> |
| 163 | Note that you do not need to be a programmer to update the documentation in Wine. |
| 164 | If you would like to contribute to the project, patches that improve the API |
| 165 | documentation are welcome. The following describes how to format any documentation |
| 166 | that you write so that the Wine documentation generator can extract it and make it |
| 167 | available to other developers and users. |
| 168 | </para> |
| 169 | |
| 170 | <para> |
| 171 | In general, if you did not write the function in question, you should be wary of |
| 172 | adding comments to other peoples code. It is quite possible you may misunderstand |
| 173 | or misrepresent what the original author intended! Adding API documentation on |
| 174 | the other hand can be done by anybody, since in most cases there is plenty of |
| 175 | information about what a function is supposed to do (if it isn't obvious) |
| 176 | available in books and articles on the internet. |
| 177 | </para> |
| 178 | |
| 179 | <para> |
| 180 | A final warning concerns copyright and must be noted. If you read MSDN or any |
| 181 | publication in order to find out what an API call does, you must be aware that |
| 182 | the text you are reading is copyrighted and in most cases cannot legally be |
| 183 | reproduced without the authors permission. If you copy verbatim any information |
| 184 | from such sources and submit it for inclusion into Wine, you open yourself up |
| 185 | to potential legal liability. You must ensure that anything you submit is |
| 186 | your own work, although it can be based on your understanding gleaned from |
| 187 | reading other peoples work. |
| 188 | </para> |
| 189 | </sect2> |
| 190 | |
| 191 | <sect2 id="api-docs-basics"> |
| 192 | <title>Basic API Documentation</title> |
| 193 | |
| 194 | <para> |
| 195 | The general form of an API comment in Wine is a block comment immediately before a |
| 196 | function is implemented in the source code. General comments within a function body or |
| 197 | at the top of an implementation file are ignored by the API documentation generator. |
| 198 | Such comments are for the benefit of developers only, for example to explain what the |
| 199 | source code is doing or to describe something that may not be obvious to the person |
| 200 | reading the source code. |
| 201 | </para> |
| 202 | |
| 203 | <para> |
| 204 | The following text uses the function <emphasis>PathRelativePathToA()</emphasis> from |
| 205 | <filename>SHLWAPI.DLL</filename> as an example. You can find this function in the Wine |
| 206 | source code tree in the file <filename>dlls/shlwapi/path.c</filename>. |
| 207 | </para> |
| 208 | |
| 209 | <para> |
| 210 | The first line of the comment gives the name of the function, the DLL that the |
| 211 | function is exported from, and its export ordinal number. This is the simplest |
| 212 | (and most common type of) comment: |
| 213 | </para> |
| 214 | |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 215 | <screen> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 216 | /************************************************************************* |
| 217 | * PathRelativePathToA [SHLWAPI.@] |
| 218 | */ |
| 219 | </screen> |
| 220 | |
| 221 | <para> |
| 222 | The functions name and the DLL name are obvious. The ordinal number takes one of |
| 223 | two forms: Either <command>@</command> as in the above, or a number if the export |
| 224 | is exported by ordinal. You can see which to use by looking at the DLL's |
| 225 | <filename>.spec</filename> file. If the line on which the function is listed begins |
| 226 | with a number, use it, otherwise use the <command>@</command> symbol, which indicates |
| 227 | that this function is imported only by name. |
| 228 | </para> |
| 229 | |
| 230 | <para> |
| 231 | Note also that round or square brackets can be used, and whitespace between the name |
| 232 | and the DLL/ordinal is free form. Thus the following is equally valid: |
| 233 | </para> |
| 234 | |
| 235 | <screen> |
| 236 | /************************************************************************* |
| 237 | * PathRelativePathToA (SHLWAPI.@) |
| 238 | */ |
| 239 | </screen> |
| 240 | |
| 241 | <para> |
| 242 | This basic comment will not get processed into documentation, since it |
| 243 | contains no information. In order to produce documentation for the function, |
| 244 | We must add some of the information listed above. |
| 245 | </para> |
| 246 | |
| 247 | <para> |
| 248 | First we add a description of the function. This can be as long as you like, but |
| 249 | typically contains only a brief description of what the function is meant to do |
| 250 | in general terms. It is free form text: |
| 251 | </para> |
| 252 | |
| 253 | <screen> |
| 254 | /************************************************************************* |
| 255 | * PathRelativePathToA [SHLWAPI.@] |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 256 | * |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 257 | * Create a relative path from one path to another. |
| 258 | */ |
| 259 | </screen> |
| 260 | |
| 261 | <para> |
| 262 | To be truly useful however we must document the parameters to the function. |
| 263 | There are two methods for doing this: In the comment, or in the function |
| 264 | prototype. |
| 265 | </para> |
| 266 | |
| 267 | <para> |
| 268 | Parameters documented in the comment should be formatted as follows: |
| 269 | </para> |
| 270 | |
| 271 | <screen> |
| 272 | /************************************************************************* |
| 273 | * PathRelativePathToA [SHLWAPI.@] |
| 274 | * |
| 275 | * Create a relative path from one path to another. |
| 276 | * |
| 277 | * PARAMS |
| 278 | * lpszPath [O] Destination for relative path |
| 279 | * lpszFrom [I] Source path |
| 280 | * dwAttrFrom [I] File attribute of source path |
| 281 | * lpszTo [I] Destination path |
| 282 | * dwAttrTo [I] File attributes of destination path |
| 283 | * |
| 284 | */ |
| 285 | </screen> |
| 286 | |
| 287 | <para> |
| 288 | The parameters section starts with <command>PARAMS</command> on its own line. |
| 289 | Each parameter is listed in the order they appear in the functions prototype, |
| 290 | first with the parameters name, followed by its input/output status, followed |
| 291 | by a free form text description of the comment. |
| 292 | </para> |
| 293 | |
| 294 | <para> |
| 295 | The input/output status tells the programmer whether the value will be modified |
| 296 | by the function (an output parameter), or only read (an input parameter). The |
| 297 | status must be enclosed in square brackets to be recognised, otherwise, or if it |
| 298 | is absent, anything following the parameter name is treated as the parameter |
| 299 | description. This field is case insensitive and can be any of the following: |
| 300 | <command>[I]</command>, <command>[In]</command>, <command>[O]</command>, |
| 301 | <command>[Out]</command>, <command>[I/O]</command>, <command>[In/Out]</command>. |
| 302 | </para> |
| 303 | |
| 304 | <para> |
| 305 | Parameters documented in the prototype should be formatted as follows: |
| 306 | </para> |
| 307 | |
| 308 | <screen> |
| 309 | /************************************************************************* |
| 310 | * PathRelativePathToA [SHLWAPI.@] |
| 311 | * |
| 312 | * Create a relative path from one path to another. |
| 313 | * |
| 314 | */ |
| 315 | BOOL WINAPI PathRelativePathToA( |
| 316 | LPSTR lpszPath, /* [O] Destination for relative path */ |
| 317 | LPCSTR lpszFrom, /* [I] Source path */ |
| 318 | DWORD dwAttrFrom, /* [I] File attribute of source path */ |
| 319 | LPCSTR lpszTo, /* [I] Destination path */ |
| 320 | DWORD dwAttrTo) /* [I] File attributes of destination path */ |
| 321 | </screen> |
| 322 | |
| 323 | <para> |
| 324 | The choice of which style to use is up to you, although for readability it |
| 325 | is suggested you stick with the same style within a single source file. |
| 326 | </para> |
| 327 | |
| 328 | <para> |
| 329 | Following the description and parameters come a number of optional sections, all |
| 330 | in the same format. A section is defined as the section name, which is an all upper |
| 331 | case section name on its own line, followed by free form text. You can create any |
| 332 | sections you like, however for consistency it is recommended you use the following |
| 333 | section names: |
| 334 | <orderedlist> |
| 335 | |
| 336 | <listItem><para> |
| 337 | <command>NOTES</command>. Anything that needs to be noted about the function |
| 338 | such as special cases and the effects of input arguments. |
| 339 | </para></listitem> |
| 340 | |
| 341 | <listItem><para> |
| 342 | <command>BUGS</command>. Any bugs in the function that exist 'by design', i.e. |
| 343 | those that will not be fixed or exist for compatability with Windows. |
| 344 | </para></listitem> |
| 345 | |
| 346 | <listItem><para> |
| 347 | <command>TODO</command>. Any unhandled cases or missing functionality in the Wine |
| 348 | implementation of the function. |
| 349 | </para></listitem> |
| 350 | |
| 351 | <listItem><para> |
| 352 | <command>FIXME</command>. Things that should be updated or addressed in the implementation |
| 353 | of the function at some future date (perhaps dependent on other parts of Wine). Note |
| 354 | that if this information is only relevant to Wine developers then it should probably |
| 355 | be placed in the relavent code section instead. |
| 356 | </para></listitem> |
| 357 | </orderedlist> |
| 358 | </para> |
| 359 | |
| 360 | <para> |
| 361 | Following or before the optional sections comes the <command>RETURNS</command> section |
| 362 | which describes the return value of the function. This is free form text but should include |
| 363 | what is returned on success as well as possible error return codes. Note that this |
| 364 | section must be present for documentation to be generated for your comment. |
| 365 | </para> |
| 366 | |
| 367 | <para> |
| 368 | Our final documentation looks like the following: |
| 369 | </para> |
| 370 | |
| 371 | <screen> |
| 372 | /************************************************************************* |
| 373 | * PathRelativePathToA [SHLWAPI.@] |
| 374 | * |
| 375 | * Create a relative path from one path to another. |
| 376 | * |
| 377 | * PARAMS |
| 378 | * lpszPath [O] Destination for relative path |
| 379 | * lpszFrom [I] Source path |
| 380 | * dwAttrFrom [I] File attribute of source path |
| 381 | * lpszTo [I] Destination path |
| 382 | * dwAttrTo [I] File attributes of destination path |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 383 | * |
| 384 | * RETURNS |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 385 | * TRUE If a relative path can be formed. lpszPath contains the new path |
| 386 | * FALSE If the paths are not relative or any parameters are invalid |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 387 | * |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 388 | * NOTES |
| 389 | * lpszTo should be at least MAX_PATH in length. |
| 390 | * Calling this function with relative paths for lpszFrom or lpszTo may |
| 391 | * give erroneous results. |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 392 | * |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 393 | * The Win32 version of this function contains a bug where the lpszTo string |
| 394 | * may be referenced 1 byte beyond the end of the string. As a result random |
| 395 | * garbage may be written to the output path, depending on what lies beyond |
| 396 | * the last byte of the string. This bug occurs because of the behaviour of |
| 397 | * PathCommonPrefix() (see notes for that function), and no workaround seems |
| 398 | * possible with Win32. |
| 399 | * This bug has been fixed here, so for example the relative path from "\\" |
| 400 | * to "\\" is correctly determined as "." in this implementation. |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 401 | */ |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 402 | </screen> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 403 | </sect2> |
| 404 | |
| 405 | <sect2 id="api-docs-advanced"> |
| 406 | <title>Advanced API Documentation</title> |
| 407 | |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 408 | <para> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 409 | There is no markup language for formatting API comments, since they should |
| 410 | be easily readable by any developer working on the source file. A number of |
| 411 | constructs are treated specially however, and are noted here. You can use these |
| 412 | constructs to enhance the usefulness of the generated documentation by making it |
| 413 | easier to read and referencing related documents. |
| 414 | </para> |
| 415 | |
| 416 | <para> |
| 417 | Any valid c identifier that ends with <command>()</command> is taken to |
| 418 | be an API function and is formatted accordingly. When generating documentation, |
| 419 | this text will become a link to that API call, if the output type supports |
| 420 | hyperlinks or their equivalent. |
| 421 | </para> |
| 422 | |
| 423 | <para> |
| 424 | Similarly, any interface name starting with a capital I and followed by the |
| 425 | words "reference" or "object" become a link to that objects documentation. |
| 426 | </para> |
| 427 | |
| 428 | <para> |
| 429 | Where an Ascii and Unicode version of a function are available, it is |
| 430 | recommended that you document only the Ascii version and have the Unicode |
| 431 | version refer to the Ascii one, as follows: |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 432 | </para> |
| 433 | <screen> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 434 | /************************************************************************* |
| 435 | * PathRelativePathToW [SHLWAPI.@] |
| 436 | * |
| 437 | * See PathRelativePathToA. |
| 438 | */ |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 439 | </screen> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 440 | <para> |
| 441 | Alternately you may use the following form: |
| 442 | </para> |
| 443 | <screen> |
| 444 | /************************************************************************* |
| 445 | * PathRelativePathToW [SHLWAPI.@] |
| 446 | * |
| 447 | * Unicode version of PathRelativePathToA. |
| 448 | */ |
| 449 | </screen> |
| 450 | |
| 451 | <para> |
| 452 | You may also use this construct in any other section, such as <command>NOTES</command>. |
| 453 | </para> |
| 454 | |
| 455 | <para> |
| 456 | Any numbers and text in quotes (<command>""</command>) are highlighted. |
| 457 | </para> |
| 458 | |
| 459 | <para> |
| 460 | Words in all uppercase are assumed to be API constants and are highlighted. If |
| 461 | you want to emphasise something in the documentation, put it in a section by itself |
| 462 | rather than making it upper case. |
| 463 | </para> |
| 464 | |
| 465 | <para> |
| 466 | Blank lines in a section cause a new paragraph to be started. Blank lines |
| 467 | at the start and end of sections are ignored. |
| 468 | </para> |
| 469 | |
| 470 | <para> |
| 471 | Any comment line starting with (<command>"*|"</command>) is treated as raw text and |
| 472 | is not pre-processed before being output. This should be used for code listings, |
| 473 | tables and any text that should remain unformatted. |
| 474 | </para> |
| 475 | |
| 476 | <para> |
| 477 | Any line starting with a single word followed by a colon (<command>:</command>) |
| 478 | is assumed to be case listing and is emphasised and put in its own paragrah. This |
| 479 | is most often used for return values, as in the example section below. |
| 480 | </para> |
| 481 | <screen> |
| 482 | * RETURNS |
| 483 | * Success: TRUE. Something happens that is documented here. |
| 484 | * Failure: FALSE. The reasons why this call can fail are listed here. |
| 485 | </screen> |
| 486 | |
| 487 | <para> |
| 488 | Any line starting with a (<command>-</command>) is put into a paragraph by itself. |
| 489 | this allows lists to avoid being run together. |
| 490 | </para> |
| 491 | |
| 492 | <para> |
| 493 | If you are in doubt as to how your comment will look, try generating the API |
| 494 | documentation and checking the output. |
| 495 | </para> |
| 496 | </sect2> |
| 497 | |
| 498 | <sect2 id="api-docs-extra"> |
| 499 | <title>Extra API Documentation</title> |
| 500 | |
| 501 | <para> |
| 502 | Simply documenting the API calls available provides a great deal of information to |
| 503 | developers working with the Win32 API. However additional documentation is needed |
| 504 | before the API Guide can be considered truly useful or comprehensive. For example, |
| 505 | COM objects that are available for developers use should be documented, along with |
| 506 | the interface(s) that those objects export. Also, it would be helpful to document |
| 507 | each dll, to provide some structure to the documentation. |
| 508 | </para> |
| 509 | |
| 510 | <para> |
| 511 | To facilitate providing extra documentation, you can create comments that provide |
| 512 | extra documentation on functions, or on keywords such as the name of a COM interface |
| 513 | or a type definition. |
| 514 | </para> |
| 515 | |
| 516 | <para> |
| 517 | These items are generated using the same formatting rules as described earlier. The |
| 518 | only difference is the first line of the comment, which indicates to the generator |
| 519 | that the documentation is supplimental and does not describe an export from the dll |
| 520 | being processed. |
| 521 | </para> |
| 522 | |
| 523 | <para> |
| 524 | Lets assume you have implemented a COM interface that you want to document; we'll |
| 525 | use the name <command>IExample</command> as an example here. Your comment would |
| 526 | look like the following (assuming you are exporting this object from |
| 527 | <filename>EXAMPLE.DLL</filename>): |
| 528 | <screen> |
| 529 | /************************************************************************* |
| 530 | * IExample {EXAMPLE} |
| 531 | * |
| 532 | * The IExample object provides lots of interesting functionality. |
| 533 | * ... |
| 534 | */ |
| 535 | </screen> |
| 536 | </para> |
| 537 | |
| 538 | <para> |
| 539 | Format this documentation exactly as you would a standard export. The only |
| 540 | difference is the use of curly brackets to mark this documentation as supplimental. |
| 541 | The generator will output this documentation using the name given before the |
| 542 | DLL name, and will link to it from the main DLL page. In addition, if you have |
| 543 | referred to the comment name in other documentation using "IExample interface", |
| 544 | "IExample object", or "IExample()", those references will point to this documentation. |
| 545 | </para> |
| 546 | |
| 547 | <para> |
| 548 | If you document you COM interfaces this way then all following extra comments that |
| 549 | follow in the same source file that begin with the same document title will be added |
| 550 | as references to this comment before it is output. For an example of this see |
| 551 | <filename>dlls/oleaut32/safearray.c</filename>. This uses an extra comment to document |
| 552 | The SafeArray functions and link them together under one heading. |
| 553 | </para> |
| 554 | |
| 555 | <para> |
| 556 | As a special case, if you use the DLL name as the comment name, the comment will |
| 557 | be treated as documentation on the DLL itself. When the documentation for the DLL |
| 558 | is processed, the contents of the comment will be placed before the generated |
| 559 | statistics, exports and other information that makes up a DLL's documentation page. |
| 560 | </para> |
| 561 | </sect2> |
| 562 | |
| 563 | <sect2 id="api-docs-generating"> |
| 564 | <title>Generating API Documentation</title> |
| 565 | |
| 566 | <para> |
| 567 | Having edited or added new API documentation to a source code file, you |
| 568 | should generate the documentation to ensure that the result is what you |
| 569 | expected. Wine includes a tool (slightly misleadingly) called |
| 570 | <command>c2man.pl</command> in the <filename>tools/</filename> directory |
| 571 | which is used to generate the documentation from the source code. |
| 572 | </para> |
| 573 | |
| 574 | <para> |
| 575 | You can run <command>c2man.pl</command> manually for testing purposes; it is |
| 576 | a fairly simple perl script which parses <filename>.c</filename> files |
| 577 | to create output in several formats. If you wish to try this you may want |
| 578 | to run it with no arguments, which will cause it to print usage information. |
| 579 | </para> |
| 580 | |
| 581 | <para> |
| 582 | An easier way is to use Wines build system. To create man pages for a given |
| 583 | dll, just type <command>make man</command> from within the dlls directory |
| 584 | or type <command>make manpages</command> in the root directory of the Wine |
| 585 | source tree. You can then check that a man page was generated for your function, |
| 586 | it should be present in the <filename>documentation/man3w</filename> directory |
| 587 | with the same name as the function. |
| 588 | </para> |
| 589 | |
| 590 | <para> |
| 591 | Once you have generated the man pages from the source code, running |
| 592 | <command>make install</command> will install them for you. By default they are |
| 593 | installed in section 3w of the manual, so they don't conflict with any existing |
| 594 | man page names. So, to read the man page you should use |
| 595 | <command>man -S 3w {name}</command>. Alternately you can edit |
| 596 | <filename>/etc/man.config</filename> and add 3w to the list of search paths |
| 597 | given in the variable <emphasis>MANSECT</emphasis>. |
| 598 | </para> |
| 599 | |
| 600 | <para> |
| 601 | You can also generate HTML output for the API documentation, in this case the |
| 602 | make command is <command>make doc-html</command> in the dll directory, |
| 603 | or <command>make htmlpages</command> from the root. The output will be |
| 604 | placed by default under <filename>documentation/html</filename>. Similarly |
| 605 | you can create SGML source code to produce the <emphasis>Wine Api Guide</emphasis> |
| 606 | with the command <command>make sgmlpages</command>. |
| 607 | </para> |
| 608 | </sect2> |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 609 | </sect1> |
John R. Sheets | d1c9c0c | 2001-02-12 01:14:34 +0000 | [diff] [blame] | 610 | |
| 611 | <sect1 id="wine-docbook"> |
| 612 | <title>The Wine DocBook System</title> |
| 613 | |
| 614 | <para> |
| 615 | Written by &name-john-sheets; <email>&email-john-sheets;</email> |
| 616 | </para> |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 617 | <para> |
| 618 | Modified by &name-tony-lambregts; <email>&email-tony-lambregts;</email> Nov. 2002 |
| 619 | </para> |
John R. Sheets | d1c9c0c | 2001-02-12 01:14:34 +0000 | [diff] [blame] | 620 | |
| 621 | <sect2 id="writing-docbook"> |
| 622 | <title>Writing Documentation with DocBook</title> |
| 623 | |
| 624 | <para> |
| 625 | DocBook is a flavor of <acronym>SGML</acronym> |
| 626 | (<firstterm>Standard Generalized Markup |
| 627 | Language</firstterm>), a syntax for marking up the contents |
| 628 | of documents. HTML is another very common flavor of SGML; |
| 629 | DocBook markup looks very similar to HTML markup, although |
| 630 | the names of the markup tags differ. |
| 631 | </para> |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 632 | <sect3> |
| 633 | <title>Getting Started</title> |
| 634 | <note> |
| 635 | <title>Why SGML?</title> |
| 636 | <para> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 637 | The simple answer to that is that SGML allows you |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 638 | to create multiple formats of a given document from a single |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 639 | source. Currently it is used to create html, pdf and PS (PostScript) |
| 640 | versions of the Wine books. |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 641 | </para> |
| 642 | </note> |
John R. Sheets | d1c9c0c | 2001-02-12 01:14:34 +0000 | [diff] [blame] | 643 | |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 644 | <note> |
| 645 | <title>What do I need?</title> |
| 646 | <para> |
| 647 | You need the sgml tools. There are various places where you |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 648 | can get them. The most generic way of geting them is from their |
| 649 | source as discussed below. |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 650 | </para> |
| 651 | </note> |
| 652 | |
| 653 | <note> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 654 | <title>Quick instructions</title> |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 655 | <para> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 656 | These are the basic steps to create the Wine books from the sgml source. |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 657 | </para> |
| 658 | </note> |
| 659 | |
| 660 | <orderedlist> |
| 661 | |
| 662 | <listItem><para> |
| 663 | Go to <ulink url="http://www.sgmltools.org">http://www.sgmltools.org</ulink> |
| 664 | </para></listitem> |
| 665 | |
| 666 | <listItem><para> |
| 667 | Download all of the sgmltools packages |
| 668 | </para></listitem> |
| 669 | |
| 670 | <listItem><para> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 671 | Install them all and build them (<command>./configure; make; make install</command>) |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 672 | </para></listitem> |
| 673 | |
| 674 | <listItem><para> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 675 | Switch to your toplevel Wine directory |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 676 | </para></listitem> |
| 677 | |
| 678 | <listItem><para> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 679 | Run <command>./configure</command> (or <command>make distclean && ./configure</command>) |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 680 | </para></listitem> |
| 681 | |
| 682 | <listItem><para> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 683 | Switch to the <filename>documentation/</filename> directory |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 684 | </para></listitem> |
| 685 | |
| 686 | <listItem><para> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 687 | run <command>./make_winehq</command> |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 688 | </para></listitem> |
| 689 | |
| 690 | <listItem><para> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 691 | View <filename>wine-doc/index.html</filename> in your favorite browser |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 692 | </para></listitem> |
| 693 | |
| 694 | </orderedlist> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 695 | |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 696 | </sect3> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 697 | |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 698 | <sect3> |
| 699 | <title>Getting SGML for various distributions</title> |
| 700 | <para> |
| 701 | Most Linux distributions have everything you need already |
| 702 | bundled up in package form. Unfortunately, each |
| 703 | distribution seems to handle its SGML environment |
| 704 | differently, installing it into different paths, and |
| 705 | naming its packages according to its own whims. |
| 706 | </para> |
| 707 | |
| 708 | <sect4> |
| 709 | <title>SGML on Redhat</title> |
| 710 | <para> |
| 711 | The following packages seems to be sufficient for RedHat 7.1. You |
| 712 | will want to be careful about the order in which you install the |
| 713 | rpms. |
| 714 | <itemizedlist> |
| 715 | <listitem><para>sgml-common-*.rpm</para></listitem> |
| 716 | <listitem><para>openjade-*.rpm</para></listitem> |
| 717 | <listitem><para>perl-SGMLSpm-*.rpm</para></listitem> |
| 718 | <listitem><para>docbook-dtd*.rpm</para></listitem> |
| 719 | <listitem><para>docbook-style-dsssl-*.rpm</para></listitem> |
| 720 | <listitem><para>tetex-*.rpm</para></listitem> |
| 721 | <listitem><para>jadetex-*.rpm</para></listitem> |
| 722 | <listitem><para>docbook-utils-*.rpm</para></listitem> |
| 723 | </itemizedlist> |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 724 | You can also use ghostscript to view the ps format output and |
Tony Lambregts | 442332c | 2002-11-11 22:26:02 +0000 | [diff] [blame] | 725 | Adobe Acrobat 4 to view the pdf file. |
| 726 | </para> |
| 727 | </sect4> |
| 728 | |
| 729 | <sect4> |
| 730 | <title>SGML on Debian</title> |
| 731 | <note> |
| 732 | <title>Fix me</title> |
| 733 | <para> |
| 734 | List package names and install locations... |
| 735 | </para> |
| 736 | </note> |
| 737 | </sect4> |
| 738 | |
| 739 | <sect4> |
| 740 | <title>SGML on Other Distributions</title> |
| 741 | <note> |
| 742 | <title>Fix me</title> |
| 743 | <para> |
| 744 | List package names and install locations... |
| 745 | </para> |
| 746 | </note> |
| 747 | </sect4> |
| 748 | </sect3> |
John R. Sheets | d1c9c0c | 2001-02-12 01:14:34 +0000 | [diff] [blame] | 749 | <sect3> |
| 750 | <title>Terminology</title> |
| 751 | |
| 752 | <para> |
| 753 | SGML markup contains a number of syntactical elements that |
| 754 | serve different purposes in the markup. We'll run through |
| 755 | the basics here to make sure we're on the same page when |
| 756 | we refer to SGML semantics. |
| 757 | </para> |
| 758 | <para> |
| 759 | The basic currency of SGML is the |
| 760 | <firstterm>tag</firstterm>. A simple tag consists of a |
| 761 | pair of angle brackets and the name of the tag. For |
| 762 | example, the <sgmltag>para</sgmltag> tag would appear in |
| 763 | an SGML document as <sgmltag |
| 764 | class="starttag">para</sgmltag>. This start tag indicates |
| 765 | that the immediately following text should be classified |
| 766 | according to the tag. In regular SGML, each opening tag |
| 767 | must have a matching end tag to show where the start tag's |
| 768 | contents end. End tags begin with |
| 769 | <quote><literal></</literal></quote> markup, e.g., |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 770 | <sgmltag class="endtag">para</sgmltag>. |
John R. Sheets | d1c9c0c | 2001-02-12 01:14:34 +0000 | [diff] [blame] | 771 | </para> |
| 772 | <para> |
| 773 | The combination of a start tag, contents, and an end tag |
| 774 | is called an <firstterm>element</firstterm>. SGML |
| 775 | elements can be nested inside of each other, or contain |
| 776 | only text, or may be a combination of both text and other |
| 777 | elements, although in most cases it is better to limit |
Jon Griffiths | 028318b | 2003-03-15 19:42:44 +0000 | [diff] [blame] | 778 | your elements to one or the other. |
John R. Sheets | d1c9c0c | 2001-02-12 01:14:34 +0000 | [diff] [blame] | 779 | </para> |
| 780 | <para> |
| 781 | The <acronym>XML</acronym> (<firstterm>eXtensible Markup |
| 782 | Language</firstterm>) specification, a modern subset of |
| 783 | the SGML specification, adds a so-called <firstterm>empty |
| 784 | tag</firstterm>, for elements that contain no text |
| 785 | content. The entire element is a single tag, ending with |
| 786 | <quote><literal>/></literal></quote>, e.g., |
| 787 | <sgmltag><xref/></sgmltag>. However, use of this |
| 788 | tag style restricts you to XML DocBook processing, and |
| 789 | your document may no longer compile with SGML-only |
| 790 | processing systems. |
| 791 | </para> |
| 792 | <!-- *** Note: We could normally use the "emptytag" |
| 793 | attribute for XML empty tags, but that's only a recent |
| 794 | addition, and we don't want to screw up documents |
| 795 | generated against older stylesheets. |
| 796 | *** --> |
| 797 | <para> |
| 798 | Often a processing system will need more information about |
| 799 | an element than you can provide with just tags. SGML |
| 800 | allows you to add extra <quote>hints</quote> in the form |
| 801 | of SGML <firstterm>attributes</firstterm> to pass along |
| 802 | this information. The most common use of attributes in |
| 803 | DocBook is giving specific elements a name, or an ID, so |
| 804 | you can refer to it from elsewhere. This ID can be used |
| 805 | for many things, including file-naming for HTML output, |
| 806 | hyper-linking to specific parts of the document, and even |
| 807 | pulling text from that element (see the <sgmltag |
| 808 | class="starttag">xref</sgmltag> tag). |
| 809 | </para> |
| 810 | <para> |
| 811 | An SGML attribute appears inside the start tag, between |
| 812 | the < and > brackets. For example, if you wanted to |
| 813 | set the <sgmltag class="attribute">id</sgmltag> attribute |
| 814 | of the <sgmltag class="starttag">book</sgmltag> element to |
| 815 | <quote>mybook</quote>, you would create a start tag like |
| 816 | this: <programlisting><book id="mybook"></programlisting> |
| 817 | </para> |
| 818 | <para> |
| 819 | Notice that the contents of the attribute are enclosed in |
| 820 | quote marks. These quotes are optional in SGML, but |
| 821 | mandatory in XML. It's a good habit to use quotes, as it |
| 822 | will make it much easier to migrate your documents to an |
| 823 | XML processing system later on. |
| 824 | </para> |
| 825 | <para> |
| 826 | You can also specify more than one attribute in a single |
| 827 | tag: <programlisting><book id="mybook" status="draft"></programlisting> |
| 828 | </para> |
| 829 | <para> |
| 830 | Another commonly used type of SGML markup is the |
| 831 | <firstterm>entity</firstterm>. An entity lets you |
| 832 | associate a block of text with a name. You declare the |
| 833 | entity once, at the beginning of your document, and can |
| 834 | invoke it as many times as you like throughout the |
| 835 | document. You can use entities as shorthand, or to make |
| 836 | it easier to maintain certain phrases in a central |
| 837 | location, or even to insert the contents of an entire file |
| 838 | into your document. |
| 839 | </para> |
| 840 | <para> |
| 841 | An entity in your document is always surrounded by the |
| 842 | <quote>&</quote> and <quote>;</quote> characters. One |
| 843 | entity you'll need sooner or later is the one for the |
| 844 | <quote><</quote> character. Since SGML expects all |
| 845 | tags to begin with a <quote><</quote>, the |
| 846 | <quote><</quote> is a reserved character. To use it in |
| 847 | your document (as I am doing here), you must insert it |
| 848 | with the <literal>&lt;</literal> entity. Each time |
| 849 | the SGML processor encounters <literal>&lt;</literal>, |
| 850 | it will place a literal <quote><</quote> in the output |
Bill Medland | e145bde | 2001-10-02 17:48:16 +0000 | [diff] [blame] | 851 | document. Similarly you must use the <literal>&gt;</literal> |
| 852 | and <literal>&amp;</literal> entities for the |
| 853 | <quote>></quote> and <quote>&</quote> characters. |
John R. Sheets | d1c9c0c | 2001-02-12 01:14:34 +0000 | [diff] [blame] | 854 | </para> |
| 855 | <para> |
| 856 | The final term you'll need to know when writing simple |
| 857 | DocBook documents is the <acronym>DTD</acronym> |
| 858 | (<firstterm>Document Type Declaration</firstterm>). The |
| 859 | DTD defines the flavor of SGML a given document is written |
| 860 | in. It lists all the legal tag names, like <sgmltag |
| 861 | class="starttag">book</sgmltag>, <sgmltag |
| 862 | class="starttag">para</sgmltag>, and so on, and declares |
| 863 | how those tags are allowed to be used together. For |
| 864 | example, it doesn't make sense to put a <sgmltag |
| 865 | class="starttag">book</sgmltag> element inside a <sgmltag |
| 866 | class="starttag">para</sgmltag> paragraph element -- only |
| 867 | the reverse. |
| 868 | </para> |
| 869 | <para> |
| 870 | The DTD thus defines the legal structure of the document. |
| 871 | It also declares which attributes can be used with which |
| 872 | tags. The SGML processing system can use the DTD to make |
| 873 | sure the document is laid out properly before attempting |
| 874 | to process it. SGML-aware text editors like <link |
| 875 | linkend="emacs-psgml">Emacs</link> can also use the DTD to |
| 876 | guide you while you write, offering you choices about |
| 877 | which tags you can add in different places in the |
| 878 | document, and beeping at you when you try to add a tag |
| 879 | where it doesn't belong. |
| 880 | </para> |
| 881 | <para> |
| 882 | Generally, you will declare which DTD you want to use as |
| 883 | the first line of your SGML document. In the case of |
| 884 | DocBook, you will use something like this: |
| 885 | <programlisting><!doctype book PUBLIC "-//OASIS//DTD |
| 886 | DocBook V3.1//EN" []> <book> ... |
| 887 | </book></programlisting> |
| 888 | </para> |
| 889 | <para> |
| 890 | Note that you must specify your toplevel element inside |
| 891 | the doctype declaration. If you were writing an article |
| 892 | rather than a book, you might use this declaration instead: |
| 893 | <programlisting><!doctype article PUBLIC "-//OASIS//DTD DocBook V3.1//EN" []> |
| 894 | <article> |
| 895 | ... |
| 896 | </article></programlisting> |
| 897 | </para> |
| 898 | </sect3> |
| 899 | |
| 900 | <sect3 id="sgml-document"> |
| 901 | <title>The Document</title> |
| 902 | <para> |
| 903 | Once you're comfortable with SGML, creating a DocBook |
| 904 | document is quite simple and straightforward. Even |
| 905 | though DocBook contains over 300 different tags, you can |
| 906 | usually get by with only a small subset of those tags. |
| 907 | Most of them are for inline formatting, rather than for |
| 908 | document structuring. Furthermore, the common tags have |
| 909 | short, intuitive names. |
| 910 | </para> |
| 911 | <para> |
| 912 | Below is a (completely nonsensical) example to illustrate |
| 913 | how a simple document might be laid out. Notice that all |
| 914 | <sgmltag class="starttag">chapter</sgmltag> and <sgmltag |
| 915 | class="starttag">sect1</sgmltag> elements have <sgmltag |
| 916 | class="attribute">id</sgmltag> attributes. This is not |
| 917 | mandatory, but is a good habit to get into, as DocBook is |
| 918 | commonly converted into HTML, with a separate generated |
| 919 | file for each <sgmltag class="starttag">book</sgmltag>, |
| 920 | <sgmltag class="starttag">chapter</sgmltag>, and/or <sgmltag |
| 921 | class="starttag">sect1</sgmltag> element. If the given |
| 922 | element has an <sgmltag class="attribute">id</sgmltag> |
| 923 | attribute, the processor will typically name the file |
| 924 | accordingly. Thus, the below document might result in |
| 925 | <filename>index.html</filename>, |
| 926 | <filename>chapter-one.html</filename>, |
| 927 | <filename>blobs.html</filename>, and so on. |
| 928 | </para> |
| 929 | <para> |
| 930 | Also notice the text marked off with <quote><!-- |
| 931 | </quote> and <quote> --></quote> characters. These |
| 932 | denote SGML comments. SGML processors will completely |
| 933 | ignore anything between these markers, similar to |
| 934 | <quote>/*</quote> and <quote>*/</quote> comments in C |
| 935 | source code. |
| 936 | </para> |
| 937 | |
| 938 | <!-- Encase the following SGML excerpt inside a CDATA |
| 939 | block so we don't have to bother converting all |
| 940 | brackets to entities |
| 941 | --> |
| 942 | <programlisting> |
| 943 | <![CDATA[ |
| 944 | <!doctype book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" []> |
| 945 | <book id="index"> |
| 946 | <bookinfo> |
| 947 | <title>A Poet's Guide to Nonsense</title> |
| 948 | </bookinfo> |
| 949 | |
| 950 | <chapter id="chapter-one"> |
| 951 | <title>Blobs and Gribbles</title> |
| 952 | |
| 953 | <!-- This section contains only one major topic --> |
| 954 | <sect1 id="blobs"> |
| 955 | <title>The Story Behind Blobs</title> |
| 956 | <para> |
| 957 | Blobs are often mistaken for ice cubes and rain |
| 958 | puddles... |
| 959 | </para> |
| 960 | </sect1> |
| 961 | |
| 962 | <!-- This section contains embedded sub-sections --> |
| 963 | <sect1 id="gribbles"> |
| 964 | <title>Your Friend the Gribble</title> |
| 965 | <para> |
| 966 | A Gribble is a cute, unassuming little fellow... |
| 967 | </para> |
| 968 | |
| 969 | <sect2 id="gribble-temperament"> |
| 970 | <title>Gribble Temperament</title> |
| 971 | <para> |
| 972 | When left without food for several days... |
| 973 | </para> |
| 974 | </sect2> |
| 975 | |
| 976 | <sect2 id="gribble-appearance"> |
| 977 | <title>Gribble Appearance</title> |
| 978 | <para> |
| 979 | Most Gribbles have a shock of white fur running from... |
| 980 | </para> |
| 981 | </sect2> |
| 982 | </sect1> |
| 983 | </chapter> |
| 984 | |
| 985 | <chapter id="chapter-two"> |
| 986 | <title>Phantasmagoria</title> |
| 987 | |
| 988 | <sect1 id="dretch-pools"> |
| 989 | <title>Dretch Pools</title> |
| 990 | |
| 991 | <para> |
| 992 | When most poets think of Dretch Pools, they tend to... |
| 993 | </para> |
| 994 | </sect> |
| 995 | </chapter> |
| 996 | </book> |
| 997 | ]]> |
| 998 | </programlisting> |
| 999 | </sect3> |
| 1000 | |
| 1001 | <sect3> |
| 1002 | <title>Common Elements</title> |
| 1003 | <para> |
| 1004 | Once you get used to the syntax of SGML, the next hurdle |
| 1005 | in writing DocBook documentation is to learn the many |
| 1006 | DocBook-specific tag names, and when to use them. DocBook |
| 1007 | was created for technical documentation, and as such, the |
| 1008 | tag names and document structure are slanted towards the |
| 1009 | needs of such documentation. |
| 1010 | </para> |
| 1011 | <para> |
| 1012 | To cover its target audience, DocBook declares a wide |
| 1013 | variety of specialized tags, including tags for formatting |
| 1014 | source code (with somewhat of a C/C++ bias), computer |
| 1015 | prompts, GUI application features, keystrokes, and so on. |
| 1016 | DocBook also includes tags for universal formatting needs, |
| 1017 | like headers, footnotes, tables, and graphics. |
| 1018 | </para> |
| 1019 | <para> |
| 1020 | We won't cover all of these elements here (over 300 |
| 1021 | DocBook tags exist!), but we will cover the basics. To |
| 1022 | learn more about the other tags, check out the official |
| 1023 | DocBook guide, at <ulink |
| 1024 | url="http://docbook.org">http://docbook.org</ulink>. To |
| 1025 | see how they are used in practice, download the SGML |
| 1026 | source for this manual (the Wine Developer Guide) and |
| 1027 | browse through it, comparing it to the generated HTML (or |
| 1028 | PostScript or PDF). |
| 1029 | </para> |
| 1030 | <para> |
| 1031 | There are often many correct ways to mark up a given piece |
| 1032 | of text, and you may have to make guesses about which tag |
| 1033 | to use. Sometimes you'll have to make compromises. |
| 1034 | However, remember that it is possible to further <link |
| 1035 | linkend="docbook-tweaking">customize the output</link> of |
| 1036 | the SGML processors. If you don't like the way a certain |
| 1037 | tag looks in HTML, that doesn't mean you should choose a |
| 1038 | different tag based on its output formatting. The |
| 1039 | processing stylesheets can be altered to fix the |
| 1040 | formatting of that same tag everywhere in the document |
| 1041 | (not just in the place you're working on). For example, |
| 1042 | if you're frustrated that the <sgmltag |
| 1043 | class="starttag">systemitem</sgmltag> tag doesn't produce |
| 1044 | any formatting by default, you should fix the stylesheets, |
| 1045 | not change the valid <sgmltag |
| 1046 | class="starttag">systemitem</sgmltag> tag to, for example, |
| 1047 | an <sgmltag class="starttag">emphasis</sgmltag> tag. |
| 1048 | </para> |
| 1049 | <para> |
| 1050 | Here are the common SGML elements: |
| 1051 | </para> |
| 1052 | |
| 1053 | <variablelist> |
| 1054 | <title>Structural Elements</title> |
| 1055 | <varlistentry> |
| 1056 | <term><sgmltag class="starttag">book</sgmltag></term> |
| 1057 | <listitem> |
| 1058 | <para> |
| 1059 | The book is the most common toplevel element, and is |
| 1060 | probably the one you should use for your document. |
| 1061 | </para> |
| 1062 | </listitem> |
| 1063 | </varlistentry> |
| 1064 | <varlistentry> |
| 1065 | <term><sgmltag class="starttag">set</sgmltag></term> |
| 1066 | <listitem> |
| 1067 | <para> |
| 1068 | If you want to group more than one book into a |
| 1069 | single unit, you can place them all inside a set. |
| 1070 | This is useful when you want to bundle up |
| 1071 | documentation in alternate ways. We do this with |
| 1072 | the Wine documentation, using a <sgmltag |
| 1073 | class="starttag">set</sgmltag> to put everything |
| 1074 | into a single directory (see |
| 1075 | <filename>documentation/wine-doc.sgml</filename>), |
| 1076 | and a <sgmltag class="starttag">book</sgmltag> to |
| 1077 | put each Wine guide into a separate directory (see |
| 1078 | <filename>documentation/wine-devel.sgml</filename>, |
| 1079 | etc.). |
| 1080 | </para> |
| 1081 | </listitem> |
| 1082 | </varlistentry> |
| 1083 | <varlistentry> |
| 1084 | <term><sgmltag class="starttag">chapter</sgmltag></term> |
| 1085 | <listitem> |
| 1086 | <para> |
| 1087 | A <sgmltag class="starttag">chapter</sgmltag> |
| 1088 | element includes a single entire chapter of the |
| 1089 | book. |
| 1090 | </para> |
| 1091 | </listitem> |
| 1092 | </varlistentry> |
| 1093 | <varlistentry> |
| 1094 | <term><sgmltag class="starttag">part</sgmltag></term> |
| 1095 | <listitem> |
| 1096 | <para> |
| 1097 | If the chapters in your book fall into major |
| 1098 | categories or groupings (as in the Wine Developer |
| 1099 | Guide), you can place each collection of chapters |
| 1100 | into a <sgmltag class="starttag">part</sgmltag> |
| 1101 | element. |
| 1102 | </para> |
| 1103 | </listitem> |
| 1104 | </varlistentry> |
| 1105 | <varlistentry> |
| 1106 | <term><sgmltag class="starttag">sect?</sgmltag></term> |
| 1107 | <listitem> |
| 1108 | <para> |
| 1109 | DocBook has many section elements to divide the |
| 1110 | contents of a chapter into smaller chunks. The |
| 1111 | encouraged approach is to use the numbered section |
| 1112 | tags, <sgmltag class="starttag">sect1</sgmltag>, |
| 1113 | <sgmltag class="starttag">sect2</sgmltag>, <sgmltag |
| 1114 | class="starttag">sect3</sgmltag>, <sgmltag |
| 1115 | class="starttag">sect4</sgmltag>, and <sgmltag |
| 1116 | class="starttag">sect5</sgmltag> (if necessary). |
| 1117 | These tags must be nested in order: you can't place |
| 1118 | a <sgmltag class="starttag">sect3</sgmltag> directly |
| 1119 | inside a <sgmltag class="starttag">sect1</sgmltag>. |
| 1120 | You have to nest the <sgmltag |
| 1121 | class="starttag">sect3</sgmltag> inside a <sgmltag |
| 1122 | class="starttag">sect2</sgmltag>, and so forth. |
| 1123 | Documents with these explicit section groupings are |
| 1124 | easier for SGML processors to deal with, and lead to |
| 1125 | better organized documents. DocBook also supplies a |
| 1126 | <sgmltag class="starttag">section</sgmltag> element |
| 1127 | which you can nest inside itself, but its use is |
| 1128 | discouraged in favor of the numbered section tags. |
| 1129 | </para> |
| 1130 | </listitem> |
| 1131 | </varlistentry> |
| 1132 | <varlistentry> |
| 1133 | <term><sgmltag class="starttag">title</sgmltag></term> |
| 1134 | <listitem> |
| 1135 | <para> |
| 1136 | The title of a book, chapter, part, section, etc. |
| 1137 | In most of the major structural elements, like |
| 1138 | <sgmltag class="starttag">chapter</sgmltag>, |
| 1139 | <sgmltag class="starttag">part</sgmltag>, and the |
| 1140 | various section tags, <sgmltag |
| 1141 | class="starttag">title</sgmltag> is mandatory. In |
| 1142 | other elements like <sgmltag |
| 1143 | class="starttag">book</sgmltag> and <sgmltag |
| 1144 | class="starttag">note</sgmltag>, it's optional. |
| 1145 | </para> |
| 1146 | </listitem> |
| 1147 | </varlistentry> |
| 1148 | <varlistentry> |
| 1149 | <term><sgmltag class="starttag">para</sgmltag></term> |
| 1150 | <listitem> |
| 1151 | <para> |
| 1152 | The basic unit of text is the paragraph, represented |
| 1153 | by the <sgmltag class="starttag">para</sgmltag> tag. |
| 1154 | This is probably the tag you'll use most often. In |
| 1155 | fact, in a simple document, you can probably get |
| 1156 | away with using only <sgmltag |
| 1157 | class="starttag">book</sgmltag>, <sgmltag |
| 1158 | class="starttag">chapter</sgmltag>, <sgmltag |
| 1159 | class="starttag">title</sgmltag>, and <sgmltag |
| 1160 | class="starttag">para</sgmltag>. |
| 1161 | </para> |
| 1162 | </listitem> |
| 1163 | </varlistentry> |
| 1164 | <varlistentry> |
| 1165 | <term><sgmltag class="starttag">article</sgmltag></term> |
| 1166 | <listitem> |
| 1167 | <para> |
| 1168 | For shorter, more targeted documents, like topic |
| 1169 | pieces and whitepapers, you can use <sgmltag |
| 1170 | class="starttag">article</sgmltag> as your toplevel |
| 1171 | element. |
| 1172 | </para> |
| 1173 | </listitem> |
| 1174 | </varlistentry> |
| 1175 | </variablelist> |
| 1176 | |
| 1177 | <variablelist> |
| 1178 | <title>Inline Formatting Elements</title> |
| 1179 | <varlistentry> |
| 1180 | <term><sgmltag class="starttag">filename</sgmltag></term> |
| 1181 | <listitem> |
| 1182 | <para> |
| 1183 | The name of a file. You can optionally set the |
| 1184 | <sgmltag class="attribute">class</sgmltag> attribute |
| 1185 | to <literal>Directory</literal>, |
| 1186 | <literal>HeaderFile</literal>, and |
| 1187 | <literal>SymLink</literal> to further classify the |
| 1188 | filename. |
| 1189 | </para> |
| 1190 | </listitem> |
| 1191 | </varlistentry> |
| 1192 | <varlistentry> |
| 1193 | <term><sgmltag class="starttag">userinput</sgmltag></term> |
| 1194 | <listitem> |
| 1195 | <para> |
| 1196 | Literal text entered by the user. |
| 1197 | </para> |
| 1198 | </listitem> |
| 1199 | </varlistentry> |
| 1200 | <varlistentry> |
| 1201 | <term><sgmltag class="starttag">computeroutput</sgmltag></term> |
| 1202 | <listitem> |
| 1203 | <para> |
| 1204 | Literal text output by the computer. |
| 1205 | </para> |
| 1206 | </listitem> |
| 1207 | </varlistentry> |
| 1208 | <varlistentry> |
| 1209 | <term><sgmltag class="starttag">literal</sgmltag></term> |
| 1210 | <listitem> |
| 1211 | <para> |
| 1212 | A catch-all element for literal computer data. Its |
| 1213 | use is somewhat vague; try to use a more specific |
| 1214 | tag if possible, like <sgmltag |
| 1215 | class="starttag">userinput</sgmltag> or <sgmltag |
| 1216 | class="starttag">computeroutput</sgmltag>. |
| 1217 | </para> |
| 1218 | </listitem> |
| 1219 | </varlistentry> |
| 1220 | <varlistentry> |
| 1221 | <term><sgmltag class="starttag">quote</sgmltag></term> |
| 1222 | <listitem> |
| 1223 | <para> |
| 1224 | An inline quotation. This tag typically inserts |
| 1225 | quotation marks for you, so you would write <sgmltag |
| 1226 | class="starttag">quote</sgmltag>This is a |
| 1227 | quote<sgmltag class="endtag">quote</sgmltag> rather |
| 1228 | than "This is a quote". This usage may be a little |
| 1229 | bulkier, but it does allow for automated formatting |
| 1230 | of all quoted material in the document. Thus, if |
| 1231 | you wanted all quotations to appear in italic, you |
| 1232 | could make the change once in your stylesheet, |
| 1233 | rather than doing a search and replace throughout |
| 1234 | the document. For larger chunks of quoted text, you |
| 1235 | can use <sgmltag |
| 1236 | class="starttag">blockquote</sgmltag>. |
| 1237 | </para> |
| 1238 | </listitem> |
| 1239 | </varlistentry> |
| 1240 | <varlistentry> |
| 1241 | <term><sgmltag class="starttag">note</sgmltag></term> |
| 1242 | <listitem> |
| 1243 | <para> |
| 1244 | Insert a side note for the reader. By default, the |
| 1245 | SGML processor usually prefixes the content with |
| 1246 | "Note:". You can change this text by adding a |
| 1247 | <sgmltag class="starttag">title</sgmltag> element. |
| 1248 | Thus, to add a visible FIXME comment to the |
| 1249 | documentation, you might write: |
| 1250 | </para> |
| 1251 | <programlisting> |
| 1252 | <![CDATA[ |
| 1253 | <note> |
| 1254 | <title>FIXME</title> |
| 1255 | <para>This section needs more info about...</para> |
| 1256 | </note> |
| 1257 | ]]></programlisting> |
| 1258 | <para> |
| 1259 | The results will look something like this: |
| 1260 | </para> |
| 1261 | <note> |
| 1262 | <title>FIXME</title> |
| 1263 | <para>This section needs more info about...</para> |
| 1264 | </note> |
| 1265 | </listitem> |
| 1266 | </varlistentry> |
| 1267 | <varlistentry> |
| 1268 | <term><sgmltag class="starttag">sgmltag</sgmltag></term> |
| 1269 | <listitem> |
| 1270 | <para> |
| 1271 | Used for inserting SGML tags, etc., into a SGML |
| 1272 | document without resorting to a lot of entity |
| 1273 | quoting, e.g., &lt;. You can change the |
| 1274 | appearance of the text with the <sgmltag |
| 1275 | class="attribute">class</sgmltag> attribute. Some |
| 1276 | common values of this are |
| 1277 | <literal>starttag</literal>, |
| 1278 | <literal>endtag</literal>, |
| 1279 | <literal>attribute</literal>, |
| 1280 | <literal>attvalue</literal>, and even |
| 1281 | <literal>sgmlcomment</literal>. See this SGML file, |
| 1282 | <filename>documentation/documentation.sgml</filename>, |
| 1283 | for examples. |
| 1284 | </para> |
| 1285 | </listitem> |
| 1286 | </varlistentry> |
| 1287 | <varlistentry> |
| 1288 | <term><sgmltag class="starttag">prompt</sgmltag></term> |
| 1289 | <listitem> |
| 1290 | <para> |
| 1291 | The text used for a computer prompt, for example a |
| 1292 | shell prompt, or command-line application prompt. |
| 1293 | </para> |
| 1294 | </listitem> |
| 1295 | </varlistentry> |
| 1296 | <varlistentry> |
| 1297 | <term><sgmltag class="starttag">replaceable</sgmltag></term> |
| 1298 | <listitem> |
| 1299 | <para> |
| 1300 | Meta-text that should be replaced by the user, not |
| 1301 | typed in literally, e.g., in command descriptions |
| 1302 | and <parameter>--help</parameter> outputs. |
| 1303 | </para> |
| 1304 | </listitem> |
| 1305 | </varlistentry> |
| 1306 | <varlistentry> |
| 1307 | <term><sgmltag class="starttag">constant</sgmltag></term> |
| 1308 | <listitem> |
| 1309 | <para> |
| 1310 | A programming constant, e.g., |
| 1311 | <constant>MAX_PATH</constant>. |
| 1312 | </para> |
| 1313 | </listitem> |
| 1314 | </varlistentry> |
| 1315 | <varlistentry> |
| 1316 | <term><sgmltag class="starttag">symbol</sgmltag></term> |
| 1317 | <listitem> |
| 1318 | <para> |
| 1319 | A symbolic value replaced, for example, by a |
| 1320 | pre-processor. This applies primarily to C macros, |
| 1321 | but may have other uses. Use the <sgmltag |
| 1322 | class="starttag">constant</sgmltag> tag instead of |
| 1323 | <sgmltag class="starttag">symbol</sgmltag> where |
| 1324 | appropriate. |
| 1325 | </para> |
| 1326 | </listitem> |
| 1327 | </varlistentry> |
| 1328 | <varlistentry> |
| 1329 | <term><sgmltag class="starttag">function</sgmltag></term> |
| 1330 | <listitem> |
| 1331 | <para> |
| 1332 | A programming function name. |
| 1333 | </para> |
| 1334 | </listitem> |
| 1335 | </varlistentry> |
| 1336 | <varlistentry> |
| 1337 | <term><sgmltag class="starttag">parameter</sgmltag></term> |
| 1338 | <listitem> |
| 1339 | <para> |
| 1340 | Programming language parameters you pass with a |
| 1341 | function. |
| 1342 | </para> |
| 1343 | </listitem> |
| 1344 | </varlistentry> |
| 1345 | <varlistentry> |
| 1346 | <term><sgmltag class="starttag">option</sgmltag></term> |
| 1347 | <listitem> |
| 1348 | <para> |
| 1349 | Parameters you pass to a command-line executable. |
| 1350 | </para> |
| 1351 | </listitem> |
| 1352 | </varlistentry> |
| 1353 | <varlistentry> |
| 1354 | <term><sgmltag class="starttag">varname</sgmltag></term> |
| 1355 | <listitem> |
| 1356 | <para> |
| 1357 | Variable name, typically in a programming language. |
| 1358 | </para> |
| 1359 | </listitem> |
| 1360 | </varlistentry> |
| 1361 | <varlistentry> |
| 1362 | <term><sgmltag class="starttag">type</sgmltag></term> |
| 1363 | <listitem> |
| 1364 | <para> |
| 1365 | Programming language types, e.g., from a typedef |
| 1366 | definition. May have other uses, too. |
| 1367 | </para> |
| 1368 | </listitem> |
| 1369 | </varlistentry> |
| 1370 | <varlistentry> |
| 1371 | <term><sgmltag class="starttag">structname</sgmltag></term> |
| 1372 | <listitem> |
| 1373 | <para> |
| 1374 | The name of a C-language <type>struct</type> |
| 1375 | declaration, e.g., <structname>sockaddr</structname>. |
| 1376 | </para> |
| 1377 | </listitem> |
| 1378 | </varlistentry> |
| 1379 | <varlistentry> |
| 1380 | <term><sgmltag class="starttag">structfield</sgmltag></term> |
| 1381 | <listitem> |
| 1382 | <para> |
| 1383 | A field inside a C <type>struct</type>. |
| 1384 | </para> |
| 1385 | </listitem> |
| 1386 | </varlistentry> |
| 1387 | <varlistentry> |
| 1388 | <term><sgmltag class="starttag">command</sgmltag></term> |
| 1389 | <listitem> |
| 1390 | <para> |
| 1391 | An executable binary, e.g., <command>wine</command> |
| 1392 | or <command>ls</command>. |
| 1393 | </para> |
| 1394 | </listitem> |
| 1395 | </varlistentry> |
| 1396 | <varlistentry> |
| 1397 | <term><sgmltag class="starttag">envar</sgmltag></term> |
| 1398 | <listitem> |
| 1399 | <para> |
| 1400 | An environment variable, e.g, <envar>$PATH</envar>. |
| 1401 | </para> |
| 1402 | </listitem> |
| 1403 | </varlistentry> |
| 1404 | <varlistentry> |
| 1405 | <term><sgmltag class="starttag">systemitem</sgmltag></term> |
| 1406 | <listitem> |
| 1407 | <para> |
| 1408 | A generic catch-all for system-related things, like |
| 1409 | OS names, computer names, system resources, etc. |
| 1410 | </para> |
| 1411 | </listitem> |
| 1412 | </varlistentry> |
| 1413 | <varlistentry> |
| 1414 | <term><sgmltag class="starttag">email</sgmltag></term> |
| 1415 | <listitem> |
| 1416 | <para> |
| 1417 | An email address. The SGML processor will typically |
| 1418 | add extra formatting characters, and even a |
| 1419 | <literal>mailto:</literal> link for HTML pages. |
| 1420 | Usage: <sgmltag |
| 1421 | class="starttag">email</sgmltag>user@host.com<sgmltag |
| 1422 | class="endtag">email</sgmltag> |
| 1423 | </para> |
| 1424 | </listitem> |
| 1425 | </varlistentry> |
| 1426 | <varlistentry> |
| 1427 | <term><sgmltag class="starttag">firstterm</sgmltag></term> |
| 1428 | <listitem> |
| 1429 | <para> |
| 1430 | Special emphasis for introducing a new term. Can |
| 1431 | also be linked to a <sgmltag |
| 1432 | class="starttag">glossary</sgmltag> entry, if |
| 1433 | desired. |
| 1434 | </para> |
| 1435 | </listitem> |
| 1436 | </varlistentry> |
| 1437 | </variablelist> |
| 1438 | |
| 1439 | <variablelist> |
| 1440 | <title>Item Listing Elements</title> |
| 1441 | <varlistentry> |
| 1442 | <term><sgmltag class="starttag">itemizedlist</sgmltag></term> |
| 1443 | <listitem> |
| 1444 | <para> |
| 1445 | For bulleted lists, no numbering. You can tweak the |
| 1446 | layout with SGML attributes. |
| 1447 | </para> |
| 1448 | </listitem> |
| 1449 | </varlistentry> |
| 1450 | <varlistentry> |
| 1451 | <term><sgmltag class="starttag">orderedlist</sgmltag></term> |
| 1452 | <listitem> |
| 1453 | <para> |
| 1454 | A numbered list; the SGML processor will insert the |
| 1455 | numbers for you. You can suggest numbering styles |
| 1456 | with the <sgmltag |
| 1457 | class="attribute">numeration</sgmltag> attribute. |
| 1458 | </para> |
| 1459 | </listitem> |
| 1460 | </varlistentry> |
| 1461 | <varlistentry> |
| 1462 | <term><sgmltag class="starttag">simplelist</sgmltag></term> |
| 1463 | <listitem> |
| 1464 | <para> |
| 1465 | A very simple list of items, often inlined. Control |
| 1466 | the layout with the <sgmltag |
| 1467 | class="attribute">type</sgmltag> attribute. |
| 1468 | </para> |
| 1469 | </listitem> |
| 1470 | </varlistentry> |
| 1471 | <varlistentry> |
| 1472 | <term><sgmltag class="starttag">variablelist</sgmltag></term> |
| 1473 | <listitem> |
| 1474 | <para> |
| 1475 | A list of terms with definitions or descriptions, |
| 1476 | like this very list! |
| 1477 | </para> |
| 1478 | </listitem> |
| 1479 | </varlistentry> |
| 1480 | </variablelist> |
| 1481 | |
| 1482 | <variablelist> |
| 1483 | <title>Block Text Quoting Elements</title> |
| 1484 | <varlistentry> |
| 1485 | <term><sgmltag class="starttag">programlisting</sgmltag></term> |
| 1486 | <listitem> |
| 1487 | <para> |
| 1488 | Quote a block of source code. Typically highlighted |
| 1489 | in the output and set off from normal text. |
| 1490 | </para> |
| 1491 | </listitem> |
| 1492 | </varlistentry> |
| 1493 | <varlistentry> |
| 1494 | <term><sgmltag class="starttag">screen</sgmltag></term> |
| 1495 | <listitem> |
| 1496 | <para> |
| 1497 | Quote a block of visible computer output, like the |
| 1498 | output of a command or chunks of debug logs. |
| 1499 | </para> |
| 1500 | </listitem> |
| 1501 | </varlistentry> |
| 1502 | </variablelist> |
| 1503 | |
| 1504 | <variablelist> |
| 1505 | <title>Hyperlink Elements</title> |
| 1506 | <varlistentry> |
| 1507 | <term><sgmltag class="starttag">link</sgmltag></term> |
| 1508 | <listitem> |
| 1509 | <para> |
| 1510 | Generic hypertext link, used for pointing to other |
| 1511 | sections within the current document. You supply |
| 1512 | the visible text for the link, plus the name of the <sgmltag |
| 1513 | class="attribute">id</sgmltag> attribute of the |
| 1514 | element that you want to link to. For example: |
| 1515 | <programlisting><link linkend="configuring-wine">the section on configuring wine</link> |
| 1516 | ... |
| 1517 | <sect2 id="configuring-wine"> |
| 1518 | ...</programlisting> |
| 1519 | </para> |
| 1520 | </listitem> |
| 1521 | </varlistentry> |
| 1522 | <varlistentry> |
| 1523 | <term><sgmltag class="starttag">xref</sgmltag></term> |
| 1524 | <listitem> |
| 1525 | <para> |
| 1526 | In-document hyperlink that can generate its own |
| 1527 | text. Similar to the <sgmltag |
| 1528 | class="starttag">link</sgmltag> tag, you use the |
| 1529 | <sgmltag class="attribute">linkend</sgmltag> |
| 1530 | attribute to specify which target element you want |
| 1531 | to jump to: |
| 1532 | </para> |
| 1533 | <para> |
| 1534 | <programlisting><xref linkend="configuring-wine"> |
| 1535 | ... |
| 1536 | <sect2 id="configuring-wine"> |
| 1537 | ...</programlisting> |
| 1538 | </para> |
| 1539 | <para> |
| 1540 | By default, most SGML processors will autogenerate |
| 1541 | some generic text for the <sgmltag |
| 1542 | class="starttag">xref</sgmltag> link, like |
| 1543 | <quote>Section 2.3.1</quote>. You can use the |
| 1544 | <sgmltag class="attribute">endterm</sgmltag> |
| 1545 | attribute to grab the visible text content of the |
| 1546 | hyperlink from another element: |
| 1547 | </para> |
| 1548 | <para> |
| 1549 | <programlisting><xref linkend="configuring-wine" endterm="config-title"> |
| 1550 | ... |
| 1551 | <sect2 id="configuring-wine"> |
| 1552 | <title id="config-title">Configuring Wine</title> |
| 1553 | ...</programlisting> |
| 1554 | </para> |
| 1555 | <para> |
| 1556 | This would create a link to the |
| 1557 | <symbol>configuring-wine</symbol> element, |
| 1558 | displaying the text of the |
| 1559 | <symbol>config-title</symbol> element for the |
| 1560 | hyperlink. Most often, you'll add an <sgmltag |
| 1561 | class="attribute">id</sgmltag> attribute to the |
| 1562 | <sgmltag class="starttag">title</sgmltag> of the |
| 1563 | section you're linking to, as above, in which case |
| 1564 | the SGML processor will use the target's title text |
| 1565 | for the link text. |
| 1566 | </para> |
| 1567 | <para> |
| 1568 | Alternatively, you can use an <sgmltag |
| 1569 | class="attribute">xreflabel</sgmltag> attribute in |
| 1570 | the target element tag to specify the link text: |
| 1571 | </para> |
| 1572 | <programlisting><sect1 id="configuring-wine" xreflabel="Configuring Wine"></programlisting> |
| 1573 | <note> |
| 1574 | <para> |
| 1575 | <sgmltag class="starttag">xref</sgmltag> is an |
| 1576 | empty element. You don't need a closing tag for |
| 1577 | it (this is defined in the DTD). In SGML |
| 1578 | documents, you should use the form <sgmltag |
| 1579 | class="starttag">xref</sgmltag>, while in XML |
| 1580 | documents you should use |
| 1581 | <sgmltag><xref/></sgmltag>. |
| 1582 | </para> |
| 1583 | </note> |
| 1584 | </listitem> |
| 1585 | </varlistentry> |
| 1586 | <varlistentry> |
| 1587 | <term><sgmltag class="starttag">anchor</sgmltag></term> |
| 1588 | <listitem> |
| 1589 | <para> |
| 1590 | An invisible tag, used for inserting <sgmltag |
| 1591 | class="attribute">id</sgmltag> attributes into a |
| 1592 | document to link to arbitrary places (i.e., when |
| 1593 | it's not close enough to link to the top of an |
| 1594 | element). |
| 1595 | </para> |
| 1596 | </listitem> |
| 1597 | </varlistentry> |
| 1598 | <varlistentry> |
| 1599 | <term><sgmltag class="starttag">ulink</sgmltag></term> |
| 1600 | <listitem> |
| 1601 | <para> |
| 1602 | Hyperlink in URL form, e.g., <ulink |
| 1603 | url="http://www.winehq.com">http://www.winehq.com</ulink>. |
| 1604 | </para> |
| 1605 | </listitem> |
| 1606 | </varlistentry> |
| 1607 | <varlistentry> |
| 1608 | <term><sgmltag class="starttag">olink</sgmltag></term> |
| 1609 | <listitem> |
| 1610 | <para> |
| 1611 | Indirect hyperlink; can be used for linking to |
| 1612 | external documents. Not often used in practice. |
| 1613 | </para> |
| 1614 | </listitem> |
| 1615 | </varlistentry> |
| 1616 | </variablelist> |
| 1617 | </sect3> |
| 1618 | |
| 1619 | <sect3> |
| 1620 | <title>Multiple SGML files</title> |
| 1621 | <para> |
| 1622 | How to split an SGML document into multiple files... |
| 1623 | </para> |
| 1624 | </sect3> |
| 1625 | </sect2> |
| 1626 | |
| 1627 | <sect2 id="sgml-environment"> |
| 1628 | <title>The SGML Environment</title> |
| 1629 | |
| 1630 | <para> |
| 1631 | You can write SGML/DocBook documents in any text editor you |
| 1632 | might find (although as we'll find in <xref |
| 1633 | linkend="emacs-psgml">, some editors are more friendly for |
| 1634 | this task than others). However, if you want to convert |
| 1635 | those documents into a more friendly form for reading, such |
| 1636 | as HTML, PostScript, or PDF, you will need a working SGML |
| 1637 | environment. This section attempts to lay out the various |
| 1638 | SGML rendering systems, and how they are set up on the |
| 1639 | popular Linux distributions. |
| 1640 | </para> |
| 1641 | |
| 1642 | <sect3> |
| 1643 | <title>DSSSL Environment</title> |
| 1644 | <para> |
| 1645 | Explain tools and methodologies.. |
| 1646 | </para> |
| 1647 | </sect3> |
| 1648 | |
| 1649 | <sect3> |
| 1650 | <title>XSLT Environment</title> |
| 1651 | <para> |
| 1652 | Explain tools and methodologies... |
| 1653 | </para> |
| 1654 | </sect3> |
| 1655 | |
John R. Sheets | d1c9c0c | 2001-02-12 01:14:34 +0000 | [diff] [blame] | 1656 | </sect2> |
| 1657 | |
| 1658 | <sect2 id="emacs-psgml"> |
| 1659 | <title>PSGML Mode in Emacs</title> |
| 1660 | <para> |
| 1661 | Although you can write SGML documentation in any simple text |
| 1662 | editor, some editors provide extra support for entering SGML |
| 1663 | tags, and for verifying that the SGML you create is valid. |
| 1664 | SGML has been around for a long time, and many commercial |
| 1665 | editors exist for it; however, until recently open source |
| 1666 | SGML editors have been scarce. |
| 1667 | </para> |
| 1668 | <note> |
| 1669 | <title>FIXME</title> |
| 1670 | <para> |
| 1671 | List the available commercial and open source SGML |
| 1672 | editors. |
| 1673 | </para> |
| 1674 | </note> |
| 1675 | <para> |
| 1676 | The most commonly used open source SGML editor is Emacs, |
| 1677 | with the PSGML <firstterm>mode</firstterm>, or extension. |
| 1678 | Emacs does not supply a GUI or WYSIWYG (What You See Is What |
| 1679 | You Get) interface, but it does provide many helpful |
| 1680 | shortcuts for creating SGML, as well as automatic |
| 1681 | formatting, validity checking, and the ability to create |
| 1682 | your own macros to simplify complex, repetitive actions. |
| 1683 | We'll touch briefly on each of these points. |
| 1684 | </para> |
| 1685 | <para> |
| 1686 | The first thing you need is a working installation of Emacs |
| 1687 | (or XEmacs), with the PSGML package. Most Linux |
| 1688 | distributions provide both as easy-to-install packages. |
| 1689 | </para> |
| 1690 | <para> |
| 1691 | Next, you'll need a working SGML environment. See <xref |
| 1692 | linkend="sgml-environment"> for more info on setting that |
| 1693 | up. |
| 1694 | </para> |
| 1695 | </sect2> |
| 1696 | |
| 1697 | <sect2 id="docbook-build"> |
| 1698 | <title>The DocBook Build System</title> |
| 1699 | |
| 1700 | <sect3 id="docbook-infrastructure"> |
| 1701 | <title>Basic Infrastructure</title> |
| 1702 | <para> |
| 1703 | How the build/make system works (makefiles, db2html, |
| 1704 | db2html-winehq, jade, stylesheets). |
| 1705 | </para> |
| 1706 | </sect3> |
| 1707 | |
| 1708 | <sect3 id="docbook-tweaking"> |
| 1709 | <title>Tweaking the DSSSL stylesheets</title> |
| 1710 | <para> |
| 1711 | Things you can tweak, and how to do it (examples from |
| 1712 | default.dsl and winehq.dsl). |
| 1713 | </para> |
| 1714 | </sect3> |
| 1715 | |
| 1716 | <sect3 id="docbook-generating"> |
| 1717 | <title>Generating docs for Wine web sites</title> |
| 1718 | <para> |
| 1719 | Explain make_winehq, rsync, etc. |
| 1720 | </para> |
| 1721 | </sect3> |
| 1722 | </sect2> |
| 1723 | </sect1> |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 1724 | </chapter> |
| 1725 | |
| 1726 | <!-- Keep this comment at the end of the file |
| 1727 | Local variables: |
| 1728 | mode: sgml |
John R. Sheets | d9e064f | 2000-12-13 21:52:37 +0000 | [diff] [blame] | 1729 | sgml-parent-document:("wine-doc.sgml" "set" "book" "part" "chapter" "") |
John R. Sheets | 1e8e5ba | 2000-08-08 01:24:00 +0000 | [diff] [blame] | 1730 | End: |
| 1731 | --> |