ofosos / ox-epub

Org mode epub export
GNU General Public License v3.0
92 stars 10 forks source link

Generated epubs fail epubcheck #35

Open stewart123579 opened 2 years ago

stewart123579 commented 2 years ago

Generated epubs fail epubcheck

Downloading the sample epub results in

Validating using EPUB version 2.0.1 rules.
ERROR(RSC-005): sample.epub/content.opf(46,10): Error while parsing file: element "guide" incomplete; missing required element "reference"

Check finished with errors
Messages: 0 fatals / 1 error / 0 warnings / 0 infos 

When I generate the sample epub from sample.org I get more errors:

Validating using EPUB version 2.0.1 rules.
ERROR(PKG-007): sample.epub/mimetype(-1,-1): Mimetype file should only contain the string "application/epub+zip" and should not be compressed.
ERROR(RSC-005): sample.epub/content.opf(46,10): Error while parsing file: element "guide" incomplete; missing required element "reference"
ERROR(RSC-005): sample.epub/body.html(15,44): Error while parsing file: attribute "role" not allowed here; expected attribute "class", "dir", "lang", "style", "title" or "xml:lang"
ERROR(RSC-005): sample.epub/body.html(17,49): Error while parsing file: attribute "role" not allowed here; expected attribute "class", "dir", "lang", "style", "title" or "xml:lang"

Check finished with errors
Messages: 0 fatals / 4 errors / 0 warnings / 0 infos

org version: 9.5.4 emacs version: GNU Emacs 28.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95)) of 2022-05-12 platform: Mac 12.4 installed via: MELPA ox-epub-20181101.1854

stewart123579 commented 2 years ago

PR https://github.com/ofosos/ox-epub/pull/36 addresses the mimetype error, however the role errors look to sit somewhere in either ox-html or in how epubcheck handles role attributes in <div> tags.

The problem is in the generated body.html at this point:

<div id="table-of-contents" role="doc-toc">
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">

I don't understand the HTML and EPUB specs well enough to judge where this issue falls.