With hindsight, perhaps I should have called this thread 'Tinkering with auto-shift EPUB2 to EPUB3 ...
I know calibre doesn't claim to fully support EPUB3 but I thought I'd see what I could achieve using the calibre EPUB3 functions which do exist. I'm nowhere near fully-conversant with the EPUB3 spec, but early tests have been quite encouraging insomuch as an EPUB2 with zero errors in Check Book usually results in an EPUB3 with zero errors in Check Book.
However, I did accidentally come across the following TOC anomaly when using one of my test EPUB2s so I thought I'd mention it. This particular epub has:
- zero errors in Check Book
- an NCX file with an empty <navmap> section
I auto-add the nav document using:
Code:
if not find_existing_nav_toc(container):
toc = get_toc(container)
commit_toc(container, toc)
and if I also want to auto-append the nav to the spine I can run
Code:
errors = run_checks(container)
if errors:
fix_errors(container, errors)
For the EPUB2 with empty <navmap> this converts to a nav doc with
Code:
<body>
<nav xmlns:ns0="http://www.idpf.org/2007/ops" ns0:type="toc"><ol></ol></nav>
</body>
which is 'correct'. However, If I now run Check Book it gives me a level 3 error 'Missing ToC in navigation document'.
For my purposes, I think I know how to auto-add a ToC item to avoid getting the error but, before I do, I thought I'd ask whether you'd consider the possibility of adding an extra auto-fix to the standard fix_errors() method?