Use <b> and <i> instead of <span> where possible

This commit is contained in:
Kovid Goyal 2013-06-12 16:36:16 +05:30
parent 9961ada770
commit b8be1a27b2

View File

@ -84,3 +84,14 @@ def cleanup_markup(root, styles):
for child in span:
parent.append(child)
# Make spans whose only styling is bold or italic into <b> and <i> tags
for span in root.xpath('//span[@class]'):
css = class_map.get(span.get('class', None), {})
if len(css) == 1:
if css == {'font-style':'italic'}:
span.tag = 'i'
del span.attrib['class']
elif css == {'font-weight':'bold'}:
span.tag = 'b'
del span.attrib['class']