improve CSS property text-decoration (allow multi text-decoration)

This commit is contained in:
Julien Pivotto 2008-08-13 11:21:39 +00:00
parent e3428713e3
commit db0be5c05a
1 changed files with 13 additions and 14 deletions

View File

@ -477,23 +477,22 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
tag.set_property('justification', align)
def _parse_style_text_decoration(self, tag, value):
if value == 'none':
values = value.split(' ')
if 'none' in values:
tag.set_property('underline', pango.UNDERLINE_NONE)
tag.set_property('strikethrough', False)
elif value == 'underline':
if 'underline' in values:
tag.set_property('underline', pango.UNDERLINE_SINGLE)
tag.set_property('strikethrough', False)
elif value == 'overline':
warnings.warn('text-decoration:overline not implemented')
tag.set_property('underline', pango.UNDERLINE_NONE)
tag.set_property('strikethrough', False)
elif value == 'line-through':
tag.set_property('underline', pango.UNDERLINE_NONE)
tag.set_property('strikethrough', True)
elif value == 'blink':
warnings.warn('text-decoration:blink not implemented')
else:
warnings.warn('text-decoration:%s not implemented' % value)
tag.set_property('underline', pango.UNDERLINE_NONE)
if 'line-through' in values:
tag.set_property('strikethrough', True)
else:
tag.set_property('strikethrough', False)
if 'blink' in values:
warnings.warn('text-decoration:blink not implemented')
if 'overline' in values:
warnings.warn('text-decoration:overline not implemented')
def _parse_style_white_space(self, tag, value):
if value == 'pre':
@ -1148,4 +1147,4 @@ if __name__ == '__main__':
w.connect('destroy', lambda w: gtk.main_quit())
gtk.main()
# vim: se ts=3:
# vim: se ts=3: