Skip to content

Turn \r\n and \r in values into line breaks too - #207

Merged
cvas22 merged 1 commit into
mainfrom
fix/1-carriage-return-break
Nov 25, 2026
Merged

cvas22 merged 1 commit into
mainfrom
fix/1-carriage-return-break

Conversation

@cvas22

@cvas22 cvas22 commented Nov 25, 2026

Copy link
Copy Markdown
Owner

resolve_listing() only turned \n into <w:br/>. With Windows line endings each break kept a stray \r that the XML parser turns into a newline in the text, and with bare \r (#1) there were no breaks at all.

Both are now normalised to \n before the line breaks are added. It runs in resolve_listing(), so it covers plain {{ }} strings and RichText the same way. Raw \r can only come from context values at that point, since the template XML itself has none.

Tests cover \n, \r\n and \r for a plain string and a RichText. The \r\n and \r cases fail on main.

Fixes #1

@github-actions github-actions Bot added code Changes to the docform package tests Changes to tests labels Nov 25, 2026
Only \n became a w:br. A value with Windows line endings kept a stray \r
next to each break, and one with bare \r had no breaks at all, since the
XML parser turns a raw \r into whitespace. Normalise both to \n before
the line breaks are added, for plain strings and RichText alike.

Fixes #1
@cvas22
cvas22 force-pushed the fix/1-carriage-return-break branch from b73b01e to 6c3d7eb Compare November 25, 2026 09:07
@cvas22
cvas22 merged commit 8077e7a into main Nov 25, 2026
11 checks passed
@cvas22
cvas22 deleted the fix/1-carriage-return-break branch November 25, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code Changes to the docform package tests Changes to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RichText: Adapt the new line handling

1 participant