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
|
ctext = child.text
|
||||||
if space != 'preserve':
|
if space != 'preserve':
|
||||||
# Remove leading and trailing whitespace. Word ignores
|
# Remove leading and trailing whitespace. Word ignores
|
||||||
# leading and trailing whitespace without preserve
|
# leading and trailing whitespace without preserve unless
|
||||||
ctext = ctext.strip(' \n\r\t')
|
# 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
|
# Only use a <span> with white-space:pre-wrap if this element
|
||||||
# actually needs it, i.e. if it has more than one
|
# actually needs it, i.e. if it has more than one
|
||||||
# consecutive space or it has newlines or tabs.
|
# consecutive space or it has newlines or tabs.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user