Skip to content

Fix escaped Jinja delimiters split across Word runs - #170

Merged
cvas22 merged 1 commit into
mainfrom
port/upstream-662
Nov 22, 2026
Merged

cvas22 merged 1 commit into
mainfrom
port/upstream-662

Conversation

@cvas22

@cvas22 cvas22 commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Port of elapouya/python-docx-template#662 by @CAOShurong, which has been waiting upstream (fixes elapouya/python-docx-template#548). The commit keeps @CAOShurong as the author.

The only changes are the move from docxtpl/ to docform/ and the import name. No changes besides the path.

The unit tests and the new script in tests/ pass locally.

Join only the four supported escaped Jinja delimiter tokens when Word has divided their characters into separate runs. Keep matching within one paragraph and add regression coverage for single-run, split-run, and false-positive cases.

Assisted-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: CAOShurong <170531907+CAOShurong@users.noreply.github.com>
@CAOShurong

Copy link
Copy Markdown
Contributor

This port fixes the document from elapouya/python-docx-template#548. At a4850b2, a tab or line break between delimiter characters still disappears when the document is rendered. I tested the follow-up fix on this branch with that document and all 33 Docform unit tests. Both separators are preserved.

@cvas22
cvas22 merged commit 3fef809 into main Nov 22, 2026
10 checks passed
@cvas22
cvas22 deleted the port/upstream-662 branch November 22, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Escaping delimiters cannot render properly

2 participants