mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DOCX Output: Preserve space before soft hyphen
This commit is contained in:
parent
21b4869f22
commit
b0d3fe6677
@ -116,6 +116,12 @@ class TextRun:
|
|||||||
if text:
|
if text:
|
||||||
for x in self.soft_hyphen_pat.split(text):
|
for x in self.soft_hyphen_pat.split(text):
|
||||||
if x == '\u00ad':
|
if x == '\u00ad':
|
||||||
|
# trailing spaces in <w:t> before a soft hyphen are
|
||||||
|
# ignored, so put them in a preserve whitespace
|
||||||
|
# element with a single space.
|
||||||
|
if not preserve_whitespace and len(r) and r[-1].text and r[-1].text.endswith(' '):
|
||||||
|
r[-1].text = r[-1].text.rstrip()
|
||||||
|
add_text(' ', True)
|
||||||
makeelement(r, 'w:softHyphen')
|
makeelement(r, 'w:softHyphen')
|
||||||
elif x:
|
elif x:
|
||||||
add_text(x, preserve_whitespace)
|
add_text(x, preserve_whitespace)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user