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

Error checking diagram-containing epub file #257

Closed
piccolbo opened this issue Dec 6, 2022 · 3 comments
Closed

Error checking diagram-containing epub file #257

piccolbo opened this issue Dec 6, 2022 · 3 comments

Comments

@piccolbo
Copy link

piccolbo commented Dec 6, 2022

Hi,
I am using diagram-generator to create diagrams like this

{.graphviz #fig:cyclomatic caption="Graphs corresponding to `if` and `while` statements resp."}
graph {
  if -- then; if--else; then -- "end if" ; else -- "end if" ;
  while -- body; body-- while; while -- "end while";
  }

They look just fine, but the epub containing them doesn't pass epubcheck 4.2.6 with a raft of errors like ERROR(HTM-003): <some svg file name here> External entities are not allowed in EPUB v3 documents. External entity declaration found

As you may know, passing a clean epubcheck, an official w3c tool, is a pre-condition to accepting a submission for some publishers. I was wondering if anyone has seen this and knows the solutions.

As a workaround, can I force png output?

I know reporting this here may be useless, since these files are generated by graphviz. On the other hand, the graphviz team may have no clue about epub and its requirements. I am kind of caught in between. It seems this is an additional restriction on svg specified by the epub committee. It isn't enough for an svg tool to generate legal svg to guarantee that the inclusion into an epub will be standard compliant. It seems like a bad design to me. Thanks!

@piccolbo
Copy link
Author

piccolbo commented Dec 7, 2022

I am not sure this is related, but if it is these errors may disappear in future versions of epubcheck.

w3c/epubcheck#1114

@tarleb
Copy link
Member

tarleb commented Dec 7, 2022

Thanks, that's all interesting information. You can force PNG output by changing lines 66, 67 to

local filetype = "png"
local mimetype = "image/png"

@piccolbo
Copy link
Author

piccolbo commented Dec 7, 2022

I can confirm the workaround works. Of course, there are side effects like losing the scalability of svg and increasing the file size. But it beats not being able to submit your book to a publisher. It will also increase compatibility with older readers, I understand early kindles don't support svg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants