mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use <b> and <i> instead of <span> where possible
This commit is contained in:
parent
9961ada770
commit
b8be1a27b2
@ -84,3 +84,14 @@ def cleanup_markup(root, styles):
|
|||||||
for child in span:
|
for child in span:
|
||||||
parent.append(child)
|
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']
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user