I devoted the entirety of my work time yesterday to trying to solve my workflow problems. I failed.
I want a completely reproducible process to go from edits to my Markdown formatted manuscript to eBook formats for Kindle, Google, iBook, Nook, Smashwords, and possibly others. I had been using pandoc to transform the Markdown into the various forms, using a bizarre sequence of complicated command lines in a Makefile. I still want to do this, but each of the processing steps seemed to me to be full of fatal flaws, fatal limitations, or fatal pain-in-the-ass. The key word here is of course “fatal.”
As wonderful as Kovid’s product is, and usable for many things, I found bugs in the latest (2.3) release of Calibre to be too much for me. Then I tried using Calibre’s command line stuff, which worked best with my Makefile scheme anyway. I failed — mostly because the processing steps in Calibre’s tools take any HTML class I specify and replace it either with Calibre’s own class name (e.g., “calibre42”) which is useless for me to build CSS rules for, or it would replace the class name with the class I specified in the first HTML
div I put in my document — like I wanted all of my
divs to be of that class. Even if I specified a class on the div it was overridden by this bug. Of course I could go debug Calibre (I have spent many weeks lately debugging Python code at work trying to get OpenStack to work for me, for example).
Instead, I decided to try something else. I tried using Python Markdown directly, instead of using Calibre to call it. This produces HTML as its output, which has nearly all of what I need. Putting the resulting HTML through Calibre’s converter to get EPUB or AZW3 suffered from the same bugs. But I need a way to take the correctly translated HTML from Python Markdown and split it into separate documents at chapter boundaries, to write the TOC and
contents.opf files, etc.
So I downloaded and built Sigil, which I gather is the spiritual predecessor of Calibre in some way? It is written in C++ and is, therefore, a very long and painful build process. But Sigil works — for the things it does — very well. It just doesn’t do all of the things I need, and it’s not a command line thing, so I can’t use Makefiles to automate the process like I wanted.
But first, I need to manually build my eBook and get this fucking book published. Then I can build tools to replicate that process for revisions and future books. I think I’ll open source the result.