Open mbmoris opened 1 year ago
This is caused by the same issue I described on Slack for the Kotlin toolkit: https://readium.slack.com/archives/C703MSTQU/p1698229085820339?thread_ts=1698225175.649879&cid=C703MSTQU
The issue is that the book contains commented-out tags:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <!-- <!DOCTYPE html> --> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" > <!-- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" dir="ltr"> -->
But when we inject our own styles and scripts, we do it with regexes to locate the <html tags, so you get false positives in this case. Ideally we would use a proper HTML parser, but we decided to stay as close to the original source as possible when we modify it.
This is unlikely the core maintainers will tackle this fringe issue, but we would welcome a contribution to fix it. Maybe with a more complex regex you could handle that.
It's located here, if you want to give it a go: https://github.com/readium/kotlin-toolkit/blob/482ab0c2d759b4484762b0b823a953cc66661259/readium/navigator/src/main/java/org/readium/r2/navigator/epub/css/ReadiumCss.kt#L239
With the Swift toolkit, the regex is located here: https://github.com/readium/swift-toolkit/blob/7c04a9892b951bb13f7099b4ab74064b43557e00/Sources/Navigator/Toolkit/HTMLInjection.swift#L65
I'll keep the issue opened but like I said, it's unlikely I will tackle this anytime soon. So a contribution is most welcome!
Bug Report
The book is not browsable in any way
What happened?
The book is opened, the first page with the cover is displayed, but:
Expected behavior
Change page or jump to a specific chapter.
How to reproduce?
Open the attached sample book
Environment
Development environment
Testing device
iPhone13 iOS17
Additional context
bc40f3213719eae78585313877e66a9e4e3678.epub.zip
Are you willing to fix the problem and contribute a pull request? No