« You Heard It Here First: Ticketmaster Sucks | Main | Tutorial Sneak Preview: Elements vs. Tags »
Because the public demanded it! This is really just an overview of the process, but it should give you a basic idea about what to watch out for.
Convert your AuthorIT book to DITA.
DITA (Darwin Information Typing Architecture) is one of AuthorIT's built-in publishing formats. Publishing to DITA results in a folder containing your book's image files, a collection of *.dita files, and a toc.ditamap file.
Sadly, you must take this opportunity to wave your index markers a fond farewell. They are apparently too old and frail to survive this stage of the journey.
Download the DITA Open Toolkit.
The DITA Open Toolkit (DITA-OT) is a collection of Apache Ant scripts, XSL stylesheets, and other goodies that enable you to transform DITA into other formats, including DocBook. For those of you who don't live in the Java world, Ant is basically make for Java. Newer versions of DITA-OT conveniently include a copy of Ant, so you don't need to install it separately.
To install DITA-OT, unzip the toolkit's files into any directory and run the startcmd.sh script (or startcmd.bat script on Windows) to configure your CLASSPATH and other environment variables. If you forget to set your CLASSPATH, the toolkit will helpfully indicate this to you by bailing out mid-transformation and complaining that the Ant script is broken.
Before you run any DocBook transformations, edit xsl/docbook/topic2db.xsl and comment out the template that contains "Related links". The only thing this template does is riddle your DocBook with invalid itemizedlist elements.
Do not waste time reading the toolkit's documentation. The manual that ships with DITA-OT 1.3 actually applies to DITA-OT 1.2, so most of the examples are broken. As for grammar and clarity, let's just say that the manual's translation from the original Old Frisian leaves much to be desired.
Transform the DITA document into DocBook.
All the toolkit's transformations involve running an Ant script:
ant options targets
To transform DITA to Docbook, run:
ant -Dargs.input=path/toc.ditamap dita2docbook
If the transform fails (and all your environment variables are set correctly), there might be errors lurking in your generated DITA source. This is AuthorIT's way of telling you, "Don't let the door hit you on the way out, jerk!"
toc.ditamap is referencing a topic that doesn't exist. Go back to the original AuthorIT doc and try to identify the missing topic. If all else fails, delete the reference from toc.ditamap and move on. Your readers already knew about the safety hazards of handling lithium deuteride, anyway.xref with a crazy relative path, this can really confuse DITA-OT. The good news is that the toolkit indicates the path that is causing the problem. The bad news is that AuthorIT dumps its DITA output in UTF-16, which is really annoying to grep through. Clean up the DocBook output with a script.
Congratulations, your document is now DocBook! Well, more accurately, it's "DocBook". Just be happy your tables made it through, sort of.
Fortunately, you can fix many issues pretty easily by running the document through a cleanup script. This script is particularly important if you're converting multiple documents. The canonical language for the script is XSLT, but if you'd rather stick it to the W3C Man, Python or Perl would work fine too. Here's what you'll want to fix:
id attributes. These generated IDs are duplicated throughout the doc, and nothing points to them. Throw them away and start over.remap attributes. In theory, these attributes contain useful information about the original DITA element, which in turn could help you design your post-processing script to provide better-quality DocBook markup. In practice... eh, not so much.sectioninfo elements. They're often invalid, and always contain nothing useful.type attributes. Not sure how those got there.para elements.sidebar elements to section elements. Like the empty type attributes, these are another mystery guest.programlisting elements. If you had any multi-line code samples, you might find that in the transformed DocBook, each line appears in its own programlisting. Join adjacent programlisting elements into a single programlisting (or screen, if appropriate).article to a book, if appropriate. Add chapter elements as necessary.emphasis role="bold" and literal elements to something more specific. For example, you define a list of commands that appear in your book and wrap each one in a command element. Creating explicit lists of commands, GUI buttons, and so on is tedious, but it's still better to do these substitutions in the script.Finally, there's the issue of broken IDs and links. Currently, every one of your AuthorIT hyperlinks is now a ulink that falls into one of these categories:
ulink's url starts with "mailto:". Convert these to email elements.ulink's url starts with "http://", or "ftp://", or "gopher://". Leave these alone.ulink's url points to something like "D1228.xml", a.k.a. nowhere. These are your former internal hyperlinks. They're all broken.But don't be discouraged, your script can actually "guess" at where many of these links should point. If a given internal ulink contains something like, "Configuring the MIRV Launch Sequence", there's an excellent chance that somewhere else in your document there's a section with a title, "Configuring the MIRV Launch Sequence"! So all you have to do is:
ulink to a nicely-formatted ID. Replace whitespace with underscores, remove extraneous punctuation, and lower-casing everything.ulink to an xref, setting the linkend to the new ID.section element, apply the same ID-conversion algorithm to the section's title. Set this value as the section's id.A healthy fraction of your ids and linkends should now match up, fixing those broken links.
Clean up the DocBook output manually.
Oh, you're not done yet! Here's a non-exhaustive list of what's left:
ids and broken links that your script didn't catch.programlisting and screen elements where appropriate. Remove excess carriage returns as necessary.commands (assuming your organization chooses to use that element). You can partly script this, but mostly this is a manual job.sections.898.png" to something more descriptive, such as "mirv_reentry_trajectory.png". Embed the images in a figure with a proper title and id.Now put your feet up on the desk and pour yourself a well-deserved gin-and-tonic. If anyone asks you why you look so frazzled, do not under any circumstances tell the truth. Otherwise they'll just respond with, "Well, why don't you just move it all to the corporate wiki?" And there's only one rational reaction to that. Don't get me wrong, it's not easy to inflict serious blunt force trauma using a 15" Powerbook, but somehow, you'll find a way.
Posted by Evan Goer on Nov. 21, 2006 at 11:18 PM | Comments (4)
The basics:
http://www.yahoo.com automatically become links.This entry was posted on November 21, 2006 by Evan Goer.
For more entries, you can visit the main journal page or browse through the complete archives, which date back to 2001.
Text released under Creative Commons.
To use this license, you must attribute this work properly. This license does not extend to comments unless the original poster of that comment states otherwise.
Powered by Movable Type 3.33.
Home | About | Journal | HTML Tutorial
© Copyright 2001-2007, Evan Goer. Some Rights Reserved. Last Updated July 2, 2008.
Posted by Auros on Nov. 22, 2006 at 11:03 AM
Posted by Evan on Nov. 22, 2006 at 4:28 PM
Posted by Auros on Nov. 27, 2006 at 3:38 PM
Posted by Evan on Nov. 27, 2006 at 9:00 PM