mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix wrapping of multiple children
This commit is contained in:
parent
1f87c3c87a
commit
50bdf1c8a8
@ -248,6 +248,9 @@ class Structure(BaseTest):
|
|||||||
|
|
||||||
'<p>One</p> Two. Three <p>Four':
|
'<p>One</p> Two. Three <p>Four':
|
||||||
'<body><p><span id="1">One</span></p><span id="2"> Two. </span><span id="3">Three </span><p><span id="4">Four</span></p>',
|
'<body><p><span id="1">One</span></p><span id="2"> Two. </span><span id="3">Three </span><p><span id="4">Four</span></p>',
|
||||||
|
|
||||||
|
'<p>Here is some <b>bold, </b><i>italic, </i><u>underline, </u> text.':
|
||||||
|
'<body><p><span id="1">Here is some <b>bold, </b><i>italic, </i><u>underline, </u> text.</span></p>',
|
||||||
}.items()):
|
}.items()):
|
||||||
root = parse(text, namespace_elements=True)
|
root = parse(text, namespace_elements=True)
|
||||||
orig = normalize_markup(root)
|
orig = normalize_markup(root)
|
||||||
|
@ -171,10 +171,12 @@ def mark_sentences_in_html(root, lang: str = '', voice: str = '') -> list[Senten
|
|||||||
w.append(c)
|
w.append(c)
|
||||||
first_child = c
|
first_child = c
|
||||||
if in_range:
|
if in_range:
|
||||||
if last_child is not first_child:
|
|
||||||
w.append(last_child)
|
|
||||||
if c is last_child:
|
if c is last_child:
|
||||||
|
if last_child is not first_child:
|
||||||
|
w.append(c)
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
w.append(c)
|
||||||
self.replace_reference_to_child(last_child, w)
|
self.replace_reference_to_child(last_child, w)
|
||||||
return w
|
return w
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user