GithubHelp home page GithubHelp logo

Comments (1)

mickael-menu avatar mickael-menu commented on August 15, 2024

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:

startRegex = NSRegularExpression("<\(tag)[^>]*>", options: [.caseInsensitive, .dotMatchesLineSeparators])

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!

from swift-toolkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.