mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
MOBI Input: Handle MOBI files with empty <u> tags correctly. Fixes #774785 (Private bug)
This commit is contained in:
parent
186a47da8c
commit
9a32f09a71
@ -253,6 +253,8 @@ class MobiReader(object):
|
|||||||
|
|
||||||
.italic { font-style: italic }
|
.italic { font-style: italic }
|
||||||
|
|
||||||
|
.underline { text-decoration: underline }
|
||||||
|
|
||||||
.mbp_pagebreak {
|
.mbp_pagebreak {
|
||||||
page-break-after: always; margin: 0; display: block
|
page-break-after: always; margin: 0; display: block
|
||||||
}
|
}
|
||||||
@ -601,6 +603,9 @@ class MobiReader(object):
|
|||||||
elif tag.tag == 'i':
|
elif tag.tag == 'i':
|
||||||
tag.tag = 'span'
|
tag.tag = 'span'
|
||||||
tag.attrib['class'] = 'italic'
|
tag.attrib['class'] = 'italic'
|
||||||
|
elif tag.tag == 'u':
|
||||||
|
tag.tag = 'span'
|
||||||
|
tag.attrib['class'] = 'underline'
|
||||||
elif tag.tag == 'b':
|
elif tag.tag == 'b':
|
||||||
tag.tag = 'span'
|
tag.tag = 'span'
|
||||||
tag.attrib['class'] = 'bold'
|
tag.attrib['class'] = 'bold'
|
||||||
|
@ -1049,8 +1049,8 @@ class Manifest(object):
|
|||||||
|
|
||||||
# Remove hyperlinks with no content as they cause rendering
|
# Remove hyperlinks with no content as they cause rendering
|
||||||
# artifacts in browser based renderers
|
# artifacts in browser based renderers
|
||||||
# Also remove empty <b> and <i> tags
|
# Also remove empty <b>, <u> and <i> tags
|
||||||
for a in xpath(data, '//h:a[@href]|//h:i|//h:b'):
|
for a in xpath(data, '//h:a[@href]|//h:i|//h:b|//h:u'):
|
||||||
if a.get('id', None) is None and a.get('name', None) is None \
|
if a.get('id', None) is None and a.get('name', None) is None \
|
||||||
and len(a) == 0 and not a.text:
|
and len(a) == 0 and not a.text:
|
||||||
remove_elem(a)
|
remove_elem(a)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user