diff --git a/src/calibre/ebooks/oeb/polish/tests/structure.py b/src/calibre/ebooks/oeb/polish/tests/structure.py index 0e370aac5f..fa53d6d808 100644 --- a/src/calibre/ebooks/oeb/polish/tests/structure.py +++ b/src/calibre/ebooks/oeb/polish/tests/structure.py @@ -248,6 +248,9 @@ class Structure(BaseTest): '
One
Two. ThreeFour': '
One
Two. ThreeFour
', + + 'Here is some bold, italic, underline, text.': + '
Here is some bold, italic, underline, text.
', }.items()): root = parse(text, namespace_elements=True) orig = normalize_markup(root) diff --git a/src/calibre/ebooks/oeb/polish/tts.py b/src/calibre/ebooks/oeb/polish/tts.py index 1c073e2409..f5572ebac9 100644 --- a/src/calibre/ebooks/oeb/polish/tts.py +++ b/src/calibre/ebooks/oeb/polish/tts.py @@ -171,10 +171,12 @@ def mark_sentences_in_html(root, lang: str = '', voice: str = '') -> list[Senten w.append(c) first_child = c if in_range: - if last_child is not first_child: - w.append(last_child) if c is last_child: + if last_child is not first_child: + w.append(c) break + else: + w.append(c) self.replace_reference_to_child(last_child, w) return w