Skip to content

Commit

Permalink
Applied patch from #508
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismaddalena committed Aug 29, 2024
1 parent dc7b314 commit a0df6ea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ghostwriter/modules/reportwriter/richtext/ooxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class TextTracking:
Ref: https://www.w3.org/TR/css-text-3/#white-space-processing
"""

is_block_start: bool
segment_break_run: typing.Any | None
in_pre: bool
Expand Down Expand Up @@ -72,14 +73,15 @@ def append_text_to_run(self, run, text: str):
self.is_block_start = False
self.force_emit_pending_segment_break()
run.text = run.text + match[0]
text = text[match.end():]
text = text[match.end() :]

def force_emit_pending_segment_break(self):
"""
If there is a pending segment break, forcibly emits it as a space.
Use this before adding inline content to a paragraph, so that a space between it and the previous text is properly inserted.
"""
self.is_block_start = False
if self.segment_break_run is not None:
self.segment_break_run.text = self.segment_break_run.text + " "
self.segment_break_run = None
Expand All @@ -92,6 +94,7 @@ class BaseHtmlToOOXML:
Use a subclass that matches the desired document type.
"""

text_tracking: TextTracking

def __init__(self):
Expand Down

1 comment on commit a0df6ea

@smcgu
Copy link
Contributor

@smcgu smcgu commented on a0df6ea Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to fix the issue on my end.

Please sign in to comment.