Code Monkey home page Code Monkey logo

Comments (3)

met67 avatar met67 commented on May 25, 2024

In order to split only on ".", "!" and "?", and to avoid adding a span around single puctuation marks, i.e.

<span class="koboSpan" id="kobo.x.y">.</span>

you could chage the regex in line 468 to look like this:

groups = re.split(ur'(.*?[\.!?][\'"\u201d\u2019]?)', node, flags = re.UNICODE | re.MULTILINE)

I've tested it and it works, but then the conversion eats a space before other tags like <em> or <b>, i.e.

<p>Some text. <em>Italic text.</em></p>

i.e.
Some text. Italic text.

is changed to

<p><span class="koboSpan" id="kobo.1.1"><span class="koboSpan" id="kobo.1.2">Some text.</span></span><em><span class="koboSpan" id="kobo.1.3"><span class="koboSpan" id="kobo.1.4">Italic text.</span></span></em></p>

i.e.

Some text.Italic text.

with the space removed...

from calibre-kobo-driver.

jgoguen avatar jgoguen commented on May 25, 2024

Awesome, thanks! I'll play with this when I get some time.

from calibre-kobo-driver.

met67 avatar met67 commented on May 25, 2024

I have some good news and some bad news: the good news is that the new regex works fine, the bad news is that the space before the italics is probably lost by fix #47 ...
I had the same results (i.e. missing spaces between plain and italic texts) also with the vanilla driver as downloaded from github (version 1.3.3) :-(

from calibre-kobo-driver.

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.