A fuller fix for #1681.

This commit is contained in:
Marshall T. Vandegrift 2009-01-25 14:45:21 -05:00
parent 16c495cd95
commit 9f5078add1
2 changed files with 8 additions and 6 deletions

View File

@ -165,8 +165,11 @@ class HTMLProcessor(Processor, Rationalizer):
br.tag = 'p'
br.text = u'\u00a0'
if (br.tail and br.tail.strip()) or sibling is None or \
getattr(sibling, 'tag', '') != 'br':
br.set('style', br.get('style', '')+'; margin: 0pt; border:0pt; height:0pt')
getattr(sibling, 'tag', '') != 'br':
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:
sibling.getparent().remove(sibling)
if sibling.tail:

View File

@ -277,10 +277,9 @@ class Style(object):
def _apply_style_attr(self):
attrib = self._element.attrib
if 'style' in attrib:
css = attrib['style'].strip()
if css.startswith(';'):
css = css[1:]
style = CSSStyleDeclaration(css)
css = attrib['style'].split(';')
css = filter(None, map(lambda x: x.strip(), css))
style = CSSStyleDeclaration('; '.join(css))
self._style.update(self._stylizer.flatten_style(style))
def _has_parent(self):