Skip to content

Detect classes in Ruby percent literals using angle brackets or custom delimiters - #20387

Open
lazerg wants to merge 4 commits into
tailwindlabs:mainfrom
lazerg:fix/issue-20386-ruby-percent-literal-delimiters
Open

Detect classes in Ruby percent literals using angle brackets or custom delimiters#20387
lazerg wants to merge 4 commits into
tailwindlabs:mainfrom
lazerg:fix/issue-20386-ruby-percent-literal-delimiters

Conversation

@lazerg

@lazerg lazerg commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #20386.

Ruby lets you close a %w/%W literal with any non-alphanumeric character, but the pre-processor only recognized [, (, {, # and a space. So %w<bg-green-400> and %w|bg-blue-400| were skipped and the classes inside them never made it into the output.

The boundary lookup now maps < to > alongside the other paired delimiters, and falls back to treating any other non-alphanumeric, non-whitespace character as its own closing delimiter.

Test plan

Added pre-processor and extraction cases for %w<…>, %w|…|, %w:…: and %w!…! in crates/oxide/src/extractor/pre_processors/ruby.rs. They fail on main and pass with this change.

cargo test -p tailwindcss-oxide

@lazerg
lazerg requested a review from a team as a code owner August 5, 2026 15:29
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 730abe96-c5cd-4387-bef4-9c076f150216

📥 Commits

Reviewing files that changed from the base of the PR and between 2eedbed and 4aede54.

📒 Files selected for processing (1)
  • crates/oxide/src/extractor/pre_processors/ruby.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/oxide/src/extractor/pre_processors/ruby.rs

Walkthrough

Ruby %w preprocessing now supports angle-bracket delimiters, nested angle brackets, and additional ASCII punctuation delimiters. It skips modulo expressions and treats backslashes as escapes only when they are not the delimiter. Tests cover preprocessing and extraction for supported forms. The changelog records the new class detection entry.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes Ruby class detection for angle-bracket and custom percent-literal delimiters.
Description check ✅ Passed The description explains the Ruby delimiter parsing fix, linked issue, affected cases, and test coverage.
Linked Issues check ✅ Passed The changes satisfy issue #20386 by supporting angle brackets and custom delimiters, with tests for the reported cases.
Out of Scope Changes check ✅ Passed The changes remain within scope by improving Ruby percent-literal delimiter handling and adding related regression tests.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported nested-angle truncation is addressed by balancing inner <…> pairs before closing the outer literal.

Reviews (3): Last reviewed commit: "Only treat a percent literal as a litera..." | Re-trigger Greptile

Comment thread crates/oxide/src/extractor/pre_processors/ruby.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 435ede9e-0900-48af-b4b7-f5dd15aad4f2

📥 Commits

Reviewing files that changed from the base of the PR and between 3524b45 and 4eae200.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • crates/oxide/src/extractor/pre_processors/ruby.rs

Comment thread crates/oxide/src/extractor/pre_processors/ruby.rs Outdated
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.

Classes are not detected in Ruby %w literals using angle brackets <> or custom delimiters

1 participant