• Skip to content
  • Skip to link menu
KDE Documentation Team
  • KDE Documentation Team Homepage / Tools
 
 

The KDE DocBook XML toolchain

Editing Tools

Many writers already have a favourite editor, and many of you will find it faster to get work done in a less xml-friendly editor, than to learn a new application. However, the following tools can ease your work, and are worth a look.

  • Kate
  • The XML plugin for Kate
  • (X)Emacs + psgml
  • Vi(m) and friends
  • Other editors
Processing Tools
  • checkXML
  • meinproc
  • Alternate stylesheets
  • xsltproc
  • KHelpCenter
Sanity-checking Measures
  • Checking for empty elements
  • Checking for multiple root elements
  • Checking for proper translator markers
  • Checking for preferred forms of words
  • Checking for applicable entities

Editors

Kate

Kate is a very powerful editor that is installed as part of the kdebase package. Kate is highly customizable, and has many features that make it ideal for XML editing. Kate can syntax highlight DocBook files automatically. Syntax highlighting is a very useful tool to help you navigate a document, and makes small syntax errors, for example, forgetting a closing > sign, very obvious. This is an ideal editor for you use to work with KDE Documentation.

The XML Plugin for Kate

Kate on its own is a very capable editor, but the xml-plugin that is in the kdeaddons package takes it to another level entirely.

With this plugin, Kate can:

  • Understand the DocBook DTD
  • Show you which elements (tags) are valid at the current location
  • Close (recursively) currently open elements.
  • List and insert entities, which are very widely used within KDE documentation.

It should be noted that although the XML plugin already understands several variants of common XML dtd's, and although we use it mostly for DocBook within KDE, it's also easy to add your own, using a standardised compiled dtd format.

(X)Emacs + psgml

Emacs and Xemacs both can syntax highlight DocBook out of the box with the sgml-mode. The addition of psgml turns these editors into powerful DocBook aware editors, but the learning curve is steep, and recommended for people who are already comfortable with Emacsen.

With psgml you can:

  • List valid elements in the current location.
  • List and insert entities.
  • Complete recursively all open elements
  • Auto insert elements for complex markup (such as tables, or variable lists)
  • Validate, and even compile, documents from within the editor
  • Normalize broken documents, and find syntax errors.
  • "Fold up" parts of the document you are not currently working on
  • Hide markup to see only the content, giving you an uncluttered view of the text.
  • And much more

Emacs with psgml is the most functional open source and free (as in beer) software available on UNIX platforms, but the learning curve should not be underestimated. If you intend delving deeply into XML, SGML, and/or KDE Documentation, and you are already familiar with operating emacs, it's highly recommended you give it a try, and there are several people very familiar with these tools on the kde-doc-english mailing list. If you are not familiar with emacs, and/or are just maintaining simple documentation, the benefits may not outweigh the learning curve, and Kate + it's XML plugin is a much better choice.

Vi(m) and friends

Vi, vim, and others are powerful editors, but don't have any built-in XML or DocBook friendly tools other than syntax highlighting. You can use :set syntax=docbk to turn on DocBook specific syntax highlighting, and this works in KVim also.

There is a script available at www.vim.org that adds some further capabilities to vim, including the ability to insert tags automatically.

If you are already familiar with vi, then you should feel right at home using it for editing DocBook, but it's not the recommended editor for those of you who are new to UNIX.

Other editors

The above editors are by no means all that are available. If you have a favourite editor, then by all means use it. Note that KDE Documentation must be committed to CVS in UTF-8 encoding, and an editor that can save directly to this format is advisable. If not, ask on the mailing list, and someone will help you with conversions.

Editors that other writers have had success with include:

  • Nedit
  • The built in editor from mc (Midnight Commander)
  • gedit
  • yudit

If you are a user of one of these (or indeed, any other) applications, and have any tips to make them more XML or DocBook friendly, please let us know.

Processing Tools

The following tools are provided as part of a normal KDE installation:

checkXML

checkXML index.docbook

checkXML will check your document against the DTD, and tell you if there are any syntax errors, and the line numbers they occur on. If there are no errors, it will return you to the prompt with no output.

meinproc

meinproc index.docbook

meinproc is the main tool used by KDE to transform DocBook XML into HTML for viewing in KHelpCenter. It's a very flexible tool, but in most cases you just want to look at the generated output to proofread, or spot any glaring errors. The above command will create HTML files in your current directory, along with informing you of any syntax errors that prevent processing of the file.

Many people use meinproc to check for validity, and it is the most thorough way to do so, as it also catches some problems where your document is perfectly valid XML but is wrong in some other way, for example, characters that aren't in UTF-8. For most purposes however, checkXML is a much quicker way to check a file, especially when you're working on it. It's worth getting in the habit of running it on a regular basis.

Alternate stylesheets

There are several alternate stylesheets available for use in kdelibs/kdoctools/customization. Use them in this manner:

meinproc --stylesheet $KDEDIR/share/apps/ksgmltools2/customization/.xsl

All these stylesheets create html pages in the current directory. The stylesheets available are:

kde-chunk-online.xsl

Similar to the standard KDE stylesheet, this is used to create the pages on http://docs.kde.org.

kde-nochunk.xsl

Creates a simplified layout, without banner graphics, and all in one page. This is suitable for processing further with html2pdf for printable output, as an interim solution until we have a reliable print output mechanism. It should also print fairly nicely directly from a web browser.

kde-web.xsl

Creates a static web friendly page, suitable for using in a website that uses frames, or where you want to constrain the content to a particular width.

The styles targetted for websites expect a common/ directory in the same level as that containing the HTML pages, which should hold the contents of $KDEDIR/share/doc/HTML/en/common

xsltproc

Ask Daniel to write about xsltproc here

KHelpCenter

The primary use of KDE Documentation is to produce manuals that will be viewed in KHelpCenter.

Sanity-checking

A number of programs are available which will help you producing a clean handbook. They are meant to catch common errors, and should usually be run when you're about to submit any manual to make sure that everything's tidy.

Checking for empty elements

This script helps you to detect empty elements in your markup. Elements are considered to be 'empty' when they contain nothing, whitespace or just commentary (or a mixture of that). Those elements need to be removed from the markup so that the manual can be translated into other languages.

Checking for multiple root elements

The check-multiple-root-elements.py checks each file given on the commandline for whether it has more than one root element. Multiple root elements will break the translation process, just like empty elements.

Checking for proper translator markers

People who spent time on translating your document should be given credit appropriately. To do this, you need to specify two special comments in your markup:

<!-- TRANS:ROLES_OF_TRANSLATORS -->
This special comment must appear exactly once in your markup; you should put it at the end of your <authorgroup> element.
<!-- TRANS:CREDITS_OF_TRANSLATORS -->
There must only be one DocBook file in the directory which has this marker. It needs to be placed at the end of your document, right before the &underFDL; entity.

You can use the check-translator-markers.sh script to check for whether these requirements are met for your manual.

Checking for preferred forms of words

For the sake of consistency (and proper spelling), there is a centralized list of common phrases and how they should be spelt in KDE manuals. This covers cases such as "file system" vs. "filesystem" or "Spell-check" vs. "Spellcheck". You don't have to worry about all these things, just use this script (and the accompanying wordlist) on your document to make sure that your spelling complies to that of the other KDE documents.

Checking for applicable entities

There are a lot of entities available to authors of KDE manuals which make it easy to keep the spelling of applications and abbreviations consistent. The insert_entities program can be used to detect situations in which you could have used an entity. The accompanying manpage tells more about how insert_entities works and what it does.

[ Edit ]

Author Information

Skip menu "Author Information"
  • Getting Started
  • Tools
  • Writers Questionnaire
  • Current Jobs

Reference Guides

Skip menu "Reference Guides"
  • The KDE Markup Guide
  • The KDE Style Guide
  • Visual Dictionary
  • Taking Screenshots

Other Ressources

Skip menu "Other Ressources"
  • Mailing List
  • Using SVN
  • Release Schedules

Global navigation links

  • KDE Home
  • KDE Accessibility Home
  • Description of Access Keys
  • Back to content
  • Back to menu

Search:


Maintained by the KDE Documentation team
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal