View Single Post
Old 05-24-2020, 08:52 PM   #2105
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by jackie_w View Post
@jgoguen, @davidfor,

In the forced_cleanup method of your container.py file, have you considered letting calibre do the hard work using it's standard Beautify function?
Code:
from calibre.ebooks.oeb.polish.pretty import pretty_all
pretty_all(container)
I don't know whether it will fix your current <br/> problem but in my own plugins I've generally found it a more reliable option than regex when trying to sort out things like self-closing tags. It might even fix the encoding stuff at the same time.
I'll have to leave that to @jgoguen. I'm not sure if his intention was to minimize the changes made to the book code, or because he didn't like what the prettty_all did. Things might have changed since this was written, so, I don't know.

I did look at it, and it appears to be one of the regex's in that method. The problem has probably been there for a while, but, the change for Python 3 have exposed it. I have attached a beta that seems to fix it. The same problem is in the output plugin, but, I'll wait for any comments about the driver before doing anything there.
Attached Files
File Type: zip KoboTouchExtended-beta.zip (34.0 KB, 273 views)
davidfor is offline   Reply With Quote