Originally Posted by exaltedwombat
I'm sure many of us would be interested in details of your strategy for this?
The overall strategy is to be able to maintain one master file (in most cases the InDesign file, unless there is to be no print version) with all corrections, etc. All published forms: print, pdf, epub, mobi (and rarely others) are produced directly or indirectly from this file.
The conversion process goes roughly like this:
1) The ID file gets a few modifications before exporting to epub. For example, the first paragraph style contains nested styles (dropcap and smallcaps for the first line). These must be un-nested (as described in Elizabeth Castro's epub book). Scene breaks are usually modified to avoid having to embed a wingdings font just for them. Any internal images must be placed in-line in the story flow. Any local formatting (there should be none left) is replaced with defined paragraph or character styles. Then the book is exported to epub. This being ID4, all the text of the book ends up in a single xhtml file within the epub.
2) I expand the epub and edit the story file with Bluefish html editor. (NB nowadays, this could be just as well done within Sigil, but my practice is a holdover from the days when it was very slow to work with a single huge file in Sigil.) During this edit, chapter headers are changed from <p> tags to <h2> tags, sigil chapter break markers are inserted, a few comments are inserted just in case of later editing, and appropriate changes are made to the stylesheet.css file to match. When done, the epub is re-zipped.
3) In sigil, the cover page is added, the file is split into chapters, and the chapter files are renamed to something meaningful (kind of OCD on my part, but it helps to navigate sometimes). Semantics for cover, cover image, title page, etc. etc. are applied. The toc.ncx is regenerated and checked. Usually tweaks to the stylesheet are applied in an attempt to make the file more e-reader friendly given that I don't know what e-reader may be used. (an example is the use of "up-caps" rather than drop-caps, and fake small-caps in the first paragraph of each chapter. Also, cleanup of any stray tabs, spaces, blank lines, etc. that shouldn't be there. A full set of metadata is added to content.opf (by directly editing it). FlightCrew check, CSS validation, and (externally) epubcheck.
4) for the Mobi version, I still have not graduated to the use of conditional stylesheets for kf8 vs mobi, so I try to make the css kindlegen-friendly. Fortunately, we don't use elaborate formatting, so this is usually not difficult.
Also, the cover page is removed, metadata in content.opf is adjusted (especially the <guide> section). An in-line TOC is created and moved to just after the copyright page (per house specifications). Actually, going forward we will probably add the inline TOC to the epub version as well, per the recent directives from Cupertino.
5) The "mobi" epub is fed to kindlegen (currently v.2.7) and both epub and mobi are checked against ADE and Kindle Previewer respectively, and whatever actual hardware I can lay my hands on.
Also, in the event that we are not publishing a print version, there is no ID file so I work from a master rtf or word file within Libre Office. The manuscript is cleaned up, house styles are applied, and it is exported using "writer2epub" (from the "writer2LaTex" people), with a custom CSS file matching the house styles from LibreOffice. This epub goes directly into the above workflow at step 3 (Sigil cleanup).
Start to finish, it takes less than two hours, usually more like 30 minutes if the files are clean.