mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Strip empty <style,title,script> tags from EPUB. Fix #1660 (epub to LRF minor problems)
This commit is contained in:
parent
741e13c0e2
commit
7717679733
@ -166,6 +166,14 @@ class HTMLProcessor(Processor, Rationalizer):
|
||||
if tag.get('type', '').lower().strip() in ('image/svg+xml',):
|
||||
continue
|
||||
tag.getparent().remove(tag)
|
||||
|
||||
|
||||
for tag in self.root.xpath('//title|//style'):
|
||||
if not tag.text:
|
||||
tag.getparent().remove(tag)
|
||||
for tag in self.root.xpath('//script'):
|
||||
if not tag.text and not tag.get('src', False):
|
||||
tag.getparent().remove(tag)
|
||||
|
||||
def save(self):
|
||||
for meta in list(self.root.xpath('//meta')):
|
||||
|
@ -1720,7 +1720,7 @@ class HTMLConverter(object, LoggingInterface):
|
||||
self.previous_text = '\n'
|
||||
elif tagname in ['hr', 'tr']: # tr needed for nested tables
|
||||
self.end_current_block()
|
||||
if tagname == 'hr':
|
||||
if tagname == 'hr' and not tag_css.get('width', '').strip().startswith('0'):
|
||||
self.current_page.RuledLine(linelength=int(self.current_page.pageStyle.attrs['textwidth']))
|
||||
self.previous_text = '\n'
|
||||
self.process_children(tag, tag_css, tag_pseudo_css)
|
||||
|
Loading…
x
Reference in New Issue
Block a user