Answers.Body: <p>I have done projects like this. I am assuming that you know how to select the data you need from your database. I would suggest you develop a template based on pandoc's extended markdown (to get the cross-referencing), merge the data with the template and then script pandoc to convert that to EPUB2 and PDF. If you want to offer a Kindle-compatible ebook (and you are giving it away), you could then script Kindlegen (available from Amazon) to turn the EPUB2 into a MOBI file.</p>
  
  <p>This isn't a trivial undertaking, but it should be doable.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-01-20T23:10:05.307Z
Answers.LastActivityDate: 2014-01-20T23:10:05.307Z
Answers.UserDisplayName: user2149757
Answers.Body: <p>I recommend you generate some mark up format supported as input for <a href="http://johnmacfarlane.net/pandoc/" rel="nofollow">pandoc</a> (i.e. markdown, reST, HTML) and generate the EPUB from that. </p>
  
  <p>You should have no trouble scripting <code>pandoc</code>, but you would need some work automating the generation of the markup from your database (but not more than you would have generating XML).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-01-26T01:40:06.827Z
Answers.Text: If post-processing is needed, I can recommend the free software [Sigil](http://code.google.com/p/sigil/).
Answers.UserDisplayName: Raphael
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-01-18T19:23:13.800Z
Answers.LastActivityDate: 2014-01-18T19:23:13.800Z
Answers.UserDisplayName: Anthon
Body: <p>I have a large amount of highly structured data (Bible verse translations and commentary) in an SQL database that I would like to make available in as widely usable an ebook format (or formats) as possible. The formatting is going to require a little bit more that a flat text rendering to include section headings, verse numbering, clear delineation between types of content (translated text of Scripture formatted differently than commentary), linked cross references, and a Table of Contents.</p>
  
  <p>I presume that I should be generating an in-between format of some sort such as an XML file based on my data set that can then be transformed using XSLT or a similar system to a finished ebook format, but I don't know what this should be. I don't want to re-invent the wheel any more than necessary.</p>
  
  <ul>
  <li>Is this generally the right workflow or am I missing the boat somewhere?</li>
  <li>What should the in-between format be? Are there standards for this that will make the secondary transformation easier than others?</li>
  </ul>
  
  <p>I suppose I should note that this is not a one time project that I can hack together using some GUI tools or web services — <em>the whole process must be scriptable from start to finish</em>. I intend to make the ebook generation an option from an extant site as an export option with customizable data ranges, translations, etc.</p>
  
Tags: <epub><creation><conversion>
Title: What is the easiest workflow to publish ePub files from highly structured database content?
UserDisplayName: Caleb
ThreadText: # What is the easiest workflow to publish ePub files from highly structured database content?
  
  (Asked by: username_0 on 2014-01-18)
  
  I have a large amount of highly structured data (Bible verse translations and commentary) in an SQL database that I would like to make available in as widely usable an ebook format (or formats) as possible. The formatting is going to require a little bit more that a flat text rendering to include section headings, verse numbering, clear delineation between types of content (translated text of Scripture formatted differently than commentary), linked cross references, and a Table of Contents.
  
  I presume that I should be generating an in-between format of some sort such as an XML file based on my data set that can then be transformed using XSLT or a similar system to a finished ebook format, but I don't know what this should be. I don't want to re-invent the wheel any more than necessary.
  
  * Is this generally the right workflow or am I missing the boat somewhere?
  * What should the in-between format be? Are there standards for this that will make the secondary transformation easier than others?
  
  I suppose I should note that this is not a one time project that I can hack together using some GUI tools or web services — *the whole process must be scriptable from start to finish*. I intend to make the ebook generation an option from an extant site as an export option with customizable data ranges, translations, etc.
  
  **Tags:** epub, creation, conversion
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2014-01-20. Score: 2 | Accepted answer
  
  I have done projects like this. I am assuming that you know how to select the data you need from your database. I would suggest you develop a template based on pandoc's extended markdown (to get the cross-referencing), merge the data with the template and then script pandoc to convert that to EPUB2 and PDF. If you want to offer a Kindle-compatible ebook (and you are giving it away), you could then script Kindlegen (available from Amazon) to turn the EPUB2 into a MOBI file.
  
  This isn't a trivial undertaking, but it should be doable.
  
  
  ---
  
  ### Answer by username_2 on 2014-01-18. Score: 4
  
  I recommend you generate some mark up format supported as input for [pandoc](http://johnmacfarlane.net/pandoc/) (i.e. markdown, reST, HTML) and generate the EPUB from that.
  
  You should have no trouble scripting `pandoc`, but you would need some work automating the generation of the markup from your database (but not more than you would have generating XML).
  
  > **Comments:**
  > **username_3**: If post-processing is needed, I can recommend the free software [Sigil](http://code.google.com/p/sigil/).  
  
  ---
  
  