Skip to content

Commit

Permalink
Also handle soft hyphens with trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Mar 2, 2024
1 parent b0d3fe6 commit c38bacc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/calibre/ebooks/docx/writer/from_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ def add_text(text, preserve_whitespace):
add_text(' ', True)
makeelement(r, 'w:softHyphen')
elif x:
if not preserve_whitespace and x.startswith(' ') and len(r) and r[-1].tag and 'softHyphen' in r[-1].tag:
x = x.lstrip()
add_text(' ', True)
add_text(x, preserve_whitespace)
else:
add_text('', preserve_whitespace)
Expand Down

0 comments on commit c38bacc

Please sign in to comment.