GNOME Handbook of Writing Software Documentation V1.0.2

1. Introduction

1.1. GNOME Documentation Project

1.1.1. Goals

The GNOME Documentation Project (GDP) aims to provide GNOME and GNOME applications with a complete, intuitive, and clear documentation system. At the center of the GDP is Yelp, which presents a unified interface to GNOME-specific documentation as well as other Linux documentation such as man pages and texinfo documents. The GNOME Help System provides a comprehensive view of documentation on a machine by dynamically assembling the documentation of GNOME applications and components which are installed. The GDP is responsible for writing numerous GNOME-related documents for users. User documentation include the GNOME User's Guide, the GNOME Release Notes, and GNOME application documentation. Most GNOME applications have their own manual in addition to context sensitive help.

1.1.2. Joining the GDP

Documenting GNOME and all the numerous GNOME applications is a very large project. The GDP is always looking for people to help write, update, and edit documentation. If you are interested in joining the GDP team, you should join the http://mail.gnome.org/mailman/listinfo/gnome-doc-list/. Read Section 3 ― Getting Started Writing GNOME Documentation, for help selecting a project to work on. Feel free to introduce yourself on the gnome-doc-list mailing list and indicate which project you intend to work on, or else ask for suggestions of important documents which need work done. You may also want to join the #docs IRC channel on irc.gnome.org to meet other GDP members and discuss any questions you may have. For a list of GDP projects and members, see the http://developer.gnome.org/projects/gdp.

1.1.3. Collaborating with the GDP

GNOME developers, packagers, and translators may not be writing GNOME documentation but will want to understand how the GNOME documentation system works and will need to collaborate with GDP members. This document should help to outline the structure of how the GNOME documentation system works. Developers who do not write the documentation for their applications are encouraged to find a GDP member to write the documentation. This is best done by sending an email to the http://mail.gnome.org/mailman/listinfo/gnome-doc-list/ describing the application, where it can be downloaded from, and that the developer(s) would like a GDP member to write documentation for the application. The #docs IRC channel on irc.gnome.org is another option for contacting GDP members.

1.2. Notation and Conventions

This Handbook uses the following notation:

/usr/bin Directory
foo.sgml Filename
command Command or text that would be typed.
replaceable "Variable" text that can be replaced.
Program or Doc Code Program or document code

1.3. About this Handbook

This Handbook is a guide for both writing user documentation for GNOME components and applications and for properly binding and packaging documentation into GNOME applications.

This Handbook is not a guide for writing developer documentation. If you can read C and wish to write developer documentation take a look at GTK+ Reference Documentation Project.

This Handbook, like all GNOME documentation, was written in DocBook(XML) and is available in several formats including XML, HTML, PostScript, and PDF. For the latest version, see http://library.gnome.org/devel/gdp-handbook/stable/. Alternately, one may download it anonymously from GNOME SVN under gnome-devel-docs/trunk/gdp-handbook.

2. GNOME Documentation System

The GNOME Documentation System consists of DocBook, Yelp (GNOME Help Browser), Scrollkeeper (document cataloging system), and the XML tools (called DocBook Tools) to transform and check the documentation. Use of this system is necessary to write good documentation for GNOME. This chapter gives a brief overview describing the tools in the GNOME Documentation System.

2.1. DocBook

DocBook is a markup language, like HTML, for technical and computer documentation, papers, and books. The GNOME Documentation Project uses DocBook to mark up GNOME documentation. The GDP currently uses version 4.1.2 of DocBook. DocBook SGML is used with gtk-doc for developer documentation while DocBook XML is used for end user documentation.

The main advantage of DocBook is its single-source multiple-output nature. Only one DocBook source file is needed to make many different outputs. From the same DocBook file the GDP lets the user view the documentation as HTML with Yelp and can provide a print copy, usually in PDF.

The GDP uses the XSL language to exploit DocBook's multi source nature. XSLT stylesheets convert DocBook into HTML, which Yelp displays. XSLT stylesheets are also used to convert DocBook into FO, an XML print specification, which is in turn converted to PDF or PS files. If any other format is needed the GDP could use an XSLT stylesheet to convert the DocBook files into another format such as man or info pages.

DocBook focuses on the document content, leaving presentation details to XSLT. For example all the applications within DocBook use the <application> tag. The stylesheets determine how the text inside the tag looks. Authors need not concern themselves, for example, with whether all applications will be in bold text or italics or whether the applications should not have any special formatting, focusing instead on what ideas the documentation should convey to the readers.

2.1.1. Learning DocBook

There are many resources available to help you learn DocBook, including this manual. The following resources on the web are useful for learning DocBook:

  • http://www.docbook.org — Norman Walsh's DocBook: The Definitive Guide. Online O'Reilly book on using DocBook. Contains an excellent element reference. May be too formal for a beginner.
  • A Practical Introduction to DocBook — The Open Source Writers Group's introduction to using DocBook. This is an excellent HOW-TO article on getting started.
  • Getting Going with DocBook: Notes for Hackers — Mark Galassi's introduction to DocBook for hackers. This has to be one of the first introductions to DocBook ever - still as good as it ever was.
  • Dave Pawson's DocBook FAQ — Dave Pawson's FAQ on everything DocBook related. He discusses references, tools, catalogs, and stylesheets in a concise FAQ format. One of the best resources to find answers to common questions and problems about DocBook.
  • FreeBSD Documentation Project Primer for New Contributors — FreeBSD documentation project primer. Chapter 4.2 provides a very good introduction to writing documentation using DocBook. Note that it also describes some custom extensions of DocBook; fortunately, they are clearly marked as such.

Norman Walsh's book is also available in print.

The following sections of this document are designed to help documentation authors write correct and consistent DocBook:

You may also discuss specific DocBook questions with GDP members on the #docs IRC channel at irc.gnome.org and on the gnome-doc-list mailing list.

2.2. GNOME Help Browser

At the core of the GNOME help system is Yelp. Yelp provides a unified interface to several distinct documentation systems on Linux/Unix systems: man pages, info pages, Linux Documentation Project (LDP) documents, GNOME application documentation, and other GNOME documents.

Yelp works by getting a list of all documentation installed on your system from Scrollkeeper, documentation cataloging system used by GNOME, LDP, and other projects. Thus, the documentation that appears in the Yelp is specific to each computer and will typically only represent software that is installed on the computer.

GNOME uses the documentation presented by all the various GNOME components and applications installed on the system to present a complete and customized documentation environment. Yelp describes only components which are currently installed on a users system. Some of this documentation, such as the User's Guide, will be combined in such a way that it appears to be a single document.

By using such a system, you can be sure that any GNOME application you install that has documentation will show up in the index, table of contents, and any search you do in the help browser.

Yelp also integrates the conversion from DocBook to HTML. Yelp takes the DocBook document and runs a XSL processor, xsltproc, which uses a stylesheet to convert the DocBook file to a HTML file. Yelp also uses the GDP's own stylesheets on top of Norman Walsh's stylesheets. This allows the appearance of the all GNOME documentation to change with only altering one specific stylesheet. Using a custom stylesheet gives GNOME a custom help environment.

2.3. Scrollkeeper

Scrollkeeper works with Yelp providing Yelp with the location of the local documentation, a TOC for that document, searching, and indexing abilities based on metadata gathered about the document. Scrollkeeper is a document cataloging system using Open Source Metadata Framework (OMF) files to provide metadata about each document installed in Scrollkeeper's catalog. Scrollkeeper is only meant to catalog documentation available locally on the user's system.

Scrollkeeper uses metadata from OMF files provided with each piece of documentation to categorize the document in its catalog. This catalog is then accessed by Yelp to build the links when Yelp starts up. Currently the OMF files aren't used for anything else, but in future versions of Scrollkeeper it will be utilized.

Scrollkeeper uses DocBook <indexterm> tags in the documentation to build an index. The index is a collection of words which refer to a specific document. In Yelp you can search through these words and view the document they coorespond to.

2.4. GNOME Documentation Components

2.4.1. GDP Stylesheets

The GDP uses its own DocBook stylesheets. These stylesheets are integrated into the Yelp help browser. This means you do not need to install any specific stylesheets. All you need are the standard DocBook stylesheets installed and a working XML Catalog.

If you do not wish to use Yelp to view your completed documentation, the specific GDP stylesheets can be obtained through Subversion. The GDP stylesheets are in the module gnome-doc-utils/trunk/xslt/ of the GNOME Subversion.

2.4.2. GDP DTD

Since DocBook 4.0 the DocBook DTD has included support for PNG graphic files. Therefore the GDP recommends documenters use the standard DocBook DTD.

The GDP used to use a customized DTD for DocBook SGML which added support for PNG graphic files. This is no longer needed.

2.4.3. Application Manuals

Every GNOME application should have an application manual. An application manual is a document specific to the particular application which explains the various windows and features of the application. Application manuals typically use screenshots (PNG format) for clarity. Writing application manuals is discussed in more detail in Section 6 ― Writing Application and Applet Manuals below.

2.4.4. Application Help

Applications should have a Help button on screens on which users may need help. These Help buttons should pull up the default help browser, determined by the File Types and Programs dialog, typically Yelp. The help browser should show either the first page of the application manual, or else the relevant page thereof.

2.4.5. GNOME User Guide

The GNOME User Guide describes the GNOME desktop environment and core components of GNOME such as the panel and nautilus. In GNOME 1.x this was the main source of documentation while sometimes duplicating existing documentation of various components. In GNOME 2.0 this is a document for the web and for printing that is derived from various parts chosen in the system that are necessary for the new user to understand. The User Guide is the main source of documentation for basic components of the GNOME desktop such as the panel, Nautilus, and customizations.

2.4.6. User Documents

Aside from the GNOME User Guide, there are several other documents to help new users learn GNOME, including the Introduction to GNOME, GNOME Installation and Configuration Guide, and the GNOME Administrators Guide.

2.4.7. Developer Documents

There are many White Papers, Tutorials, HOWTO's and FAQ's to make programming GNOME and GNOME applications as easy as possible.

API documentation is also available for the GNOME libraries. This is detailed documentation of the code that is used to build GNOME apps.

You can find general developer documentation on the Developer section of the GNOME Documentation Library.

2.4.8. Project Documents

Some GNOME projects have documentation to maintain consistency in their product and to help new contributors get up to speed quickly. Among these are the GDP documents, such as the one you are reading now.

2.5. Using Subversion

Subversion (SVN) is a tool that allows multiple developers to concurrently work on a set of documents, keeping track of the modifications made by each person. The files are stored on a server and each developer checks files out, modifies them, and then checks in their modified version of the files. Many GNOME programs and documents are stored in the Subversion repository. The GNOME Subversion server allows users to anonymously check out files. Most GDP members will access the repository without a login to download the most up-to-date version of documentation or programs. Modified documents will typically be emailed to the the application developer. Core GDP members may also be granted login privileges so they may commit modified files directly to the Subversion repositories. Below is a simple tutorial which will take you through the basics of using Subversion. A more complete guide is Version Control with Subversion.

2.5.1. Initial Checkout

You can download files anonymously from the server to create a local working copy. As an example, we will check out the files for this handbook. To check out for the first time, type svn checkout http://svn.gnome.org/svn/gnome-devel-docs/trunk/gdp-handbook/ . After you have this document checked out and you would like to download any updates from the Subversion repository, use svn update.

2.5.2. Committing Changes

If you are a registered GNOME developer, you may use your SSH key to authenticate yourself so you can commit changes back to the Subversion repositories. Be sure to read the following section on Subversion etiquette before making any commits. To authenticate to the Subversion server as user username, you will use a slightly different URL. To commit filename to the Subversion server, type svn commit svn+ssh://username@svn.gnome.org/svn/gnome-devel-docs/trunk/gdp-handbook/filename . You will be given an editor window to type in a brief log entry, summarizing your changes. Note the default editor can be changed using the EDITOR environment variable or with the --editor-cmd option.

2.5.3. SVN Etiquette

Because files in Subversion are typically used and modified by multiple developers and documentation authors, users should exercise a few simple practices out of courtesy towards the other Subversion users and the project leader. First, you should not commit changes back to the Subversion repositories without first discussing your plans with the project leader. This way, the project leader knows who is modifying the files and generally, what sort of changes/development is being done. Also, whenever a Subversion user commits a file, they should make an entry in the Subversion log and in the ChangeLog so that other users know who is making modifications and what is being modified. When modifying files created by others, you should follow the indentation scheme used by the initial author.

3. Getting Started Writing GNOME Documentation

3.1. Selecting a Document

The most frequently asked question of new contributors who join the GDP is “which document should I start with?”. Because most people involved are volunteers, we do not assign projects and applications to write documents for. The first step is all yours - you must decide what about GNOME interests you most and find out if it has complete documents or not.

It is also important to spend some time with GNOME to make sure you are familiar enough with it to be authoritative in your writing. The best way to do this is to just sit down and play with GNOME as much as possible before starting to write.

The easiest way to get started is to improve existing documentation. If you notice some inaccuracies or omissions in the documentation, or you think that you can explain the material more clearly, just send your suggestions to the author of the original documentation or to the GNOME documentation project at .

3.2. Installing DocBook

All documentation for the GNOME project is written in XML using the DocBook DTD. There are many advantages to using this for documentation, not least of which is the single source nature of XML. To contribute to the GDP you should learn to use DocBook.

Note

To get started writing for the GDP you do not need to rush out and learn DocBook - if you feel it is too much to handle for now, you can submit plain ASCII text to the http://mail.gnome.org/mailman/listinfo/gnome-doc-list/ and a volunteer will mark it up for you. Seeing your document marked up will also be a great way for you to start learning DocBook.

There isn't a standard set of packages to install DocBook XML and make it work locally. Each distribution installs DocBook XML a bit differently with various degrees of support for needed features.

3.2.1. RPM Users

Download and install the following RPM packages from Tim Waugh's DocBook page:

  • xml-common
  • docbook-dtds
  • docbook-style-xsl
  • libxml2
  • libxslt

This will setup a basic build environment to convert DocBook XML documents into HTML. If you wish to convert your DocBook document into multiple formats, you will need to download and install the following RPM packages from Tim Waugh's DocBook page:

  • xmltex
  • passivetex
  • xmlto

The RPMs for docbook-dtds and docbook-style-xsl might not install a correct entry in your XML Catalog. To check if there is a proper XML Catalog entry for the DTD run the command $ xmlcatalog /etc/xml/docbook "-//OASIS//DTD DocBook XML V4.1.2//EN". If this command returns a URI which starts with file:// then the DTD is correctly installed in the XML Catalog. However, if the command returns No entry for PUBLIC then the DTD is not installed in the XML Catalog.

To check if there is a proper XML Catalog entry for the stylesheets run the command $ xmlcatalog /etc/xml/docbook "http://docbook.sourceforge.net/release/xsl/1.49/". If this command returns a URI which starts with file:// then the stylesheet is correctly installed in the XML Catalog. However, if the command returns No entry for SYSTEM then the stylesheet is not installed in the XML Catalog.

3.2.2. Debian Users

To fetch all required packages, simply run:

			# apt-get install libxslt1 
			# apt-get install docbook-xsl
		  

Debian packages do not install a XML Catalog currently. Since a XML Catalog is essential to view DocBook documents quickly and easily, you will need to install a XML Catalog by hand. This is not too hard because there is a nice script buildDocBookCatalog which will install a XML Catalog. If you want the XML Catalog to be installed in /etc/xml/ you need to run the script as the root user. However, if you want the XML Catalog to be install in your home directory you need to run the script as a regular user.

If the program xmlcatalog is not installed in /usr/bin you might need to alter the buildDocBookCatalog script. Just edit the file in your favorite editor and replace “/usr/bin/xmlcatalog” with “xmlcatalog”. Then as long as the program xmlcatalog is in your path you should be fine.

3.2.3. Installing from Source

To install the DocBook tools from source get the latest version of libxml2 and libxslt and compile it. This will install the basic tools for working with XML files. Next you will need to download the DocBook XML DTD and DocBook XSL Stylesheets (docbook-xsl). These need to be unpacked and placed in the /usr/local/share/xml/docbook/xml-dtd-4.1.2 directory and the /usr/local/share/xml/docbook/xsl-stylesheets-1.48 directory respectively. Now you need to install a XML Catalog so the DTD and stylesheets can be located locally. This is not too hard because there is a nice script buildDocBookCatalog which will install a XML Catalog. If you want the XML Catalog to be install in /etc/xml/ you need to run the script as the root user. However, if you want the XML Catalog to be installed in your home directory you need to run the script as a regular user.

If the program xmlcatalog is not installed in /usr/bin you might need to alter the buildDocBookCatalog script. Just edit the file in your favorite editor and replace “/usr/bin/xmlcatalog” with “xmlcatalog”. Then as long as the program xmlcatalog is in your path you should be fine.

3.2.4. Editors

There are many editors on Linux and UNIX systems available to you. Which editor you use to work on the XML documents is completely up to you, as long as the editor is able to preserve XML and produce the source in a format that is readable by everyone.

Probably the two most popular editors available are Emacs and vi. These and other editors are used regularly by members of the GDP. Emacs has a major mode, psgml, for editing DocBook files which can save you time and effort in adding and closing tags. You will find the psgml package in your distribution of Linux. If your distribution does not use binary packages, the source code for psgml is available at http://psgml.sourceforge.net.

3.3. Using DocBook Tools

There are three tools used with DocBook documents. Xmllint checks the documentation to make sure it is valid DocBook and follows all the rules of XML and the DTD. Xsltproc transforms the document from DocBook to a variety of document formats, including HTML, using XSL stylesheets. Xmlcatalog generates, updates, and checks to make sure the XML catalog is working. You may have used these tools installing DocBook. This isn't meant to be a complete guide to these tools, but an introduction to famaliarize you with the common DocBook tools. If you want more information about any of them consult http://xmlsoft.org or view their respective man pages.

3.3.1. Using xmllint

There are many different ways to use xmllint. Xmllint can check the document conforms to the XML specification. It can check the document validates against the declared DTD or you can force xmllint to use another DTD. Xmllint resolves Xinlcudes and can then check the document validates against a DTD after the Xinclude resolution is complete. There are many options to use with xmllint.

The standard way to use xmllint to show just the errors is to type: xmllint --noout --noent --valid filename.xml . The option --noout suppresses the output of the XML document. Xmllint normally outputs the XML document to the screen and this option stops that behavior. The option --noent resolves any entities which are declared in the document. This allows xmllint to check the validity of the document once the entities are replaced in the document. The last option --valid validates the document against the declared DTD. By default xmllint just checks to see if the document is well-formed XML. This option tells xmllint to check and make sure the document conforms to the DTD too.

When xmllint does not display any errors and returns to the command prompt, the document is valid.

Occasionally you want to validate a document against another DTD. The way to use xmllint to check for errors is to type: xmllint --noout --noent --dtdvalid file:///path/to/dtd/filename.dtd filename.xml. The option --dtdvalid lets you validate the document against a different DTD than the one which was declared in the document. The option has two parts. The first part is the option itself and the second part is the URL to the DTD. In the example above the URL is for a DTD on your local file system. Xmllint can also retreive the DTD from the internet with a valid URL. This is useful to test if the document will conform to two different versions of the DTD.

Sometimes you have a large document and use XIncludes so you have multiple XML files each with their own DTD. The way to use xmlllint to check for errors is to type: xmllint --noout --noent --xinclude --postvalid filename.xml. There are two new options --xinclude and --postvalid. The option --xinclude processes the the document using the XInclude namespace. After the processing is complete you want to check to make sure the entire document conforms to the DTD. The option --postvalid validates the document once all the processing is complete. So, after the XInclude processing is done xmllint is told to validate the document.

3.3.2. Using xsltproc

The program to convert DocBook XML to a variety of output formats is xsltproc. It is a very quick and powerful XSLT processor. This means it can transform large documents from DocBook to HTML using XSLT stylesheets in seconds instead of minutes.

To transform a XML file using a XSLT stylesheet type: xsltproc --noout -o output stylesheet.xsl filename.xml . This takes the file filename.xml and applies the XSL stylesheet stylesheet.xsl. The output of this transformation is saved in the file output. The option --noout surpresses the output of the transformation to the screen. Using the option -o the output of the transformation is saved in the output file. If the stylesheet you are using saves the document in multiple files, also called chunking, the option -o will save the files in the specified directory. This is an important distinction. When the stylesheet saves the document to a single file, -o specifies the output file. When the stylesheet saves the document in multiple files, -o specifies the output directory.

3.3.3. Using xmlcatalog

The program xmlcatalog is a versatile application which creates, edits, and deletes entries in the XML catalog. The XML catalog is similar to the SGML catalog in function, but very different in implementation. XML catalogs are XML files which provide lookup and redirection for DTDs and URIs. This allows the URL given in the DTD declaration of a XML file to be used in the lookup of the DTD locally in your system. XML catalogs can also cascade so one XML catalog can be redirected to another.

To create an XML Catalog type: xmlcatalog --noout --create /etc/xml/catalog. An empty XML Catalog will be created in the directory /etc/xml as the file catalog. Make sure you have write permissions to the directory so the file can be created. Now that you have an empty XML Catalog you need to populate the catalog. To add a DTD to the catalog type: xmlcatalog --noout --add "public" ""-//OASIS//DTD DocBook XML V4.1.2//EN" "file://usr/share/xml/docbook/docbookx.dtd" /etc/xml/catalog. This will redirect all queries for the DocBook V4.1.2 DTD to the location of the DocBook DTD, in this example file://usr/share/xml/docbook/docbookx.dtd. The last option in the command is the location of the XML Catalog. This should be the same place you created the XML Catalog.

3.3.4. Creating Something Useful with your Docs

To view your DocBook documents you've made you need to run Yelp from the commandline. This can be done by typing yelp ghelp:/path/to/filename.xml to have Yelp display the XML file.

If you do not want to use Yelp to view your documentation, you can use xsltproc with the GNOME stylesheets. The program xsltproc takes the DocBook file and using the GNOME stylesheets makes a new HTML file. The HTML file can be viewed from your favorite web browser. You will need to download the GNOME XSL stylesheets in the module gnome-docu/gdp/xsl in GNOME SVN. To run xsltproc type xsltproc general-customizations.xsl filename.xml to produce the HTML.

Producing the HTML directly from the XML is not recommended. The user documentation will be viewed in Yelp. Therefore to see how the docs will look to the user the GDP recommends you use Yelp to view the documentation. An alternative way to view the documentation is given to those who may not have Yelp installed.

3.4. GDP Document Templates

Templates for various types of GNOME documents are found at the GDP Document Templates website. They are kept in SVN at gnome-doc-utils/trunk/data/templates. These templates are meant to guide you through the process of making documentation. They contain the structure of the articleinfo section. The basic structure of a document is outlined. Many different elements are marked up in DocBook such as itemized lists, variable lists, and figures. It is okay to change the templates to fit the application you are writing documentation for. Changing the format of the articleinfo section is not recommended as the output will not look nice.

3.5. Converting GNOME 1.x Documentation to GNOME 2

GNOME 2 documentation is written in DocBook XML, version 4.1.2.

We use DocBook because it provides structured semantic markup, allowing publication in a variety of media. We use XML because of the more flexible tool kit available to use with it.

3.5.1. Conversion

Converting documents from SGML to XML requires a few changes.

The DTD

A new DTD is needed at the start of the document:

	  
<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
]>
	  
			  
Note that the system identifier is required.

Graphic

The graphic tag is deprecated in DocBook version 4, and while it will still work, we plan to change to figure and mediaobject of several flavors, depending on whether the image is a large figure, a small figure, or a screenshot. This will utilize the greater flexibility of DocBook 4.1.2 and specify the content of the images more accurately.

A large figure is a large image which isn't a screenshot. This can be a variety of images. The markup for a large figure:

  
	<figure id="id">
	  <title>Figure Description</title>
	  <mediaobject>
	    <imageobject>
	      <imagedata fileref="path/to/image.png" format="PNG"/>
            </imageobject>
	    <imageobject>
	       <imagedata fileref="path/to/image.eps" format="EPS"/>
            </imageobject>
	    <textobject>
	       <phrase>Acessibility description</phrase>
	    </textobject>
      </mediaobject>
    </figure>
 
			  

A small figure is a small image which isn't a screenshot. This can be a variety of things. The markup for a small figure:

  
  <mediaobject id="id">
	<imageobject>
	  <imagedata fileref="path/to/image.png" format="PNG"/>
	</imageobject>
	<imageobject>
	  <imagedata fileref="path/to/image.eps" format="EPS"/>
	</imageobject>
	<textobject>
	  <phrase>Acessibility description</phrase>
	</textobject>
  </mediaobject>

			  

A screenshot is an image which is taken of the desktop or of an application or a dialog box. The markup for a screenshot:

	 
  <figure id="id">
    <title>Figure Description</title>
	<screenshot>
	  <mediaobject>
	    <imageobject>
	      <imagedata fileref="path/to/image.png" format="PNG"/>
            </imageobject>
	    <imageobject>
	       <imagedata fileref="path/to/image.eps" format="EPS"/>
            </imageobject>
	    <textobject>
	        <phrase>Acessibility description</phrase>
	    </textobject>
      </mediaobject>
    </screenshot>
  </figure>

			  

xref

The xref tag also must be closed:

	   
<xref linkend="mainwindow-fig" />
	  
			  

Artheader

artheader must be replaced with articleinfo. The contents of the meta data for documentation has changed considerably. Refer to the GNOME 2.x templates for more information on how to write the articleinfo section.

3.6. GDP Style Guide

The GDP Style Guide should be read in conjunction with this document. The Style Guide tells how to write documentation, ways to structure the documentation, and technical writing techniques. The GDP Style Guide is located at http://library.gnome.org/devel/gdp-style-guide/stable/.

3.7. Screenshots

Most GNOME documents will have screenshots of the particular applet, application, GNOME component, or widget being discussed. As discussed previously all images for GNOME documentation should be in the PNG format. Alternatively if you wish the documentation to be printed you should also include the same images in EPS format. For the basic DocBook structure used to insert images in a document, see Section 3.7.1 ― Screenshots in DocBook below.

3.7.1. Screenshots in DocBook

If your document uses images you will need to take note of a few things that should take place in order for you to make use of those images in your output.

The DocBook tools and applications are smart enough to know that when you are creating html you will be using PNG files and when you are creating Postscript you will be using EPS files (you must use EPS with Postscript).

<figure id="id">
  <title>My Picture</title>
  <screenshot>
    <mediaobject>
      <imageobject>
        <imagedata fileref="myfile.png" format="PNG"/>
      </imageobject>
      <textobject>
        <phrase>Acessibility description</phrase>
      </textobject>
    </mediaobject>
  </screenshot>
</figure>
   

If you want to create PostScript ouput, you will need to create an EPS version of your image file to be displayed in the PostScript file. There is a simple script available which allows you to change a PNG image into an EPS file easily. You can download this file - png2eps - from http://dmason.net/download/png2eps.

3.7.2. Screenshot Appearance

Screenshots of windows should show GNOME's default theme, Clearlooks. (Your distribution may be using a different default.)

This is to minimize possible confusion to the reader, improve the appearance of GNOME documents, and guarantee the screenshot is readable when printed.

If you are unable to provide screenshots in this form, you should create screenshots as you wish them to appear and send an email to the http://mail.gnome.org/mailman/listinfo/gnome-doc-list/ requesting a GDP member reproduce these screenshots in the correct format and email them to you. Please do not send the actual images in the email but wait until you contact someone to do the screenshots for you and mail them the images.

3.8. Application Bugs

Documentation authors tend to investigate and test applets and applications more thoroughly than most users. Often documentation authors will discover one or more bugs in the software. These bugs vary from small ones, such as mis-spelled words or missing About dialogs in the menu, to large ones which cause the applet to crash. As all users, you should be sure to report these bugs so that application developers know of them and can fix them. The easiest way to submit a bug report is by using Bug Buddy located in Applications ▸ Programming ▸ Bug Report Tool.

4. DocBook Basics

4.1. Introduction to DocBook

To understand DocBook, a basic understanding of SGML and XML is helpful.

SGML stands for Standard Generalized Markup Language and is one of the first markup languages ever created. A different, but similar markup language is XML which stands for Extended Markup Langauge. XML extends and structures SGML in ways which were optional using SGML. Both use what are called Document Type Definitions (DTD) to define document structural types such as HTML and DocBook. A DTD specifies document elements which are delimited by angle brackets, < and >, and document text is then marked by both beginning and ending elements. Using the DocBook DTD, for example, one marks up a title with <title>The Title</title>. The DTD (in the case of the GDP, DocBook) also defines rules for how the elements can be used. For example, if one element can only be used when embedded within another, this is defined in the DTD.

A XML file is just a plain ASCII file containing the text with the markup specified above. To convert it to some easily readable format, you need special tools. The GDP uses xsltproc, a free converter which converts the DocBook file into browser readable HTML using XSL stylesheets. Yelp is used to run xsltproc and then display the resulting HTML in a user friendly format. You can read more about DocBook in Section 3.3 ― Using DocBook Tools.

The final appearance of the output (e.g. PostScript or HTML) is determined by a stylesheet. Stylesheets are files, written in a special language (XSL — Extended Specification Language or DSSSL — Document Style Semantics and Specification Language), which specify the appearance of various DocBook elements, for example, what fonts to use for titles and various inline elements, page numbering style, and much more. You need to install a common collection of stylesheets in Section 3.2 ― Installing DocBook (Norman Walsh's modular stylesheets). The GNOME Documentation Project uses a customized set of stylesheets on top of Norman Walsh's version.

The advantage of specifying the structure of a document with XML instead of specifying the appearance of the document with a typical word processor, or with HTML, is that the resulting document can be processed in a variety of ways using the structural information. Whereas formatting a document for appearance assumes a medium (typically written text on a standard-sized piece of paper), XML can be processed to produce output for a large variety of media such as text, postscript, HTML, Braille, audio, and potentially many other formats. This assumption of a specific media makes translating documents not written in XML very difficult.

Using elements contained in a document to structure the text of that same document also allows search engines to make use of that information. For example, if you are searching for all documents written by the author “Susie” your search engine could be made smart enough to only search <author> elements, making for a faster and more accurate search.

Using a stylesheet to determine the overall appearance of the output, rather than the DTD or the XML document, allows everyone in the project to create documents with the same look just by using the same stylesheet. It also allows the look to be updated just by modifying that one stylesheet.

As stated before, the GDP uses the DocBook DTD. For a list of introductory and reference resources on DocBook, see Appendix A ― Resources. The following sections also provide convenient instructions on which markup tags to use in various circumstances. Be sure to read Section 5 ― GDP Documentation Guidelines for GDP documentation-specific guidelines.

4.2. Starting a Document

DocBook can be used to write many different documents. Glossaries, FAQs, indexes, books, and articles are some of the documents which can be written. To start the type of document you will need to enclose the document in the appropriate tag. You will be able to tell the type of document from the first tag. For books you will enclose the document in the <book> tag and for articles you will enclose the document in the <article> tag.

DocBook documents contain meta data, data which describes the document, typically at the beginning of the document. This meta data will include copyright notices, author information, revision history, and release information. The meta data is enclosed within the info tags. For books you will enclose the meta data with the <bookinfo> tag and for articles you will enclose the meta data in the <articleinfo> tag.

Throughout this chapter a full article will be produced showing you how to write a full article in DocBook. So far we have

<article>
  <articleinfo>
  This will contain some information about the document.
  </articleinfo>
  This is the body of the document.
</article>

      
as our document. As you continue to learn more about DocBook the article will grow.

4.2.1. Sections and Paragraphs

DocBook has sections for structuring your document up to 5 sections deep. Also paragraphs must be enclosed with the <para> tag. The top-level element of a book body is <chapter>; it may contain one or more <sect1>, each of them may contain <sect2> and so on up to <sect5>. The top-level element of an article body is always <sect1>. Regardless of which elements you use, give each structural element an unique id, see Section 5.2 ― Section IDs.

Please try to avoid using deeply nested sections. For most situations, <sect1> and <sect2> should be sufficient. If not, you probably should split your <sect1> into several smaller ones. For splitting large sections into smaller ones, see the GNOME Documentation Style Guide.

Each section needs to contain a title. The title is a concise description of the content of a section. The <title> tag encloses the title of each section. The title is placed right after the section tags but before the body of the section. For help on writing good titles, see the GNOME Documentation Style Guide.

Use the tag <para> for paragraphs. If there is only one paragraph in a section you still need to use the para tag. You need to close the tag at the end of the all paragraphs. If the paragraph is only one line you should place the para tags on the same line. If the paragraph is multiple lines the para tags should be placed on separate lines as shown in the example below.

The most basic section of DocBook is made up of three parts. The section tags define where each section of text begins and ends, the title tags give a concise description of each section and the paragraph tags surround the text. So for our article document looks like:

<article>
  <articleinfo>
  This will contain some information about the document.
  </articleinfo>

  <sect1>
    <title>DocBook Example</title>
    <para>
      This is an example of using DocBook for the most basic type of
      document.  The article just has one section and one paragraph.
    </para>
  </sect1>
</article>

	
This is a very basic document with only one section and no meta data.

4.2.2. DocBook Meta Data

The meta data of a document is put in <articleinfo> or <bookinfo> tags. The title of the entire document is put in the meta data. It is enclosed in the <title> tag. The copyright information is enclosed in the <copyright> tags. The copyright years are put inside the <year> tag and the copyright holder is put inside the lt;holder> tag. For example:

<copyright>
  <year>2002</year>
  <holder>Eric Baudais</holder>
</copyright>

	
is how the copyright information should look like inside articleinfo.

The author information contains the author's name, their address, and any affiliation. The authors of a document are enclosed in the <authorgroup> tag. The individual author's information is put inside the <author> tag. If there is only one author of the document you do not need the authorgroup tag. The author's name is divided into their firstname and surname with the two tags <firstname> and <surname>. The author's affiliation is put inside the <affiliation> tag. The address can be the author's email address or a physical address where they can be contacted through regular mail. For example:

<authorgroup>
  <author>
    <firstname>Eric</firstname>
    <surname>Baudais</surname>
    <affiliation>
      <orgname>GNOME Documentation Project</orgname>
      <address>
        <email>baudais@kkpsi.org</email>
      </address>
    </affiliation>
  </author>

  <author>
    <firstname>John</firstname>
    <surname>Doe</surname>
    <affiliation>
      <orgname>Free Software Foundation</orgname>
      <address>
        59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
        <email>john.doe@gnu.org</email>
      </address>
    </affiliation
  </author>
</authorgroup>

	
is how the author information should look inside the articleinfo. There are more information you can include inside the author tag. This is just the basics of how to construct the meta data.

The last meta data for a document is any legal statements such as the license of the document or any disclaimers or any warranties and the release information. The legal information about the document is enclosed in the <legalnotice> tag. You can have a title for the legalnotice using the <title> tag. The legalnotice should be treated as a section of the articleinfo. All paragraphs should be enclosed with the <para> tag. The release information is enclosed in the <releaseinfo> tag. This is different from the legalnotice because the release information is entered without any paragraph tags. For example:

<legalnotice>
  <title>Legal Notices</title>

  <para>
    Permission is granted to copy, distribute and/or modify this
    document under the terms of the GNU Free Documentation
    License (GFDL), Version 1.1 or any later version published
    by the Free Software Foundation with no Invariant Sections,
    no Front-Cover Texts, and no Back-Cover Texts.  You can find
    a copy of the GFDL at this <ulink type="help"
    url="ghelp:fdl">link</ulink> or in the file COPYING-DOCS
    distributed with this manual.
  </para>
</legalnotice>

<releaseinfo>
  This is version 1.0.0 of DocBook Basics documenting version 4.1.2 of
  DocBook XML.
</releaseinfo>

	
is the other information included in the meta data. There are more information about the document you can include, but this is a good beginning for a basic document.

The document created so far includes the meta data and the body of the documentation. Our article document now looks like:

<article>
  <articleinfo>

    <copyright>
      <year>2002</year>
      <holder>Eric Baudais</holder>
    </copyright>

    <authorgroup>
      <author>
        <firstname>Eric</firstname>
        <surname>Baudais</surname>
        <affiliation>
          <orgname>GNOME Documentation Project</orgname>
          <address>
            <email>baudais@kkpsi.org</email>
          </address>
        </affiliation>
      </author>

      <author>
        <firstname>John</firstname>
        <surname>Doe</surname>
          <affiliation>
          <orgname>Free Software Foundation</orgname>
          <address>
            59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
            <email>john.doe@gnu.org</email>
          </address>
        </affiliation
      </author>
    </authorgroup>

    <legalnotice>
      <title>Legal Notices</title>

      <para>
        Permission is granted to copy, distribute and/or modify this
        document under the terms of the GNU Free Documentation
        License (GFDL), Version 1.1 or any later version published
        by the Free Software Foundation with no Invariant Sections,
        no Front-Cover Texts, and no Back-Cover Texts.  You can find
        a copy of the GFDL at this <ulink type="help"
        url="ghelp:fdl">link</ulink> or in the file COPYING-DOCS
        distributed with this manual.
      </para>
    </legalnotice>

    <releaseinfo>
      This is version 1.0.0 of DocBook Basics documenting version 4.1.2 of
      DocBook XML.
    </releaseinfo>

  </articleinfo>

  <sect1>
    <title>DocBook Example</title>
    <para>
      This is an example of using DocBook for the most basic type of
      document.  The article just has one section and one paragraph.
    </para>
  </sect1>
</article>

	
The document is still very basic with not much content. Yet there is lots of meta data information about the document. As you learn more about the DocBook tags your documents will become more complex. However, the basic structure of the document is done and all that is left is to write the document.

4.3. Structural Elements

DocBook has many other tags to structure a document than sections and paragraph. Notes, figures, lists, and tables can all be included into a document and are as much a part of the way a document is structured as sections and paragraphs. An explanatory figure or table in the right place will enlighten the reader and enhance the appearance and readability of the document. The GNOME Documentation Style Guide talks more about when and where to use these effectively. Some of these are easy to use with DocBook while others take a while to master.

4.3.1. Notes, Warnings, and Tips

For notes, tips, warnings, and important information, called admonitions, should be set apart from the main text (usually as a paragraph with some warning sign on the margin). A title is usually a good idea as it tells the reader what information you are trying to set off, but is entirely optional. Use the tags <note>, <tip>, <warning>, <important> respectively. For example:

<tip>
<title>DocBook Validation Tip</title>
  <para>
    To validate DocBook without displaying the document, add the
    argument <parameter class="option">--noout</programlisting> to the
    <application>xmllint</programlisting> command.
  </para>
</tip> 
produces

DocBook Validation Tip

To validate DocBook without displaying the document, add the argument --noout to the xmllint command.

The <tip> tag should not be inside a <para> tag but between paragraphs.

4.3.2.  Screenshots and other Figures

To include screenshots and other figures, use the following tags:

<figure id="app-FIG-shot1">
 <title>Screenshot</title>
 <screenshot>
  <mediaobject>
   <imageobject>
    <imagedata fileref="figures/example_screenshot.png" format="PNG"/>
   </imageobject>
   <textobject>
     <phrase>Shows the application screenshot with several buttons.</phrase>
   </textobject>
   <caption>
    <para>Screenshot of a program</para>
   </caption>
  </mediaobject>
 </screenshot>
</figure>
	
replacing example_screenshot with the actual file name (without extension). The result will look like this:
Figure 1Screenshot

Screenshot of a program

4.3.3. Screenshot Tools

There are many tools for taking screenshots in GNOME/Linux. Perhaps the most convenient is the Take a Screen Shot tool located in Actions ▸ Take a Screen Shot. Just choose whether you want to save the screenshot to a file or on the desktop and click Okay. When you click the Okay button the tool will take a screenshot in a second. If you want a window in focus you will need to focus the window in the second from when you click the Okay button to when the tool takes a screen shot. For applets in a Panel, GIMP can be used to crop the screenshot to only include the relevant portion of the Panel. Note that GIMP can both be used for taking screenshots, cropping screenshots, and converting image formats. If you need to convert an image to PNG from another format make sure you use compression liberally. A high compression level will usually look fine in Yelp.

4.3.4. Taking Screenshots Without Callouts

To create a screenshot that does not require callouts, follow these steps:

  1. Start GIMP.
  2. Choose File ▸ Acquire ▸ Screenshot. A Screen Shot dialog is displayed.
  3. Select the options that you require in the Screen Shot dialog, then click OK. GIMP takes the screenshot, and displays the screenshot.
  4. If necessary, scale the image down. Save the image as PNG.

Alternatively, to take a screenshot of the desktop, choose Actions ▸ Take a Screen Shot. The screenshot is displayed in a Screenshot dialog. If necessary, you can use GIMP to crop the screenshot, or to scale the image down.

4.3.5. Creating Screenshots With Callouts

You can download a sample screenshot with callouts, sample_anno_panel.xcf. This file is in the native format of GIMP, XCF. To create a screenshot and all callouts to the screenshot, follow these steps:

  1. Start GIMP.

  2. Choose File ▸ Acquire ▸ Screenshot. A Screen Shot dialog is displayed.

  3. Select the options that you require in the Screen Shot dialog, then click OK. GIMP takes the screenshot, and displays the screenshot.

  4. Create space on the image in which to add the callouts. To do this, right-click on the image, then choose Image ▸ Canvas Size. A Set Canvas Size dialog is displayed. Specify the new size of the image in the upper part of this dialog. Use the lower part of the dialog to position the screenshot in the image.

    Alternatively, you can create a large new image, then paste in the screenshot. When you are finished you can use the Crop tool to resize the image.

  5. Save the file in XCF format. XCF is the native format of GIMP and allows you to use complex graphical features such as layers.

  6. When your screenshot is localized, the localizer might cut out the screenshot in the original language, and paste in the screenshot in the new language. A mark that indicates the location of the screenshot might be helpful in this case.

    Create the mark in a new layer. To create a new layer, right-click on the image, then choose Layers ▸ Layers, Channels & Paths. The Layers, Channels & Paths dialog is displayed. Click on the New Layer button at the bottom left of the dialog. Name the layer Top left corner of image.

    Use the Pencil tool to draw a right angle around the top left corner of the image. Format the lines as follows:

    • Foreground colour: Green (Hex triplet: #00ff00)
  7. Create a new layer for the callout lines. Name the layer Callout lines.

    Use the Pencil tool to draw the callout lines. To keep the lines straight, click to start drawing the line, then press-and-hold Shift. Format the lines as follows:

    • Brush: pixel (1 x 1 square)
    • Foreground colour: Black (Hex triplet: #000000)

    Use straight horizontal and vertical lines only.

  8. Use the dynamic text plugin to create the callout text. To access the Dynamic Text plugin, right-click on an image, then choose Filters ▸ Render ▸ Dynamic Text. This creates a new layer for each text item. Format the text as follows:

    • helvetica(adobe)
    • medium
    • 11-point
    • anti-aliased

    Rename the layers so that the name of the layer matches the text that appears in the callout. Prefix each layer name with Text: .

  9. Save the image as PNG (right-click on the image and choose File ▸ Save As). An Export File dialog is displayed. This warns that you are about to flatten the layers in the image. Click on the Export button. A Save As PNG dialog is displayed. Deselect the Save background color option. Ensure that you do not overwrite the XCF file!

4.3.6. Program Listings and Terminal Session

To show a file fragment—for example, program listing—use <programlisting> tag:

<programlisting>
[Desktop Entry] 
Name=Gnumeric spreadsheet
Exec=gnumeric 
Icon=gnome-gnumeric.png 
Terminal=0
Type=Application
</programlisting>
	
which produces
[Desktop Entry] 
Name=Gnumeric spreadsheet 
Exec=gnumeric
Icon=gnome-gnumeric.png 
Terminal=0 
Type=Application
	
As a matter of fact, all examples in this document were produced using <programlisting>.

To show a record of a terminal session (i.e. sequence of commands entered at the command line) use the <screen> tag:

<screen>
<prompt>bash$</prompt><userinput>make love</userinput> 
make: *** No rule to make target `love'. Stop.
</screen>
	
which produces
bash$make love  
make: *** No rule to make target `love'.  Stop.
	
Observe the use of tags <prompt> and <userinput> for marking system prompt and commands entered by user.
Note

Note that both <programlisting> and <screen> preserve linebreaks, but interpret XML tags (unlike LaTeX verbatim environment). Take a look at the source of this document to see how you can have XML tags literally shown but not interpreted,

4.3.7.  Lists

The most common list types in DocBook are <itemizedlist>, <orderedlist>, and <variablelist>.

<itemizedlist>

This is the simplest unnumbered list, parallel to <ul> in HTML. Here is an example:

<itemizedlist>
  <listitem>
    <para>
      <guilabel>Show backup files</guilabel> &mdash; This will
      show any backup file that might be on your system.
    </para>
  </listitem>
  <listitem>
    <para>
      <guilabel>Show hidden files</guilabel> &mdash; This will
      show all "dot files" or files that begin with a dot.  Those
      files typically include configuration files and directories.
    </para>
  </listitem>
  <listitem>
    <para>
      <guilabel>Mix files and directories</guilabel> &mdash; This
      option will  display files and directories in the order you
      sort them instead of 
      always having directories shown above files.
    </para>
   </listitem>
</itemizedlist> 

	      
and output:

  • Show backup files — This will show any backup file that might be on your system.
  • Show hidden files — This will show all "dot files" or files that begin with a dot. Those files typically include configuration files and directories.
  • Mix files and directories — This option will display files and directories in the order you sort them instead of always having directories shown above files.

Note the use of the character entity &mdash; for a long dash (see Section 4.4.6 ― Special Symbols ). Also, please note that the result looks much nicer because the terms being explained (Show backup files, etc.) are set in a different font. In this case, it was achieved by using <guilabel> tag. In other cases, use appropriate tags such as <guimenuitem>, <command>, or — if none of this applies — use <emphasis>.

<orderedlist>

This list is completely analogous to <itemizedlist> and has the same syntax, but it produces numbered list. By default, this list uses Arabic numerals for numbering entries; you can override this using numeration, for example <orderedlist numeration="lowerroman">. Possible values of the numeration attribute are arabic, upperalpha, loweralpha, upperroman, and lowerroman.

<variablelist>

This list is used when each entry is rather long, so it should be formatted as a block of text with some subtitle, like a small subsection. The <variablelist> is more complicated than itemizedlists, but for larger blocks of text, or when you're explaining or defining something, it's best to use them. Their greatest advantage is that it's easier for a computer to search. The lines you are reading now were produced by <variablelist>. The source looked liked this:

<variablelist>
  <varlistentry>
    <term> <sgmltag>&lt;itemizedlist&gt;</sgmltag></term> 
    <listitem><para> 
	This is the simplest unnumbered list, parallel to
        <sgmltag>&lt;ul&gt;</sgmltag> in HTML. Here is an example:...
    </para></listitem>
    </varlistentry>
    <varlistentry>		 
	<term> <sgmltag>&lt;orderedlist&gt;</sgmltag></term>
     <listitem><para>	
	This list is completely analogous to
	<sgmltag>&lt;itemizedlist&gt;</sgmltag> 
    </para></listitem>
    </varlistentry>
    <varlistentry>		 
	<term> <sgmltag>&lt;variablelist&gt;</sgmltag></term>
     <listitem><para>	
		This list is used when each entry is rather long,...
    </para></listitem>
    </varlistentry>
</variablelist>        

	      

Lists can be nested; in this case, the stylesheets are smart enough to change the numeration (for <orderedlist>) or marks of each entry (in <itemizedlist>) for sub-lists

4.4. Inline Elements

4.4.1. GUI elements

  • <guibutton> — used for clickable buttons in the user interface
  • <guimenu>, <guisubmenu> —used for top-level menus and submenus respectively, for example <guisubmenu>Utilities</guisubmenu> submenu of the <guimenu>Main Menu</guimenu>
  • <guimenuitem>—an entry in a menu
  • <guiicon>—an icon
  • <guilabel>—for items which have labels, like tabs, bounding boxes, or radio buttons.
  • <interface>— for most everything else... a window, a dialog box, the Panel, etc.

If you need to refer to a sequence of menu choices, such as Main Menu ▸ Utilities ▸ GNOME terminal there is a special construction for this, too:

<menuchoice>
  <guimenu>Main Menu</guimenu> <guisubmenu>Utilities</guisubmenu>
  <guimenuitem>GNOME terminal</guimenuitem> </menuchoice>
	

4.4.2. Links and References

To refer to another place in the same document, you can use tags <xref> and <link>. The first of them automatically inserts the full name of the element you refer to (section, figure, etc.), while the second just creates a link (in HTML output). Here is an example:

An example of a <link linkend="app-extip">tip</link> was given in
<xref linkend="notes" />.

	
which produces:
An example of a tip was given in  Section 4.3.1 ― Notes, Warnings, and Tips.

Here notes is the id attribute of Section 4.3.1 ― Notes, Warnings, and Tips and extip is the id attribute of the section about tips.

To produce a link to an external source, such as a Web page or a local file, use the <ulink> tag, for example:

To find more about GNOME, please visit the <ulink type="http"
url="http://www.gnome.org">GNOME Web Site</ulink>

	
which produces:
To find more about GNOME, please visit the GNOME Web Site

You can use any of the standard URL types, such as http, ftp, file, telnet, mailto (in most cases, however, use of mailto is unnecessary—see discussion of <email> tag).

For more on this topic, see Section 7 ― Cross Referencing Other Documentation.

4.4.3. Filenames, commands, and other computer-related things

Here are some tags used to describe operating system-related things:

  • <filename> — used for filenames, e.g.<filename> foo.sgml </filename> produces: foo.sgml.
  • <filename class="directory"> — used for directories, e.g.<filename class="directory">/usr/bin </filename> produces: /usr/bin.
  • <application> — used for application names, e.g. <application>Gnumeric </application> produces: Gnumeric.
  • <envar> — used for environment variables, e.g. <envar>PATH</envar> produces : PATH
  • <command> — used for commands entered on command line, e.g. <command>make install </command> produces: make install.
  • <parameter> — used for options or arguments passed to a system call or command, e.g. <parameter>--version </parameter> produces: --version.
  • <replaceable> — used for replaceable text, e.g. <command>db2html<replaceable> foo.sgml </replaceable></command> produces: db2html foo.sgml.

4.4.4. Keyboard Input

To mark up text input by the user, use <userinput>.

To mark keystrokes such as shortcuts and other commands, use <keycap>. This is used for marking up what is printed on the top of the physical key on the keyboard. There are a couple of other tags for keys, too: <keysym> and <keycode>. However you are unlikely to need these for most documentation. For reference, <keysym> is for the “symbolic name” of a key. <keycode> is for the “scan code” of a key. These are not terms commonly required in GNOME documentation, although <keysym> is useful for marking up control codes.

To mark up a combination of keystrokes, use the <keycombo> wrapper:

<keycombo>
 <keycap>Ctrl</keycap>
 <keycap>Alt</keycap>
 <keycap>F1</keycap>
</keycombo>
	

Finally, if you want to show a shortcut for some menu command, here are the appropriate tags (rather long):

<menuchoice>
 <shortcut>
  <keycombo><keycap>Ctrl</keycap><keycap>q</keycap></keycombo>
 </shortcut> 
 <guimenuitem> Quit</guimenuitem> 
</menuchoice>
	
which produces simply Quit ( Ctrl-q )

4.4.5. E-mail Addresses

To mark up e-mail address, use <email>:

 The easiest way to get in touch with me is by e-mail
(<email>me@mydomain.com</email>)
	
which produces: The easiest way to get in touch with me is by e-mail () Note that <email> automatically produces a link in the HTML version.

4.4.6.  Special Symbols

DocBook also provides special means for entering typographic symbols which can not be entered directly form the keyboard (such as copyright sign). This is done using character entities, which ii the XML analogue of macros, or commands, of LaTeX. They generally have the form &entityname;. Note that the semicolon is required.

here is partial list of most commonly used enitites:

  • &amp; — ampersend (&)
  • &lt; — left angle bracket (<)
  • &gt; — right angle bracket (>)
  • &copy; — copyright sign (©)
  • &mdash; — long dash (—)
  • &hellip; — ellipsis (…)

Note that the actual look of the resulting symbols depends on the fonts used by your browser; for example, it might happen that long dash (&mdash;) looks exactly like the usual dash (-). However, in the PostScript (and thus, in print) the output will look markedly better if you use appropriate tags.

4.5. Indexing

5. GDP Documentation Guidelines

5.1. XML Requirements

All GNOME documentation should conform to XML syntax requirements, which are stricter than SGML ones.

5.2. Section IDs

Section IDs are unique identifiers that you assign to each section of an XML file. You can use the section IDs to cross-reference sections.

The following sections contain suggestions as to how to write section IDs in XML files. The only real requirement for writing section IDs is that the IDs must be unique within a document.

5.2.1. How to Tag a Section ID in XML

Use the id attribute with the <sect> tag. For example:

<sect1 id="gedit-intro">.

5.2.2. How to Structure Section IDs in Online Help

These guidelines do not apply to the top-level ID associated with the <article> tag in a help manual, that is:

<article id="index" lang="en">

Use the following guidelines to write consistent section IDs in documentation:

  1. Form the first part of each ID using the filename of the XML file for the documentation. For example, if the filename of the XML book file is gedit.xml, the first part of each section ID is “gedit”. Likewise, if the name of the XML file is gnome-dictionary.xml, the first part of the section ID is “gnome-dictionary”.

  2. Follow the first part of the ID with a hyphen. For example:

    gedit-

    gnome-dictionary-

  3. If the section ID is a table section ID, follow the first part of the ID with “TBL-”:

    gedit-TBL-

  4. If the section ID is a figure section ID, follow the first part of the ID with “FIG-”:

    gedit-FIG-

  5. Form the remainder of the ID using an abbreviated form of the section title. Here are some examples:

    • If the title of the section is “Introduction”, use “gedit-intro”.
    • If the title of the section is “Preferences”, use “gedit-prefs”.
    • If the title of the section is “Save Tabbed Section”, which is a subsection of “Preferences”, you can use “gedit-prefs-save”.
    • If the title of the section is “To Save a File”, use an ID similar to “gedit-save-file”.
    • If the title of a figure is “gedit Main Window”, use an ID similar to “gedit-FIG-main-window”.

    The important thing is that all section IDs are unique within each XML file.

5.2.3. When to Change Section IDs for Online Help

If you receive a request from the developer of an application or applet to change the name of the XML file for a manual, you should also change the section IDs in your document to match the new filename. For example, if the Fish Applet is renamed the Wanda Applet and the filename changes from fish.xml to wanda.xml, you should change the first part of each section ID from “fish-” to “wanda-”.

Do not change the XML filename or section IDs without the approval of the developer as this impacts the help calls from the application to the online help manuals.

5.2.4. How to Structure Section IDs in a Book

Use the following guidelines to write consistent section IDs in a book:

  1. Form the first part of every ID using the name of the XML file that the ID is located in. For example, for a file called windows.xml, use “windows”.

  2. Follow the first part of the ID with a hyphen:

    windows-

  3. If the section ID is a table section ID, follow the first part of the ID with “TBL-”:

    windows-TBL-

  4. If the section ID is a figure section ID, follow the first part of the ID with “FIG-”:

    windows-FIG-

  5. Complete the section ID with a number that uniquely identifies the section ID:

    windows-123

    windows-TBL-456

    windows-FIG-789

It is important that all section IDs are unique within all the XML files in the book.

5.2.5. When to Change Section IDs in a Book

If you change the name of a book file, you should change the section IDs to match the new filename. For example, if the windows.xml file is renamed dialogs.xml, you should change the first part of the section IDs to “dialogs-”.

Changing section IDs in a book might affect online help calls. Contact the developer responsible for the help calls before you change any section IDs. If there are negative implications associated with changing the section IDs, you should not change the IDs to match the filename.

5.3. Authors' Names

All GNOME documentation should contain the names of all documentation authors who have worked on the document. The email address of all authors should also be included. Even if you totally rewrote the documentation you still need to include the names of any authors of previous documentation for the specific application, applet, component, or widget.

5.4.  Copyright Information

Application documentation should contain a copyright notice, stating the licensing terms. It is suggested that you use the GNU Free Documentation License. You could also use some other license allowing free redistribution, such as GPL or Open Content license. If documentation uses some trademarks (such as UNIX, Linux, Windows, etc.), proper legal junk should also be included (see templates).

If there is existing documentation then the author's copyright notice and license must be used. This is to ensure that licenses and copyrights stay intact from version to version of the application and documentation.

If you decide to use the GNU Free Documentation License, then all you need to do include the file legal.xml as a system entity (see templates). Otherwise you need to mark up the license you are going to use and include it in place of legal.xml.

5.5. Revision History

All GNOME documentation should contain the names of all previous documentation titles along with the current title for the documentation. The current documentation title should indicate the version of the documentation. The revision history should also contain the authors and their email addresses for the documentation they wrote and the publisher of the documentation. This allows anybody to see how many revision the current documentation has undergone.

The revision history can also contains notes in the description for the specific version of the documentation. If the author rewrote the documentation from scratch this should be indicated in the revision description. Any extra descriptions need to be carried over to a new version of the documentation — see the templates for an example.

5.6. Application Version Identification

Application documentation should identify the version of the application for which the documentation is written. This information should be included in the <releaseinfo> tag:

<releaseinfo>
This manual describes version 1.56 of gfoobar.
</releaseinfo>
	  

5.7. Publisher's Name

All GNOME documentation must include information about the publisher of the document. This will always be the GNOME Documentation Project (see templates).

5.8. GNOME Documentation Style Guide

The GNOME Documentation Style Guide should be followed at all times in writing and editing GNOME Documentation. It contains writing tips, word usage, and grammatical errors common in technical writing. You should read it before you start writing and use it as the authoritative resource for writing style. To obtain a copy of the GNOME Documentation Style Guide go to http://library.gnome.org/devel/gdp-style-guide/stable to view it.

5.9. Software License

All GNOME applications must contain information about the license (for software, not for documentation), either in the “About” box or in the manual.

5.10.  Bug Reporting

Application documentation should give an address for reporting bugs and for submitting comments about the documentation (see templates for an example).

6. Writing Application and Applet Manuals

Every GNOME application or applet should have a manual specific to that particular application. This manual should be a complete and authoritative guide. The manual should describe what the program does and how to use it. Manuals will typically describe each feature and preference option presented to the user using screenshots (in PNG format only) when appropriate. They should also describe each window and panel if available.

An invaluable resource to the documentation writer is the GNOME Documentation Style Guide (GDSG or just style guide). The style guide gives pointer to writing documentation, word usage, usability, and DocBook style. There are check lists for writing good documentation. The style guide contains guidelines for writing to an international audience so translations of the documentation don't lose content in translation. An approved word list and definitions are available so a set of basic technical words have the same meaning. It is always handy to keep the style guide at your side or in a hardcopy so you can refer to it while writing documentation. The GNOME Documentation Style Guide can be obtained at http://library.gnome.org/devel/gdp-style-guide/stable/ or in the SVN module gnome-devel-docs/trunk/gdp-style-guide.

Documentation Availability

Applications and applets should not rely on documentation which is only available on the internet. All manuals and other documentation should be packaged with the application or applet and be made available to the user through the standard GNOME help system methods described below.

Application manuals should be based on the template in for GNOME version 2.x.. Applet manuals should be based on the templates for GNOME versions 2.x.

Manuals For Large Applications

Manuals for very large applications, such as GNOME Office components should be a <book> (and thus use <chapter> for each primary section) , instead of <article> which most applications use (with each primary section being a <sect1>).

Application manuals should be made available by having a Contents entry in the Help pull-down menu at the top of the application, as described in Section 9.3 ― Listing Documents in the Help Menu. Applets should make their manuals available by right-clicking on the applet.

7. Cross Referencing Other Documentation

In many circumstances you may want to create a link from one document to another. This can be done using GNOME's virtual filesystem layer. You use a specific Uniform Resource Identifier (URI) scheme to identify the type of documentation. There are different schemas which tell Yelp what type of document the you are referencing.

7.1. Uniform Resource Identifier

The Uniform Resource Identifier (URI) is made up of three parts: the schema, the document and the id. The schema declares the type of document. Some of the well known schemas are: http://, ftp://, file://. There are three specific schemas identifying documentation in GNOME 2. The schema ghelp: identifies GNOME documentation. The schema man: is used to reference man pages and the schema info: identifies info pages. Yelp only uses the schemas ghelp:, man: and info: to cross reference documentation you must use one of those three schemas.

The second part of the URI is the document. This is really the path to the document and identifying the document itself. You can either give the full path to the document on the computer, give the filename of the document, or just give the appid. It is not recommended to use the full path of the document to reference documentation. This will lead to broken links and heartaches. You should always either use the name of the document (e.g. gedit.xml) or use the appid to reference the main documentation (e.g. gedit).

The appid is the way the GNOME build system identifies applications. The appid is unique, but sometimes it is hard to deduce the appid. The appid is typically the name of the module in SVN. An example is the appid for the GNOME Terminal is gnome-terminal and its module name in SVN is also gnome-terminal. For some applications this rule of thumb does not hold. An example is the appid for the Stock Ticker is gtik2_applet2, but its module name in SVN is gtik. If you are having trouble figuring out the appid of an application ask the maintainer of the program.

The third part of the URI is the id. The id is the unique DocBook id made for every section. For more information on section ids see Section 5.2 ― Section IDs. The id is optional, but will let you choose where in the document the reader will look instead of placing the reader at the table of contents. It is recommended to use ids in the URI to accurately direct the reader to a specific portion of the document.

The three parts of the URI are put together to cross reference documentation in GNOME. The URI is formed by placing the schema first, followed by the appid or filename of the document. A question mark is placed after the appid, but before the section id. Then the section id is put after the question mark. The complete URI looks like:

ghelp:gedit?intro
	  
In the above example the schema is “ghelp:”, the appid is “gedit”, and the section id is “intro”. Note the absence of slashes after the schema: with slashes, what follows is assumed to be a file rather than an appid.

7.2. GNOME Documentation

Adding a link to a different GNOME help document is not hard. This is done using the “ghelp:” URI scheme. This works for documents which are shipped as XML. To cross reference another GNOME document, use:

<ulink type="help" url="ghelp:user-guide?gosbasic-2">text</ulink>
where “ghelp:” is the schema, “user-guide” is the appid of the User's Guide, “gosbasic-2” is the section id, and “text” is the text which becomes the link.

To link within the current document, you need only specify the section id you wish to link to, but the DocBook syntax is different. To create a link that displays the section number and name, use:

<xref linkend="intro" />
To create a link and specify the link text, use:
<link linkend="intro">text</link>

7.3. Man and Info Pages

Adding a link to a manpage in a GNOME document is done using the “man:” URI scheme. To cross reference a manpage, use:

<ulink type="help" url="man:foo">text</ulink>

Adding a link to an infopage in a GNOME document is done using the “info:” URI scheme. To cross reference a manpage, use:

<ulink type="help" url="info:foo">text</ulink>

7.4. Web Pages

To link to web pages, use:

<ulink type="http" url="http://www.gnome.org">GNOME Web Site</ulink>

8. Writing Context Sensitive Help (coming in GNOME-3.0)

Context sensitive help, also known as "pop-up" help, will allow a user to obtain help information about specific buttons or parts of an application.

Context sensitive help is still under development and not all the details are available at this time. However, the basics can be shown here so that you can understand how the system will work.

The Context Sensitive Help system is designed to allow the developer to give an id to a particular portion of the User Interface, for example, a button. Once the interface is complete a Perl script can then be run against the interface code to create a "map" file. This map file allows the developer or writer to associate particular paragraph sections from an XML document to the interface items.

The XML used for the document is a small XML DTD that is being developed to use the same tags (albeit, much fewer) as DocBook so that writers do not have to re-learn a new DTD.

Once the document is written and map file is complete, when the user launches context sensitive help on the interface (either by pressing a button and then clicking on the interface item they want information on, or by right mouse clicking on the interface item and selecting a pop-up menu item like "What's This") a small transient window will appear with brief but detailed information on the interface item.

9. Building Documentation within a Program

9.1. Documentation Files

Documentation in GNOME application repository and packages should be kept under help/locale/, where locale is typically replaced with “C” for the default (English) documents or the locale for other documents. In some cases, “doc” is used in place of “help” however it is preferrable to use “help” to remain consistent with the path under which these documents are installed.

Most applications will have screenshots, images, or other figures. To keep the directories reasonably clean and easy to navigate, screenshots, images, and other similar items should be placed in a directory called figures. While in some cases the directory is called images since most figures consist of images (well, screenshots really), it is preferable to use figures for consistency and to allow for figures which contain things other than images.

Most packages have a COPYING file in the tree which explains the rules or the license used to be able to copy any parts of the package. There should also be a COPYING-DOCS file which will contain the FDL or other licenses the documenter and maintainer agrees on. An example file is found in Subversion in the module gnome-docu/gdp/ COPYING-DOCS which contains the GNU Free Documentation License. The COPYING-DOCS file should be placed in the same place the COPYING file is located or in the top level of the package tree. If you wish to use the GFDL, you must have this file in the top level of the package.

9.2. Adding Documentation to the Build Setup

A new build system has been developed for GNOME 2.4. Each package will no longer be required to have its own copy of xmldocs.make and omf.make. Instead, the files are pulled from gnome-common whenever the package is built from Subversion.

To use the new system, in autogen.sh change the line that invokes gnome-autogen.sh from:

USE_GNOME2_MACROS=1 . gnome-autogen.sh
      
to
USE_GNOME2_MACROS=1 USE_COMMON_DOC_BUILD=yes . gnome-autogen.sh
      

In addition, xmldocs.make and omf.make need to be removed from packages that used previous versions of the build system.

For programs that do not use gnome-common, the files xmldocs.make and omf.make need to be manually installed. They can be found in gnome-common Subversion in doc-build. They should be installed in the package's root directory.

In the docs directory, a Makefile.am then is required that calls them:

figdir = figures
docname = gnome-calculator
lang = C
omffile = gnome-calculator-C.omf
entities = legal.xml
include $(top_srcdir)/xmldocs.make
dist-hook: app-dist-hook
	

9.3. Listing Documents in the Help Menu

Developer Information

This section is for developers. Documentation authors generally do not need to know this material.

Typically the application manual and possibly additional help documents will be made available to the user under the Help menu at the top right of the application.

A macro is used in your menu definition to specify inclusion of the help item on the menu, as follows:

static GnomeUIInfo help_menu[] = {
	GNOMEUIINFO_HELP("gnome-calculator"),
	GNOMEUIINFO_MENU_ABOUT_ITEM(about_cb,NULL),
	GNOMEUIINFO_END
};
the line specifying GNOMEUIINFO_HELP causes GNOME to create a menu entry which is tied to the documentation in the directory mentioned above. When the user selects Help from the menu, the default help browser, generally Yelp will display the documentation.

9.4. Adding Help Buttons

An example of adding a help button can be found in main.c of gfloppy in the gnome-utils package. It bascically requires connecting gnome_help_display to a button and testing for an error if the documentation is not found:

while ((button = gtk_dialog_run (GTK_DIALOG (toplevel))) >= 0) 
	GtkWidget *density_option;
	GtkWidget *dialog;

	if (button == GTK_RESPONSE_CLOSE) 
		break;

	if (button == GTK_RESPONSE_HELP) {
		GError *error;

		error = NULL;
		gnome_help_display ("gfloppy", NULL, &error);
		if (error) {
			GtkWidget *dialog;

			dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel),
							 0,
							 GTK_MESSAGE_ERROR,
							 GTK_BUTTONS_CLOSE,
							 _("Could not display help for the "
							   "floppy formatter.\n"
							   "%s"),
							 error->message);
				g_signal_connect_swapped (dialog, "response",
						  G_CALLBACK (gtk_widget_destroy),
						  dialog);
			gtk_widget_show (dialog);
				g_error_free (error);
			}

	

10. Teamwork

10.1. Working with the GDP Team

The GDP team is a valuable resource for any documentation author. GDP members can answer most questions documentation authors have during the course of their work. It is also important to make sure you are not duplicating work of other GDP members by sending an email to and verify no one is working on the documentation for the application you are working on. It is also a good idea to send an email to the application's maintainer so the maintainer knows you want to work on the documentation for their program. The best way to get in touch with GDP members is on the #docs IRC channel at irc.gnome.org or else by emailing the http://mail.gnome.org/mailman/listinfo/gnome-doc-list/.

After an author has finished a document (or even a draft version of the document), it is a good idea to ask a member of the GDP team to read the document, checking it for grammar, proper DocBook markup, and clarity. One may typically find another author to do this by either asking on the #docs IRC channel at irc.gnome.org or by emailing the http://mail.gnome.org/mailman/listinfo/gnome-doc-list/.

10.2. Working with Developers

Writing documentation typically involves a certain amount of interaction with the developers of GNOME or the application which is being documented. Often a document author will need to ask the developer technical questions during the course of writing a document. After the document is finished, it is a good idea to ask the developer to read the document to make sure it is technically correct. The documentation author should also make sure that the application author correctly binds and packages the documentation with the application.

11. Finishing a Document

11.1. Editing the Document

When the document is finished, the document should be edited by another member of the GDP for spelling, clarity, and DocBook markup. It should also be read by the application author to make sure the document is technically accurate.

11.2. Submitting the Document

After the document has been edited and checked for technical accuracy, it is ready to be combined with the application or documentation package. This is typically done by passing the document to the application or package developer. In some cases, the documents can be committed directly into SVN, however this should only be done after obtaining permission to make SVN commits from the developer. Note that in many cases, the application may need to be modified to correctly link to the documentation. The packaging system (tarballs and binary packages) may also need to be modified to include the documentation in the package. Generally, this should be done by the developers.

The final step is to email the GNOME Translation Team at to notify them that there is a new document for them to translate.

11.3. Maintaining the Document

Maintaining a document is the final step in a document's lifecycle. Periodically the documentation you write needs to be reviewed and changed. This usually during a major release of the application you are documenting. You should look at the UI of the application and assess any changes to the UI the current documentation does not address. An equally important change you need to look for is any additional functionality added to the applications. You should also determine if any of the functionality already in the documentation has changed. A good place to look for changes in the application is the ChangeLog of the application. Even if you do not understand all the technical parts the ChangeLog will give you a good idea of the changes and additions to the application. You should not rely on the ChangeLog fully. You should have the most recent copy of the application before it is released to determine any changes or additions. Some of the changes can be subtle. Don't worry if you do not catch them all in the first revision of the documentation.

Since maintainance of the documentation is an ongoing process the original author might not choose to maintain the document. If you have written documentation for a GNOME application and do not wish to maintain contact the maintainer of the application and send an email to the gnome doc list stating you are not able to maintain the document. Either the maintainer of the application or the GDP will find someone else who is willing to maintain the documentation.

A. Resources

A.1. Resources on the Web

The GNOME Documentation Project Web page lists current GDP projects and members.

The GNOME Documentation Style Guide is a guide to how a document should be structured, written, and proofread.

Norman Walsh's http://www.docbook.org in an excellent book on DocBook, available both online and in print.

Dave Pawson's DocBook Frequently Asked Questions is a good source for information about writing in DocBook, tools for DocBook, and stylesheet customizations.

A.2. Books

Docbook: The Definitive Guide is available in both printed form and on the web at: http://www.docbook.org/tdg/index.html

A.3. Mailing Lists

The gnome-docs-list mailing list is the main discussion area for all contributors to the GNOME Documentation Project. You can find out how to subscribe to this list on GNOME Mailing Lists. This is a rather low-volume list, so you will not be flooded with messages.

A.4. IRC

Internet Relay Chat (IRC) is a fast and easy way to get in touch with other GDP members. There are generally at least a few members here who can answer questions or discuss documentation issues. The IRC channel is #docs at irc.gnome.org.