mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DOCX Input: Fix text elements containing only whitespace being incorrectly ignored. Fixes #2063301 [Incorrect conversion docx to epub](https://bugs.launchpad.net/calibre/+bug/2063301)
This commit is contained in:
parent
dd747283ca
commit
d045698289
@ -671,8 +671,11 @@ class Convert:
|
||||
ctext = child.text
|
||||
if space != 'preserve':
|
||||
# Remove leading and trailing whitespace. Word ignores
|
||||
# leading and trailing whitespace without preserve
|
||||
ctext = ctext.strip(' \n\r\t')
|
||||
# leading and trailing whitespace without preserve unless
|
||||
# the element is only whitespace.
|
||||
stripped = ctext.strip(' \n\r\t')
|
||||
if stripped:
|
||||
ctext = stripped
|
||||
# Only use a <span> with white-space:pre-wrap if this element
|
||||
# actually needs it, i.e. if it has more than one
|
||||
# consecutive space or it has newlines or tabs.
|
||||
|
Loading…
x
Reference in New Issue
Block a user