nlbdev / nordic-epub3-dtbook-migrator

Tools for converting between a strict subset of DTBook and EPUB3.
http://nlbdev.github.io/nordic-epub3-dtbook-migrator/
GNU Lesser General Public License v2.1
8 stars 7 forks source link

Migrating between the 2020-1 guidelines and the 2015-1 guidelines #404

Open josteinaj opened 3 years ago

josteinaj commented 3 years ago

Most organizations still use DTBook for certain parts of their systems. And organizations that are using the 2015-1 version of the EPUBs might need some time to adjust to the 2020-1 guidelines.

So, while not part of the guidelines revision project, these migration paths would still be interesting to have:

If we do nothing, then the downgrade to DTBook can be covered by:

  1. DP2 script: EPUB 3 to DTBook (generic script)
  2. XSLT: generic-to-nordic-dtbook.xsl (from nordic migrator project)

If we do something, then conversion to and from DTBook can be covered by the 2015-1 scripts, as long as we have a conversion path back and forth between Nordic EPUB 2015-1 and Nordic EPUB 2020-1.

Conversion between Nordic EPUB 2015-1 and 2020-1 could be implemented with at set of XSLTs. These could be incorporated into the migrator scripts if we want to:

martinpub commented 3 years ago

Setting priority to low for the time being. Currently I think only MTM and SPSM are starting to use the 2020-1 guidelines in production, and none of us prioritise this atm.

martinpub commented 2 years ago

@josteinaj We might be interested in this. How much work would this entail, in very rough terms? Big job, small, medium?

josteinaj commented 2 years ago

Maybe… medium?

If it's possible to run an XSLT on each HTML file (and the OPF) separately, then we could write some XSLTs and package them as an upgrader and a downgrader script. Do you think we need to do something other than transforming the file contents? We might need to generate an NCX when downgrading, and deleting it when upgrading etc.

martinpub commented 2 years ago

So complexity increases considerably if there are actions that need to do checks/fixes across files, right? Not sure if that's the case actually. @AndersEkl, any thoughts?

josteinaj commented 2 years ago

Another path could be to go through a single-HTML representation of the book. Merge all HTML files into a single one, then run an XSLT on it, then use the 2015 script to convert from HTML to EPUB 3. I don't know if this is more work or less work than having a straight EPUB-to-EPUB conversion.

All the HTML files have a wrapping <section> element, so maybe we can attach some data-attributes or similar there to preserve metadata about the content (spine linear=yes/no, spine/manifest properties). Maybe this is not relevant when converting to the 2015-1 guidelines, I'm not sure.

Most of the package document metadata can be converted to HTML metadata. HTML has no mechanism for the refines attribute in OPF, so that metadata must be discarded. I don't think that's going to be a problem in practice.

As for the navigation document, I don't think there's any information there that we need to preserve.

The Nordic HTML 5 to EPUB 3 (2015-1) script will create a new OPF and navigation document based on the HTML file.

Here's a suggestion for a single HTML representation of a 2020-1 EPUB:

This can be added to the EPUB 3 to HTML 5 script, when passing in an EPUB declaring that it follows the 2020-1 guidelines.

Then we create a new script called for instance "HTML 5 Downgrade".