Quote:
Originally Posted by jackie_w
@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.