Repository navigation
Don't let unbalanced brackets in Pug text leak into the next line - #20547
cestercian wants to merge 5 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughPug preprocessing now resets unmatched bracket state at newlines outside attribute lists. It tracks attribute lists that span multiple lines and clears that state when the outer bracket closes. Tests cover class extraction after unbalanced brackets in text and comments, and class extraction within and after multiline attribute lists. The Unreleased changelog records the fix. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change is mergeable after normal checks. A narrow Pug attribute-value edge case remains but does not block the fix. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
bd50a8b8-14e5-400b-8b7d-fac552fb128e
📒 Files selected for processing (2)
CHANGELOG.mdcrates/oxide/src/extractor/pre_processors/pug.rs
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Repeated spaces or tabs after `:` (e.g. `li: a(`) no longer clear in_tag, so the `(` is still treated as a multiline attribute list.
Summary
Fixes #20545
The Pug pre-processor keeps one bracket stack for the whole file. A text or comment line with an unbalanced bracket, like
| (, pushes a(that is never popped, and from then on dots are no longer turned into spaces. Sospan.underline.font-boldon the next line stays one invalid candidate and those classes never get CSS.This resets the bracket stack at the end of a line, unless we're inside a Pug attribute list (a
(directly after a tag, class, id or mixin name), since those can span multiple lines. Inside an attribute list the behavior is the same as before.Test plan
Added unit tests in
pug.rsfor the cases from the issue (piped text, a//-comment, inline text after a tag) plus a multi-line attribute list to make sure that still works. The new test fails without the change.All 122 unit tests and 71 scanner tests pass.