mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DOCX Input: Avoid nested <sup> tags for footnote references
Also avoid empty <sup> or <sub> tags.
This commit is contained in:
parent
f1ce7c0cf9
commit
08ca34e735
@ -702,7 +702,13 @@ class Convert(object):
|
||||
|
||||
style = self.styles.resolve_run(run)
|
||||
if style.vert_align in {'superscript', 'subscript'}:
|
||||
ans.tag = 'sub' if style.vert_align == 'subscript' else 'sup'
|
||||
if ans.text or len(ans):
|
||||
ans.tag = 'sub' if style.vert_align == 'subscript' else 'sup'
|
||||
try:
|
||||
if ans[0].tag == 'a' and ans[0].get('class', 'noteref') and ans[0][0].tag == 'sup' and ans.tag == 'sup':
|
||||
ans[0][0].tag = 'span'
|
||||
except Exception:
|
||||
pass
|
||||
if style.lang is not inherit:
|
||||
lang = html_lang(style.lang)
|
||||
if lang is not None and lang != self.doc_lang:
|
||||
|
Loading…
x
Reference in New Issue
Block a user