Documenting Wine This chapter describes how you can help improve Wine's documentation. Like most large scale volunteer projects, Wine is strongest in areas that are rewarding for its volunteers to work in. The majority of contributors send code patches either fixing bugs, adding new functionality or otherwise improving the software components of the distribution. A lesser number contribute in other ways, such as reporting bugs and regressions, creating tests, providing organizational assistance, or helping to document Wine. Documentation is important for many reasons, and is often the key to the end user having a successful experience in installing, setting up and using software. Because Wine is a complicated, evolving entity, providing quality up to date documentation is vital to encourage more people to persevere with using and contributing to the project. The following sections describe in detail how to go about adding to or updating Wine's existing documentation. An Overview Of Wine Documentation The Wine source code tree comes with a large amount of documentation in the documentation/ subdirectory. This used to be a collection of text files culled from various places such as the Wine Weekly News and the wine-devel mailing list, but was reorganized some time ago into a number of books, each of which is marked up using SGML. You are reading one of these books (the Wine Developer's Guide) right now. Since being reorganized, the books have been updated and extended regularly. In their current state they provide a good framework which over time can be expanded and kept up to date. This means that most of the time when further documentation is added, it is a simple matter of updating the content of an already existing file. The books available at the time of writing are: The Wine User Guide. This book contains information for end users on installing, configuring and running Wine. The Wine Developer's Guide. This book contains information and guidelines for developers and contributors to the Wine project. The Winelib User's Guide. This book contains information for developers using Winelib to port Win32 applications to Unix. The Wine Packager's Guide. This book contains information for anyone who will be distributing Wine to end users in a prepackaged format. It is also the exception to the rule as it has intentionally been kept in text format. The Wine FAQ. This book contains frequently asked questions about Wine with their answers. Another source of documentation is the Wine API Guide. This is generated information taken from special comments placed in the Wine source code. When you update or add new API calls to Wine you should consider documenting them so that developers can determine what the API does and how it should be used. The next sections describe how to create Wine API documentation and how to work with SGML so you can add to the existing books. Writing Wine API Documentation Introduction to API Documentation Wine includes a large amount of documentation on the API functions it implements. There are several reasons to want to document the Win32 API: To allow Wine developers to know what each function should do, should they need to update or fix it. To allow Winelib users to understand the functions that are available to their applications. To provide an alternative source of free documentation on the Win32 API. To provide more accurate documentation where the existing documentation is accidentally or deliberately vague or misleading. To this end, a semi formalized way of producing documentation from the Wine source code has evolved. Since the primary users of API documentation are Wine developers themselves, documentation is usually inserted into the source code in the form of comments and notes. Good things to include in the documentation of a function include: The purpose of the function. The parameters of the function and their purpose. The return value of the function, in success as well as failure cases. Additional notes such as interaction with other parts of the system, differences between Wine's implementation and Win32s, errors in MSDN documentation, undocumented cases and bugs that Wine corrects or is compatible with. Good documentation helps developers be aware of the effects of making changes. It also allows good tests to be written which cover all of the documented cases. Note that you do not need to be a programmer to update the documentation in Wine. If you would like to contribute to the project, patches that improve the API documentation are welcome. The following describes how to format any documentation that you write so that the Wine documentation generator can extract it and make it available to other developers and users. In general, if you did not write the function in question, you should be wary of adding comments to other peoples code. It is quite possible you may misunderstand or misrepresent what the original author intended! Adding API documentation on the other hand can be done by anybody, since in most cases there is plenty of information about what a function is supposed to do (if it isn't obvious) available in books and articles on the internet. A final warning concerns copyright and must be noted. If you read MSDN or any publication in order to find out what an API call does, you must be aware that the text you are reading is copyrighted and in most cases cannot legally be reproduced without the authors permission. If you copy verbatim any information from such sources and submit it for inclusion into Wine, you open yourself up to potential legal liability. You must ensure that anything you submit is your own work, although it can be based on your understanding gleaned from reading other peoples work. Basic API Documentation The general form of an API comment in Wine is a block comment immediately before a function is implemented in the source code. General comments within a function body or at the top of an implementation file are ignored by the API documentation generator. Such comments are for the benefit of developers only, for example to explain what the source code is doing or to describe something that may not be obvious to the person reading the source code. The following text uses the function PathRelativePathToA() from SHLWAPI.DLL as an example. You can find this function in the Wine source code tree in the file dlls/shlwapi/path.c. The first line of the comment gives the name of the function, the DLL that the function is exported from, and its export ordinal number. This is the simplest (and most common type of) comment: /************************************************************************* * PathRelativePathToW [SHLWAPI.@] */ The functions name and the DLL name are obvious. The ordinal number takes one of two forms: Either @ as in the above, or a number if the export is exported by ordinal. You can see which to use by looking at the DLL's .spec file. If the line on which the function is listed begins with a number, use it, otherwise use the @ symbol, which indicates that this function is imported only by name. Note also that round or square brackets can be used, and whitespace between the name and the DLL/ordinal is free form. Thus the following is equally valid: /************************************************************************* * PathRelativePathToW (SHLWAPI.@) */ This basic comment will not get processed into documentation, since it contains no information. In order to produce documentation for the function, We must add some of the information listed above. First we add a description of the function. This can be as long as you like, but typically contains only a brief description of what the function is meant to do in general terms. It is free form text: /************************************************************************* * PathRelativePathToW [SHLWAPI.@] * * Create a relative path from one path to another. */ To be truly useful however we must document the parameters to the function. There are two methods for doing this: In the comment, or in the function prototype. Parameters documented in the comment should be formatted as follows: /************************************************************************* * PathRelativePathToW [SHLWAPI.@] * * Create a relative path from one path to another. * * PARAMS * lpszPath [O] Destination for relative path * lpszFrom [I] Source path * dwAttrFrom [I] File attribute of source path * lpszTo [I] Destination path * dwAttrTo [I] File attributes of destination path * */ The parameters section starts with PARAMS on its own line. Each parameter is listed in the order they appear in the functions prototype, first with the parameters name, followed by its input/output status, followed by a free form text description of the comment. The input/output status tells the programmer whether the value will be modified by the function (an output parameter), or only read (an input parameter). The status must be enclosed in square brackets to be recognized, otherwise, or if it is absent, anything following the parameter name is treated as the parameter description. This field is case insensitive and can be any of the following: [I], [In], [O], [Out], [I/O], [In/Out]. Following the description and parameters come a number of optional sections, all in the same format. A section is defined as the section name, which is an all upper case section name on its own line, followed by free form text. You can create any sections you like, however for consistency it is recommended you use the following section names: NOTES. Anything that needs to be noted about the function such as special cases and the effects of input arguments. BUGS. Any bugs in the function that exist 'by design', i.e. those that will not be fixed or exist for compatibility with Windows. TODO. Any unhandled cases or missing functionality in the Wine implementation of the function. FIXME. Things that should be updated or addressed in the implementation of the function at some future date (perhaps dependent on other parts of Wine). Note that if this information is only relevant to Wine developers then it should probably be placed in the relevant code section instead. Following or before the optional sections comes the RETURNS section which describes the return value of the function. This is free form text but should include what is returned on success as well as possible error return codes. Note that this section must be present for documentation to be generated for your comment. Our final documentation looks like the following: /************************************************************************* * PathRelativePathToW [SHLWAPI.@] * * Create a relative path from one path to another. * * PARAMS * lpszPath [O] Destination for relative path * lpszFrom [I] Source path * dwAttrFrom [I] File attribute of source path * lpszTo [I] Destination path * dwAttrTo [I] File attributes of destination path * * RETURNS * TRUE If a relative path can be formed. lpszPath contains the new path * FALSE If the paths are not relative or any parameters are invalid * * NOTES * lpszTo should be at least MAX_PATH in length. * Calling this function with relative paths for lpszFrom or lpszTo may * give erroneous results. * * The Win32 version of this function contains a bug where the lpszTo string * may be referenced 1 byte beyond the end of the string. As a result random * garbage may be written to the output path, depending on what lies beyond * the last byte of the string. This bug occurs because of the behaviour of * PathCommonPrefix() (see notes for that function), and no workaround seems * possible with Win32. * This bug has been fixed here, so for example the relative path from "\\" * to "\\" is correctly determined as "." in this implementation. */ Advanced API Documentation There is no markup language for formatting API comments, since they should be easily readable by any developer working on the source file. A number of constructs are treated specially however, and are noted here. You can use these constructs to enhance the usefulness of the generated documentation by making it easier to read and referencing related documents. Any valid c identifier that ends with () is taken to be an API function and is formatted accordingly. When generating documentation, this text will become a link to that API call, if the output type supports hyperlinks or their equivalent. Similarly, any interface name starting with a capital I and followed by the words "reference" or "object" become a link to that objects documentation. Where an Ascii and Unicode version of a function are available, it is recommended that you document only the Unicode version and have the Ascii version refer to the Unicode one, as follows: /************************************************************************* * PathRelativePathToA [SHLWAPI.@] * * See PathRelativePathToW. */ Alternately you may use the following form: /************************************************************************* * PathRelativePathToA [SHLWAPI.@] * * Unicode version of PathRelativePathToW. */ You may also use this construct in any other section, such as NOTES. Any numbers and text in quotes ("") are highlighted. Words in all uppercase are assumed to be API constants and are highlighted. If you want to emphasize something in the documentation, put it in a section by itself rather than making it upper case. Blank lines in a section cause a new paragraph to be started. Blank lines at the start and end of sections are ignored. Any comment line starting with ("*|") is treated as raw text and is not pre-processed before being output. This should be used for code listings, tables and any text that should remain unformatted. Any line starting with a single word followed by a colon (:) is assumed to be case listing and is emphasized and put in its own paragraph. This is most often used for return values, as in the example section below. * RETURNS * Success: TRUE. Something happens that is documented here. * Failure: FALSE. The reasons why this call can fail are listed here. Any line starting with a (-) is put into a paragraph by itself. this allows lists to avoid being run together. If you are in doubt as to how your comment will look, try generating the API documentation and checking the output. Extra API Documentation Simply documenting the API calls available provides a great deal of information to developers working with the Win32 API. However additional documentation is needed before the API Guide can be considered truly useful or comprehensive. For example, COM objects that are available for developers use should be documented, along with the interface(s) that those objects export. Also, it would be helpful to document each dll, to provide some structure to the documentation. To facilitate providing extra documentation, you can create comments that provide extra documentation on functions, or on keywords such as the name of a COM interface or a type definition. These items are generated using the same formatting rules as described earlier. The only difference is the first line of the comment, which indicates to the generator that the documentation is supplemental and does not describe an export from the dll being processed. Lets assume you have implemented a COM interface that you want to document; we'll use the name IExample as an example here. Your comment would look like the following (assuming you are exporting this object from EXAMPLE.DLL): /************************************************************************* * IExample {EXAMPLE} * * The IExample object provides lots of interesting functionality. * ... */ Format this documentation exactly as you would a standard export. The only difference is the use of curly brackets to mark this documentation as supplemental. The generator will output this documentation using the name given before the DLL name, and will link to it from the main DLL page. In addition, if you have referred to the comment name in other documentation using "IExample interface", "IExample object", or "IExample()", those references will point to this documentation. If you document you COM interfaces this way then all following extra comments that follow in the same source file that begin with the same document title will be added as references to this comment before it is output. For an example of this see dlls/oleaut32/safearray.c. This uses an extra comment to document The SafeArray functions and link them together under one heading. As a special case, if you use the DLL name as the comment name, the comment will be treated as documentation on the DLL itself. When the documentation for the DLL is processed, the contents of the comment will be placed before the generated statistics, exports and other information that makes up a DLL's documentation page. Generating API Documentation Having edited or added new API documentation to a source code file, you should generate the documentation to ensure that the result is what you expected. Wine includes a tool (slightly misleadingly) called c2man.pl in the tools/ directory which is used to generate the documentation from the source code. You can run c2man.pl manually for testing purposes; it is a fairly simple perl script which parses .c files to create output in several formats. If you wish to try this you may want to run it with no arguments, which will cause it to print usage information. An easier way is to use Wine's build system. To create man pages for a given dll, just type make man from within the dlls directory or type make manpages in the root directory of the Wine source tree. You can then check that a man page was generated for your function, it should be present in the documentation/man3w directory with the same name as the function. Once you have generated the man pages from the source code, running make install will install them for you. By default they are installed in section 3w of the manual, so they don't conflict with any existing man page names. So, to read the man page you should use man -S 3w {name}. Alternately you can edit /etc/man.config and add 3w to the list of search paths given in the variable MANSECT. You can also generate HTML output for the API documentation, in this case the make command is make doc-html in the dll directory, or make htmlpages from the root. The output will be placed by default under documentation/html. Similarly you can create SGML source code to produce the Wine Api Guide with the command make sgmlpages. The Wine DocBook System Writing Documentation with DocBook DocBook is a flavour of SGML (Standard Generalized Markup Language), a syntax for marking up the contents of documents. HTML is another very common flavour of SGML; DocBook markup looks very similar to HTML markup, although the names of the markup tags differ. Getting Started Why SGML? The simple answer to that is that SGML allows you to create multiple formats of a given document from a single source. Currently it is used to create HTML, PDF, PS (PostScript) and Text versions of the Wine books. What do I need? You need the SGML tools. There are various places where you can get them. The most generic way of getting them is from their source as discussed below. Quick instructions These are the basic steps to create the Wine books from the SGML source. Go to http://www.sgmltools.org Download all of the sgmltools packages Install them all and build them (./configure; make; make install) Switch to your toplevel Wine directory Run ./configure (or make distclean && ./configure) Switch to the documentation/ directory run make html View wine-user.html, wine-devel.html, etc. in your favorite browser Getting SGML for various distributions Most Linux distributions have everything you need already bundled up in package form. Unfortunately, each distribution seems to handle its SGML environment differently, installing it into different paths, and naming its packages according to its own whims. SGML on Red Hat The following packages seem to be sufficient for Red Hat 7.1. You will want to be careful about the order in which you install the RPMs. sgml-common-*.rpm openjade-*.rpm perl-SGMLSpm-*.rpm docbook-dtd*.rpm docbook-style-dsssl-*.rpm tetex-*.rpm jadetex-*.rpm docbook-utils-*.rpm You can also use ghostscript to view the ps format output and Adobe Acrobat 4 to view the pdf file. SGML on Debian This is not a definitive list yet, but it seems you might need the following packages: docbook docbook-dsssl docbook-utils docbook-xml docbook-xsl sgml-base sgml-data tetex-base tetex-bin jade jadetex Terminology SGML markup contains a number of syntactical elements that serve different purposes in the markup. We'll run through the basics here to make sure we're on the same page when we refer to SGML semantics. The basic currency of SGML is the tag. A simple tag consists of a pair of angle brackets and the name of the tag. For example, the para tag would appear in an SGML document as para. This start tag indicates that the immediately following text should be classified according to the tag. In regular SGML, each opening tag must have a matching end tag to show where the start tag's contents end. End tags begin with </ markup, e.g., para. The combination of a start tag, contents, and an end tag is called an element. SGML elements can be nested inside of each other, or contain only text, or may be a combination of both text and other elements, although in most cases it is better to limit your elements to one or the other. The XML (eXtensible Markup Language) specification, a modern subset of the SGML specification, adds a so-called empty tag, for elements that contain no text content. The entire element is a single tag, ending with />, e.g., <xref/>. However, use of this tag style restricts you to XML DocBook processing, and your document may no longer compile with SGML-only processing systems. Often a processing system will need more information about an element than you can provide with just tags. SGML allows you to add extra hints in the form of SGML attributes to pass along this information. The most common use of attributes in DocBook is giving specific elements a name, or an ID, so you can refer to it from elsewhere. This ID can be used for many things, including file-naming for HTML output, hyper-linking to specific parts of the document, and even pulling text from that element (see the xref tag). An SGML attribute appears inside the start tag, between the < and > brackets. For example, if you wanted to set the id attribute of the book element to mybook, you would create a start tag like this: <book id="mybook"> Notice that the contents of the attribute are enclosed in quote marks. These quotes are optional in SGML, but mandatory in XML. It's a good habit to use quotes, as it will make it much easier to migrate your documents to an XML processing system later on. You can also specify more than one attribute in a single tag: <book id="mybook" status="draft"> Another commonly used type of SGML markup is the entity. An entity lets you associate a block of text with a name. You declare the entity once, at the beginning of your document, and can invoke it as many times as you like throughout the document. You can use entities as shorthand, or to make it easier to maintain certain phrases in a central location, or even to insert the contents of an entire file into your document. An entity in your document is always surrounded by the & and ; characters. One entity you'll need sooner or later is the one for the < character. Since SGML expects all tags to begin with a <, the < is a reserved character. To use it in your document (as I am doing here), you must insert it with the &lt; entity. Each time the SGML processor encounters &lt;, it will place a literal < in the output document. Similarly you must use the &gt; and &amp; entities for the > and & characters. The final term you'll need to know when writing simple DocBook documents is the DTD (Document Type Declaration). The DTD defines the flavour of SGML a given document is written in. It lists all the legal tag names, like book, para, and so on, and declares how those tags are allowed to be used together. For example, it doesn't make sense to put a book element inside a para paragraph element -- only the reverse makes sense. The DTD thus defines the legal structure of the document. It also declares which attributes can be used with which tags. The SGML processing system can use the DTD to make sure the document is laid out properly before attempting to process it. SGML-aware text editors like Emacs can also use the DTD to guide you while you write, offering you choices about which tags you can add in different places in the document, and beeping at you when you try to add a tag where it doesn't belong. Generally, you will declare which DTD you want to use as the first line of your SGML document. In the case of DocBook, you will use something like this: <!doctype book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" []> <book> ... </book> Note that you must specify your toplevel element inside the doctype declaration. If you were writing an article rather than a book, you might use this declaration instead: <!doctype article PUBLIC "-//OASIS//DTD DocBook V3.1//EN" []> <article> ... </article> The Document Once you're comfortable with SGML, creating a DocBook document is quite simple and straightforward. Even though DocBook contains over 300 different tags, you can usually get by with only a small subset of those tags. Most of them are for inline formatting, rather than for document structuring. Furthermore, the common tags have short, intuitive names. Below is a (completely nonsensical) example to illustrate how a simple document might be laid out. Notice that all chapter and sect1 elements have id attributes. This is not mandatory, but is a good habit to get into, as DocBook is commonly converted into HTML, with a separate generated file for each book, chapter, and/or sect1 element. If the given element has an id attribute, the processor will typically name the file accordingly. Thus, the below document might result in index.html, chapter-one.html, blobs.html, and so on. Also notice the text marked off with <!-- and --> characters. These denote SGML comments. SGML processors will completely ignore anything between these markers, similar to /* and */ comments in C source code. A Poet's Guide to Nonsense Blobs and Gribbles The Story Behind Blobs Blobs are often mistaken for ice cubes and rain puddles... Your Friend the Gribble A Gribble is a cute, unassuming little fellow... Gribble Temperament When left without food for several days... Gribble Appearance Most Gribbles have a shock of white fur running from... Phantasmagoria Dretch Pools When most poets think of Dretch Pools, they tend to... ]]> Common Elements Once you get used to the syntax of SGML, the next hurdle in writing DocBook documentation is to learn the many DocBook-specific tag names, and when to use them. DocBook was created for technical documentation, and as such, the tag names and document structure are slanted towards the needs of such documentation. To cover its target audience, DocBook declares a wide variety of specialized tags, including tags for formatting source code (with somewhat of a C/C++ bias), computer prompts, GUI application features, keystrokes, and so on. DocBook also includes tags for universal formatting needs, like headers, footnotes, tables, and graphics. We won't cover all of these elements here (over 300 DocBook tags exist!), but we will cover the basics. To learn more about the other tags, check out the official DocBook guide, at http://docbook.org. To see how they are used in practice, download the SGML source for this manual (the Wine Developer Guide) and browse through it, comparing it to the generated HTML (or PostScript or PDF). There are often many correct ways to mark up a given piece of text, and you may have to make guesses about which tag to use. Sometimes you'll have to make compromises. However, remember that it is possible to further customize the output of the SGML processors. If you don't like the way a certain tag looks in HTML, that doesn't mean you should choose a different tag based on its output formatting. The processing stylesheets can be altered to fix the formatting of that same tag everywhere in the document (not just in the place you're working on). For example, if you're frustrated that the systemitem tag doesn't produce any formatting by default, you should fix the stylesheets, not change the valid systemitem tag to, for example, an emphasis tag. Here are the common SGML elements: Structural Elements book The book is the most common toplevel element, and is probably the one you should use for your document. set If you want to group more than one book into a single unit, you can place them all inside a set. This is useful when you want to bundle up documentation in alternate ways. We do this with the Wine documentation, using book to put each Wine guide into a separate directory (see documentation/wine-devel.sgml, etc.). chapter A chapter element includes a single entire chapter of the book. part If the chapters in your book fall into major categories or groupings (as in the Wine Developer Guide), you can place each collection of chapters into a part element. sect? DocBook has many section elements to divide the contents of a chapter into smaller chunks. The encouraged approach is to use the numbered section tags, sect1, sect2, sect3, sect4, and sect5 (if necessary). These tags must be nested in order: you can't place a sect3 directly inside a sect1. You have to nest the sect3 inside a sect2, and so forth. Documents with these explicit section groupings are easier for SGML processors to deal with, and lead to better organized documents. DocBook also supplies a section element which you can nest inside itself, but its use is discouraged in favor of the numbered section tags. title The title of a book, chapter, part, section, etc. In most of the major structural elements, like chapter, part, and the various section tags, title is mandatory. In other elements like book and note, it's optional. para The basic unit of text is the paragraph, represented by the para tag. This is probably the tag you'll use most often. In fact, in a simple document, you can probably get away with using only book, chapter, title, and para. article For shorter, more targeted documents, like topic pieces and whitepapers, you can use article as your toplevel element. Inline Formatting Elements filename The name of a file. You can optionally set the class attribute to Directory, HeaderFile, and SymLink to further classify the filename. userinput Literal text entered by the user. computeroutput Literal text output by the computer. literal A catch-all element for literal computer data. Its use is somewhat vague; try to use a more specific tag if possible, like userinput or computeroutput. quote An inline quotation. This tag typically inserts quotation marks for you, so you would write quoteThis is a quotequote rather than "This is a quote". This usage may be a little bulkier, but it does allow for automated formatting of all quoted material in the document. Thus, if you wanted all quotations to appear in italic, you could make the change once in your stylesheet, rather than doing a search and replace throughout the document. For larger chunks of quoted text, you can use blockquote. note Insert a side note for the reader. By default, the SGML processor usually prefixes the content with "Note:". You can change this text by adding a title element. Thus, to add a visible FIXME comment to the documentation, you might write: EXAMPLE This is an example note... ]]> The results will look something like this: EXAMPLE This is an example note... sgmltag Used for inserting SGML tags, etc., into a SGML document without resorting to a lot of entity quoting, e.g., &lt;. You can change the appearance of the text with the class attribute. Some common values of this are starttag, endtag, attribute, attvalue, and even sgmlcomment. See this SGML file, documentation/documentation.sgml, for examples. prompt The text used for a computer prompt, for example a shell prompt, or command-line application prompt. replaceable Meta-text that should be replaced by the user, not typed in literally, e.g., in command descriptions and --help outputs. constant A programming constant, e.g., MAX_PATH. symbol A symbolic value replaced, for example, by a pre-processor. This applies primarily to C macros, but may have other uses. Use the constant tag instead of symbol where appropriate. function A programming function name. parameter Programming language parameters you pass with a function. option Parameters you pass to a command-line executable. varname Variable name, typically in a programming language. type Programming language types, e.g., from a typedef definition. May have other uses, too. structname The name of a C-language struct declaration, e.g., sockaddr. structfield A field inside a C struct. command An executable binary, e.g., wine or ls. envar An environment variable, e.g, $PATH. systemitem A generic catch-all for system-related things, like OS names, computer names, system resources, etc. email An email address. The SGML processor will typically add extra formatting characters, and even a mailto: link for HTML pages. Usage: emailuser@host.comemail firstterm Special emphasis for introducing a new term. Can also be linked to a glossary entry, if desired. Item Listing Elements itemizedlist For bulleted lists, no numbering. You can tweak the layout with SGML attributes. orderedlist A numbered list; the SGML processor will insert the numbers for you. You can suggest numbering styles with the numeration attribute. simplelist A very simple list of items, often inlined. Control the layout with the type attribute. variablelist A list of terms with definitions or descriptions, like this very list! Block Text Quoting Elements programlisting Quote a block of source code. Typically highlighted in the output and set off from normal text. screen Quote a block of visible computer output, like the output of a command or chunks of debug logs. Hyperlink Elements link Generic hypertext link, used for pointing to other sections within the current document. You supply the visible text for the link, plus the name of the id attribute of the element that you want to link to. For example: <link linkend="configuring-wine">the section on configuring wine</link> ... <sect2 id="configuring-wine"> ... xref In-document hyperlink that can generate its own text. Similar to the link tag, you use the linkend attribute to specify which target element you want to jump to: <xref linkend="configuring-wine"> ... <sect2 id="configuring-wine"> ... By default, most SGML processors will auto generate some generic text for the xref link, like Section 2.3.1. You can use the endterm attribute to grab the visible text content of the hyperlink from another element: <xref linkend="configuring-wine" endterm="config-title"> ... <sect2 id="configuring-wine"> <title id="config-title">Configuring Wine</title> ... This would create a link to the configuring-wine element, displaying the text of the config-title element for the hyperlink. Most often, you'll add an id attribute to the title of the section you're linking to, as above, in which case the SGML processor will use the target's title text for the link text. Alternatively, you can use an xreflabel attribute in the target element tag to specify the link text: <sect1 id="configuring-wine" xreflabel="Configuring Wine"> xref is an empty element. You don't need a closing tag for it (this is defined in the DTD). In SGML documents, you should use the form xref, while in XML documents you should use <xref/>. anchor An invisible tag, used for inserting id attributes into a document to link to arbitrary places (i.e., when it's not close enough to link to the top of an element). ulink Hyperlink in URL form, e.g., http://www.winehq.org. olink Indirect hyperlink; can be used for linking to external documents. Not often used in practice. Editing SGML Documents You can write SGML/DocBook documents in any text editor you might find although some editors are more friendly for this task than others. The most commonly used open source SGML editor is Emacs, with the PSGML mode, or extension. Emacs does not supply a GUI or WYSIWYG (What You See Is What You Get) interface, but it does provide many helpful shortcuts for creating SGML, as well as automatic formatting, validity checking, and the ability to create your own macros to simplify complex, repetitive actions.