Skip to content

Preserve tabs and line breaks between escaped delimiter characters - #174

Merged
cvas22 merged 2 commits into
cvas22:mainfrom
CAOShurong:fix/preserve-delimiter-separators
Nov 22, 2026
Merged

cvas22 merged 2 commits into
cvas22:mainfrom
CAOShurong:fix/preserve-delimiter-separators

Conversation

@CAOShurong

Copy link
Copy Markdown
Contributor

This follows #170 and ports the correction from elapouya/python-docx-template#662. On main, a Word tab or manual line break between } and _} disappears during rendering, turning the text into }}. The change preserves the separator and still renders adjacent characters across differently formatted runs.

The new test saves and reopens a Word document for all three cases. All 36 unit tests and 37 example scripts passed locally. The original document attached to #115 also renders all four escaped delimiters correctly.

Copilot AI balanced review requested due to automatic review settings November 22, 2026 06:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@cvas22 cvas22 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thx for porting this. The tab/br fix works, but the new allowlist also stops joining across w:proofErr, bookmarks and w:lastRenderedPageBreak, which Word adds all the time, so }_} with a spell-check marker in the middle renders literally now. Could you keep the old paragraph-wide gap and just exclude w:tab/w:br/w:cr, plus add a proofErr case to the test?

Copilot AI balanced review requested due to automatic review settings November 22, 2026 08:52
@CAOShurong

Copy link
Copy Markdown
Contributor Author

Restored the paragraph-wide match in 23dc421. Proofing marks, bookmarks, and last-rendered page breaks can sit inside a delimiter again. Tabs, breaks, and carriage returns still interrupt it. The new regression saves and renders a Word document with a spell-check range around the underscore.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@cvas22
cvas22 force-pushed the fix/preserve-delimiter-separators branch from 23dc421 to 484c859 Compare November 22, 2026 08:58
Copilot AI balanced review requested due to automatic review settings November 22, 2026 08:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions github-actions Bot added documentation Improvements or additions to documentation code Changes to the docform package tests Changes to tests labels Nov 22, 2026

@cvas22 cvas22 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thx, this looks good now. Proofing marks and bookmarks join again and tabs/breaks still stop it.

@cvas22
cvas22 merged commit 6a049d0 into cvas22:main Nov 22, 2026
11 checks passed
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 documentation Improvements or additions to documentation tests Changes to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants