lesjoursfr / html-to-epub

Generate EPUB books from HTML with simple API in Node.js.
MIT License
39 stars 16 forks source link

fix: add svg to cover properties, don't reference cover many times #143

Closed crutchcorn closed 3 months ago

crutchcorn commented 3 months ago

While investigating if we should add start to the list of default attributes, I noticed a few errors regarding the validity of covers:

https://github.com/lesjoursfr/html-to-epub/issues/140#issuecomment-2208258735

This PR fixes those issues.

Before

After

image

e-adrien commented 3 months ago

Thank you for this PR. I think we can apply the same fix to the EPUB v2 template templates/epub2/content.opf.ejs

Validating using EPUB version 2.0.1 rules.
ERROR(OPF-074): tests/book-v2.epub/OEBPS/content.opf(22,81): Package resource "OEBPS/cover.xhtml" is declared in several manifest item.
ERROR(RSC-005): tests/book-v2.epub/OEBPS/cover.xhtml(6,29): Error while parsing file: attribute "charset" not allowed here; expected attribute "content", "dir", "http-equiv", "lang", "name", "scheme" or "xml:lang"
ERROR(RSC-005): tests/book-v2.epub/OEBPS/cover.xhtml(11,42): Error while parsing file: attribute "epub:type" not allowed here; expected attribute "dir", "id", "lang", "style", "title" or "xml:lang"
ERROR(RSC-005): tests/book-v2.epub/OEBPS/cover.xhtml(6,29): Error while parsing file: attribute "charset" not allowed here; expected attribute "content", "dir", "http-equiv", "lang", "name", "scheme" or "xml:lang"
ERROR(RSC-005): tests/book-v2.epub/OEBPS/cover.xhtml(11,42): Error while parsing file: attribute "epub:type" not allowed here; expected attribute "dir", "id", "lang", "style", "title" or "xml:lang"

I'll take the time to look the other errors in the cover.xhtml when this PR will be merged.

crutchcorn commented 3 months ago

@e-adrien is it okay if we merge this PR prior to working on epub2? I'd love to have this fixed for our Epub3-only usage

e-adrien commented 3 months ago

Done. I'll do the change for EPUB 2 in the coming days. 🙂

e-adrien commented 3 months ago

@crutchcorn I just published a new version