mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
EPUB Output:Remove object and embed tags when using profile PRS505 as they cause the reader to crash
This commit is contained in:
parent
e10146e56d
commit
757d9a533f
@ -15,15 +15,17 @@ from lxml import etree
|
|||||||
|
|
||||||
class DefaultProfile(object):
|
class DefaultProfile(object):
|
||||||
|
|
||||||
flow_size = sys.maxint
|
flow_size = sys.maxint
|
||||||
screen_size = None
|
screen_size = None
|
||||||
remove_special_chars = False
|
remove_special_chars = False
|
||||||
|
remove_object_tags = False
|
||||||
|
|
||||||
class PRS505(DefaultProfile):
|
class PRS505(DefaultProfile):
|
||||||
|
|
||||||
flow_size = 270000
|
flow_size = 270000
|
||||||
screen_size = (590, 765)
|
screen_size = (590, 765)
|
||||||
remove_special_chars = re.compile(u'[\u200b\u00ad]')
|
remove_special_chars = re.compile(u'[\u200b\u00ad]')
|
||||||
|
remove_object_tags = True
|
||||||
|
|
||||||
|
|
||||||
PROFILES = {
|
PROFILES = {
|
||||||
|
@ -159,6 +159,10 @@ class HTMLProcessor(Processor, Rationalizer):
|
|||||||
br.tag = 'p'
|
br.tag = 'p'
|
||||||
br.text = u'\u00a0'
|
br.text = u'\u00a0'
|
||||||
|
|
||||||
|
if self.opts.profile.remove_object_tags:
|
||||||
|
for tag in self.root.xpath('//object|//embed'):
|
||||||
|
tag.getparent().remove(tag)
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
for meta in list(self.root.xpath('//meta')):
|
for meta in list(self.root.xpath('//meta')):
|
||||||
meta.getparent().remove(meta)
|
meta.getparent().remove(meta)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user