Skip to content

Convert AsciiDoc to DocBook for use with Publican

mstanleyjones edited this page Feb 22, 2013 · 5 revisions

Publican expects certain structural rules to be followed in order to be able to build outputs with it. These expectations differ depending on whether you want to produce an article, book, or bookset. Booksets are pretty uncommon, so I won’t be testing them. This document will provide some notes about how to get from Asciidoc to Publican-built output for articles and books.

  1. Convert your Asciidoc to a Docbook article or book using one of the following commands.

    Article
     asciidoc -b docbook -a nolang myfile.asciidoc
    Book
    asciidoc -d book -b docbook -a nolang myfile.asciidoc

    This creates a file called myfile.xml.

    Note
    The -a nolang option prevents the lang attribute from being set on the root node. If you are not using Publican to process your XML, you can leave this off.
  2. Create a Publican article or book with the same name as your new Docbook file (minus the extension).

    Article
     publican create --type=article --name=myfile
    Book
    publican create --name=myfile
  3. Replace the article’s main file with your converted one.

     cp myfile.xml myfile/en-US/myfile.xml
    Note
    The Author_Group.xml and Revision_History.xml which Publican creates by default will be ignored completely.
  4. Change to the main directory of the article or book.

    cd myfile/
  5. Build the book.

     publican build --langs=en-US --formats=html,html-single,pdf
  6. View the output, which is located in the tmp/en-US/ directory.