kartonrad/calibreBionicReading

Jumbled text, incorrect size/formatting

Closed this issue · 8 comments

The extension works very well for the most part, but the tags included in the 'if (parentTag ==[...]' section of main.py need fine tuning. I ran it as-is on a few books and a few sections of text consistently came back jumbled - words would show up out of order, sometimes in small text and sometimes with no spacing, for a few sentences.

It seems to be worst for text surrounding a link, particularly bibliography links. Some text continued in superscript position and size, other text showed in the correct size but with words out of order and sometimes without spacing. I think the issue involves the span tag but it's possible there are others as well. I added 'or parentTag == "span"' which fixed the jumbled text; now it's just the occasional paragraph not getting bolded.

Not sure if you've already found this but I thought I'd comment in case it's useful for you.

Hey thank you for commenting!
I will look into it, maybe make a demo book myself to reproduce the issue n everything

You mean it comes up when formatting is nested?
(And it boldens text in span tags)

In theory i think it should work even in those context, so i might have to look over it again

Do you have some example html passages where the text gets especially garbled?

(Can you copy it out of the edit window and put it here?)

I dunno i if i have the time to look into it today, but i def will fit it into the next couple of days

Here's an example from just now. In this case it looks like it didn't add the non-bold parts of words.

Example broken text:

INBeaPrFamConfeconserChrisleadgathagathtiiDalathnatimeetothReligRoundWiAmerflawavanshooHalleringspeawarothnatsmordeclandiminimilimigMasterbtelevanJamRobithevebroutogeFalwSchlanthLaHaalowiPaRoberDJamKennanpromiconservincluRepubsenaJesHelAmwcofouRichDeVanDalCowbcoaToLan AUGUST 1980, ONLY A MONTH AFTER THE LONG 1

Original:

IN AUGUST 1980, ONLY A MONTH AFTER THE LONG Beach Pro-Family Conference, conservative Christian leaders gathered again, this time in Dallas at the national meeting of the Religious Roundtable. With American flags waving and shouts of “Hallelujah!” ringing, speakers warned of the nation’s moral decline and diminishing military might. Masterminded by televangelist James Robison, the event brought together Falwell, Schlafly, and the LaHayes, along with Pat Robertson, D. James Kennedy, and prominent conservatives including Republican senator Jesse Helms, Amway cofounder Richard DeVos, and Dallas Cowboys coach Tom Landry.1

Do you have the html sourcecode for before it gets garbled?
Like from the window on the left
c7d0184140bc609d.png

Otherwise i could probably also find/make an example

this issue is very profound... behaviour seems almost arbritrary

looking into it, it seems that the text AFTER an inline stlye, has it's word order messed up and it is shifted around randomly

idk how i managed to mess that up, maybe the insertion order of created elements is what's causing the trouble
if the opacity thing is set to 1, at least no information is lost, words remain whole, but are in the wrong place

i'm going to go through my code line by line

identified an issue: the processed text, that originates in tail propertys, gets inserted INTO the parent instead of alongside it

there is a second issue that makes text, that is supposed to be wrapped in an opacity span, disappear instead
Edit: it's actually exactly the same issue, in a copy pasted 4-line if statement

Let me know if that fixes it for you!!

@JamesonLahey looking over your examples it seems to have been the same issue
Note that the garbled section from Bea(ch) to La(hey) was inserted into the intact sentance about August, after IN, that i assume you put in caps because it is wrapped in a span/em or other style tag

So yeah i think i can be confident that your problems are fixed by this as well

If you also want already styled text to not be transformed, that would be a seperate issue/feature request