This past year I’ve really been getting into writing ebooks. I’ve written a large one (Refactoring Redmine), a shorter one (off the market), am writing another (Redmine Tips), and have another that I’ll be re-releasing very soon. The good (and bad) thing is that this has exposed me to several different tools that people are using to create ebooks.
Refactoring Redmine’s Tool Chain
I wanted to start with the I used for Refactoring Redmine. It has the most technical build chain for a book I’ve written, going through at least 3 different formats and requiring a few hundred lines of custom Ruby to create. Overall my tool chain is built around docbook, but getting the original content into docbook was the most complex part.
Since the majority of Refactoring Redmine’s content came from this blog and was already in Markdown, most of the tools were used as stepping stones to get the content into docbook.
- First I used a custom script to convert each markdown file into asciidoc. asciidoc is similar to markdown but I using a bunch of custom syntax from Jekyll that made the process more difficult.
- Once in asciidoc I converted the content into a single docbook file (a single large, 8200 line docbook file…). asciidoc comes with a docbook export so this was the easy part.
- Next I used Ruby to split the single docbook file into multiple files using nokogiri.
- Finally, once all of the content was in docbook I was able to do the final conversion using an existing docbook tool chain by Brian Hogan. Docbook itself has several steps involved before you get a PDF out of it but Brian’s project handled most of these for me.
While this might look complex, the process itself was pretty easy. Each step would just take an input, convert the text, and output it to the next step in the chain. The vast majority of the code was to handle the custom syntax I was using from Jekyll (step #1).
My latest book I’m working on, Redmine Tips, is being written directly in docbook so I’m able to skip directly to step 4. So far it has made the writing and editing process a lot quicker.
If anyone is interested, I can go deeper into each step and share the custom code I wrote to hook everything up. Leave a comment below.
Hi Eric, would you be able to share your script for converting Markdown to Asciidoc? Thanks!
Hi, I am wondering why don’t you use git-scribe ?
It does the same thing.
It was released after I finished Refactoring Redmine.