Detect extra spaces in old-style keywords like ref and caption#859
Merged
chrismaddalena merged 4 commits intomasterfrom Apr 8, 2026
Merged
Detect extra spaces in old-style keywords like ref and caption#859chrismaddalena merged 4 commits intomasterfrom
chrismaddalena merged 4 commits intomasterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Ghostwriter’s rich text → Jinja preprocessing to tolerate whitespace in legacy “dot syntax” tags (e.g., {{ .ref ... }}), preventing template syntax issues when users (or editors) insert extra spaces.
Changes:
- Broadened the legacy dot-syntax replacement regex to accept optional whitespace around the
.keywordtoken. - Added unit coverage to confirm spaced legacy
.reftags render correctly. - Added an integration-style regression test ensuring DOCX export succeeds when a Report rich text extra field contains a spaced legacy
.reftag.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
ghostwriter/modules/reportwriter/base/html_rich_text.py |
Adjusts legacy dot-syntax parsing to accept whitespace inside {{ ... }}. |
ghostwriter/reporting/tests/test_rich_text_templating.py |
Adds tests covering spaced legacy .ref parsing and a DOCX export regression path. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #859 +/- ##
=======================================
Coverage 91.76% 91.77%
=======================================
Files 376 376
Lines 21943 21958 +15
=======================================
+ Hits 20137 20151 +14
- Misses 1806 1807 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Detect extra spaces in old-style keywords—like
.captionand.ref—to avoid syntax errors.