Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Epub error: Attribute style redefined #7871

Closed
solarkraft opened this issue Jan 28, 2022 · 2 comments
Closed

Epub error: Attribute style redefined #7871

solarkraft opened this issue Jan 28, 2022 · 2 comments

Comments

@solarkraft
Copy link

solarkraft commented Jan 28, 2022

Explain the problem.

I am trying to convert a Hacker News comment page into epub. I use:
pandoc "https://news.ycombinator.com/item?id=30095521" -t epub3 -o hn.epub.

The conversion goes through just fine, but when opened in iBooks (macOS Books.app), it shows an error message:

This page contains the following errors:
error on line 32 at column 58: Attribute style redefined
Below is a rendering of the page up to the first error.

and stops rendering almost right at the beginning.

KOReader reads it just fine, presumably because it ignores the error. I don't have any other epub readers to test with, but attached the file for others to try: hn.epub.zip

The Epub validator (epubcheck) throws the same error as FATAL:

Validating using EPUB version 3.2 rules.
ERROR(RSC-005): hn.epub/EPUB/text/ch001.xhtml(21,113): Error while parsing file: attribute "width" not allowed here; expected attribute "about", "accesskey", "aria-activedescendant", "aria-atomic", "aria-autocomplete", "aria-busy", "aria-checked", "aria-colcount", "aria-colindex", "aria-colspan", "aria-controls", "aria-current", "aria-describedby", "aria-details", "aria-disabled", "aria-dropeffect", "aria-errormessage", "aria-expanded", "aria-flowto", "aria-grabbed", "aria-haspopup", "aria-hidden", "aria-invalid", "aria-keyshortcuts", "aria-label", "aria-labelledby", "aria-level", "aria-live", "aria-modal", "aria-multiline", "aria-multiselectable", "aria-orientation", "aria-owns", "aria-placeholder", "aria-posinset", "aria-pressed", "aria-readonly", "aria-relevant", "aria-required", "aria-roledescription", "aria-rowcount", "aria-rowindex", "aria-rowspan", "aria-selected", "aria-setsize", "aria-sort", "aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-valuetext", "autocapitalize", "autofocus", "border", "class", "content", "contenteditable", "datatype", "dir", "draggable", "epub:type", "hidden", "inlist", "inputmode", "is", "itemid", "itemprop", "itemref", "itemscope", "itemtype", "lang", "nonce", "ns:alphabet", "ns:ph", "onabort", "onauxclick", "onblur", "oncancel", "oncanplay", "oncanplaythrough", "onchange", "onclick", "onclose", "oncontextmenu", "oncopy", "oncuechange", "oncut", "ondblclick", "ondrag", "ondragend", "ondragenter", "ondragleave", "ondragover", "ondragstart", "ondrop", "ondurationchange", "onemptied", "onended", "onerror", "onfocus", "onfocusin", "onfocusout", "onformdata", "oninput", "oninvalid", "onkeydown", "onkeypress", "onkeyup", "onload", "onloadeddata", "onloadedmetadata", "onloadstart", "onmousedown", "onmouseenter", "onmouseleave", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onpaste", "onpause", "onplay", "onplaying", "onprogress", "onratechange", "onreset", "onresize", "onscroll", "onsecuritypolicyviolation", "onseeked", "onseeking", "onselect", "onslotchange", "onstalled", "onsubmit", "onsuspend", "ontimeupdate", "ontoggle", "ontransitioncancel", "ontransitionend", "ontransitionrun", "ontransitionstart", "onvolumechange", "onwaiting", "onwheel", "prefix", "property", "rel", "resource", "rev", "role", "slot", "spellcheck", "style", "tabindex", "title", "translate", "typeof", "vocab", "xml:base", "xml:lang" or "xml:space" (with xmlns:ns="http://www.w3.org/2001/10/synthesis")
ERROR(RSC-005): hn.epub/EPUB/text/ch001.xhtml(27,126): Error while parsing file: attribute "width" not allowed here; expected attribute "about", "accesskey", "aria-activedescendant", "aria-atomic", "aria-autocomplete", "aria-busy", "aria-checked", "aria-colcount", "aria-colindex", "aria-colspan", "aria-controls", "aria-current", "aria-describedby", "aria-details", "aria-disabled", "aria-dropeffect", "aria-errormessage", "aria-expanded", "aria-flowto", "aria-grabbed", "aria-haspopup", "aria-hidden", "aria-invalid", "aria-keyshortcuts", "aria-label", "aria-labelledby", "aria-level", "aria-live", "aria-modal", "aria-multiline", "aria-multiselectable", "aria-orientation", "aria-owns", "aria-placeholder", "aria-posinset", "aria-pressed", "aria-readonly", "aria-relevant", "aria-required", "aria-roledescription", "aria-rowcount", "aria-rowindex", "aria-rowspan", "aria-selected", "aria-setsize", "aria-sort", "aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-valuetext", "autocapitalize", "autofocus", "border", "class", "content", "contenteditable", "datatype", "dir", "draggable", "epub:type", "hidden", "id", "inlist", "inputmode", "is", "itemid", "itemprop", "itemref", "itemscope", "itemtype", "lang", "nonce", "ns:alphabet", "ns:ph", "onabort", "onauxclick", "onblur", "oncancel", "oncanplay", "oncanplaythrough", "onchange", "onclick", "onclose", "oncontextmenu", "oncopy", "oncuechange", "oncut", "ondblclick", "ondrag", "ondragend", "ondragenter", "ondragleave", "ondragover", "ondragstart", "ondrop", "ondurationchange", "onemptied", "onended", "onerror", "onfocus", "onfocusin", "onfocusout", "onformdata", "oninput", "oninvalid", "onkeydown", "onkeypress", "onkeyup", "onload", "onloadeddata", "onloadedmetadata", "onloadstart", "onmousedown", "onmouseenter", "onmouseleave", "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onpaste", "onpause", "onplay", "onplaying", "onprogress", "onratechange", "onreset", "onresize", "onscroll", "onsecuritypolicyviolation", "onseeked", "onseeking", "onselect", "onslotchange", "onstalled", "onsubmit", "onsuspend", "ontimeupdate", "ontoggle", "ontransitioncancel", "ontransitionend", "ontransitionrun", "ontransitionstart", "onvolumechange", "onwaiting", "onwheel", "prefix", "property", "rel", "resource", "rev", "role", "slot", "spellcheck", "style", "tabindex", "title", "translate", "typeof", "vocab", "xml:base", "xml:lang" or "xml:space" (with xmlns:ns="http://www.w3.org/2001/10/synthesis")
FATAL(RSC-016): hn.epub/EPUB/text/ch001.xhtml(32,38): Fatal Error while parsing file: Attribute "style" was already specified for element "td".
ERROR(RSC-005): hn.epub/EPUB/text/ch001.xhtml(-1,-1): Error while parsing file: Attribute "style" was already specified for element "td".
ERROR(RSC-007): hn.epub/EPUB/text/ch001.xhtml(31,90): Referenced resource "EPUB/text/news" could not be found in the EPUB.
ERROR(RSC-007): hn.epub/EPUB/text/ch001.xhtml(31,132): Referenced resource "EPUB/text/newest" could not be found in the EPUB.
ERROR(RSC-007): hn.epub/EPUB/text/ch001.xhtml(31,158): Referenced resource "EPUB/text/front" could not be found in the EPUB.
ERROR(RSC-007): hn.epub/EPUB/text/ch001.xhtml(31,191): Referenced resource "EPUB/text/newcomments" could not be found in the EPUB.
ERROR(RSC-007): hn.epub/EPUB/text/ch001.xhtml(31,220): Referenced resource "EPUB/text/ask" could not be found in the EPUB.
ERROR(RSC-007): hn.epub/EPUB/text/ch001.xhtml(31,245): Referenced resource "EPUB/text/show" could not be found in the EPUB.
ERROR(RSC-007): hn.epub/EPUB/text/ch001.xhtml(31,271): Referenced resource "EPUB/text/jobs" could not be found in the EPUB.
ERROR(RSC-007): hn.epub/EPUB/text/ch001.xhtml(31,299): Referenced resource "EPUB/text/submit" could not be found in the EPUB.

Check finished with errors
Messages: 1 fatal / 11 errors / 0 warnings / 0 infos

May be related to #3716.
Applies to Epub and Epub3.

Pandoc version?
2.17.0.1 on macOS 12.2

@tarleb
Copy link
Collaborator

tarleb commented Jan 28, 2022

The respective line is

<td style="text-align: right;" style="padding-right: 4px"><span class="pagetop"> <a href="login?goto=item%3Fid%3D30095521">login</a> </span></td>

One of these styles is added by pandoc (for table cell alignment handling), the other comes from the website. Both style definitions must be combined into one to produce valid EPUB.

@mb21
Copy link
Collaborator

mb21 commented Jan 28, 2022

I can reproduce this, the reason is this snippet in the output:

<td style="text-align: right;" style="padding-right: 4px">

Interestingly the input HTML is valid. Minimal repro:

https://pandoc.org/try/?text=%3Ctable%3E%0A++%3Ctr%3E%0A++++%3Ctd+style%3D%22text-align%3Aright%3B+padding-right%3A4px%3B%22%3Etest%3C%2Ftd%3E%0A++%3C%2Ftr%3E%0A%3C%2Ftable%3E%0A&from=html&to=&standalone=0

@tarleb tarleb self-assigned this Jan 28, 2022
@tarleb tarleb closed this as completed in a6fa3df Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants