mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
A fuller fix for #1681.
This commit is contained in:
parent
16c495cd95
commit
9f5078add1
@ -165,8 +165,11 @@ class HTMLProcessor(Processor, Rationalizer):
|
|||||||
br.tag = 'p'
|
br.tag = 'p'
|
||||||
br.text = u'\u00a0'
|
br.text = u'\u00a0'
|
||||||
if (br.tail and br.tail.strip()) or sibling is None or \
|
if (br.tail and br.tail.strip()) or sibling is None or \
|
||||||
getattr(sibling, 'tag', '') != 'br':
|
getattr(sibling, 'tag', '') != 'br':
|
||||||
br.set('style', br.get('style', '')+'; margin: 0pt; border:0pt; height:0pt')
|
style = br.get('style', '').split(';')
|
||||||
|
style = filter(None, map(lambda x: x.strip(), style))
|
||||||
|
style.append('margin: 0pt; border:0pt; height:0pt')
|
||||||
|
br.set('style', '; '.join(style))
|
||||||
else:
|
else:
|
||||||
sibling.getparent().remove(sibling)
|
sibling.getparent().remove(sibling)
|
||||||
if sibling.tail:
|
if sibling.tail:
|
||||||
|
@ -277,10 +277,9 @@ class Style(object):
|
|||||||
def _apply_style_attr(self):
|
def _apply_style_attr(self):
|
||||||
attrib = self._element.attrib
|
attrib = self._element.attrib
|
||||||
if 'style' in attrib:
|
if 'style' in attrib:
|
||||||
css = attrib['style'].strip()
|
css = attrib['style'].split(';')
|
||||||
if css.startswith(';'):
|
css = filter(None, map(lambda x: x.strip(), css))
|
||||||
css = css[1:]
|
style = CSSStyleDeclaration('; '.join(css))
|
||||||
style = CSSStyleDeclaration(css)
|
|
||||||
self._style.update(self._stylizer.flatten_style(style))
|
self._style.update(self._stylizer.flatten_style(style))
|
||||||
|
|
||||||
def _has_parent(self):
|
def _has_parent(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user