Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion pydocx/export/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,17 @@ def export_run_property_underline(self, run, results):
'class': 'pydocx-underline',
}
tag = HtmlTag('span', **attrs)
return self.export_run_property(tag, run, results)

# Added function to apply underline to whitespace.
def preserve_spaces(items):
for item in items:
# If the item is only whitespace, convert it to a space entity
if is_only_whitespace(item) and hasattr(item, 'replace'):
yield item.replace(' ', ' ')
else:
yield item

return self.export_run_property(tag, run, preserve_spaces(results))

def export_run_property_caps(self, run, results):
attrs = {
Expand Down