mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Small performance improvement
This commit is contained in:
parent
6d1ccb0873
commit
fbddd0427d
@ -449,12 +449,13 @@ class EPUBOutput(OutputFormatPlugin):
|
|||||||
if not in_table(tag):
|
if not in_table(tag):
|
||||||
tag.tag = XHTML('div')
|
tag.tag = XHTML('div')
|
||||||
|
|
||||||
|
# ADE fails to render non breaking hyphens/soft hyphens/zero width spaces
|
||||||
special_chars = re.compile(u'[\u200b\u00ad]')
|
special_chars = re.compile(u'[\u200b\u00ad]')
|
||||||
for elem in root.iterdescendants():
|
for elem in root.iterdescendants('*'):
|
||||||
if getattr(elem, 'text', False):
|
if elem.text:
|
||||||
elem.text = special_chars.sub('', elem.text)
|
elem.text = special_chars.sub('', elem.text)
|
||||||
elem.text = elem.text.replace(u'\u2011', '-')
|
elem.text = elem.text.replace(u'\u2011', '-')
|
||||||
if getattr(elem, 'tail', False):
|
if elem.tail:
|
||||||
elem.tail = special_chars.sub('', elem.tail)
|
elem.tail = special_chars.sub('', elem.tail)
|
||||||
elem.tail = elem.tail.replace(u'\u2011', '-')
|
elem.tail = elem.tail.replace(u'\u2011', '-')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user