Conversation
Real world EPUBs (especially calibre output) often contain content that
is not well formed XML, which made bk panic while parsing a chapter:
called Result::unwrap() on an Err value:
MalformedEntityReference(TextPos { row: 95, col: 43 })
Two cases are handled now:
- bare/unescaped & such as "Graham&James", plus HTML named entities
like that XML does not define. Known entities are converted to
numeric character references and stray & are escaped.
- unbalanced HTML style tags, e.g. a missing </p>, are repaired by an
HTML-style tidier that closes open tags and drops stray closing tags.
repair_xml() tries the raw document first, then entity fixes, then tag
fixes, so well formed EPUBs and entities declared in a DOCTYPE keep
working exactly as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Real world EPUBs (especially calibre output) often contain content that is not well formed XML, which made bk panic while parsing a chapter:
called Result::unwrap() on an Err value:
MalformedEntityReference(TextPos { row: 95, col: 43 })
Two cases are handled now:
repair_xml() tries the raw document first, then entity fixes, then tag fixes, so well formed EPUBs and entities declared in a DOCTYPE keep working exactly as before.