tailwindcss/crates/oxide
Robin Malfait d5ca0aeac9
Handle template toolkit %]…[% syntax (#20269)
This PR handles template toolkit syntax as a pre-processor step such
that `%]` and `[%` are seen as valid boundary characters.

This is handled for the `.tt`, `.tt2` and `.tx` file extensions. It's
not handled if this syntax is used in `.html` files because then
everybody pays a pre processor cost even if you don't need this syntax
in most cases.

This now ensures that a `template.tx` like this:
```html
<div class="[% IF $is_open %]bg-white/40[% ELSE %]bg-white/10[% END %]"></div>
<!--                         ^^^^^^^^^^^          ^^^^^^^^^^^              -->
```
Extracts the classes in between those conditions correctly.

This also fixes a small issue related to Maud, a template engine for
Rust where conditionals like `p.text-black[condition]` caused the
`text-black` class not to be extracted. This is fixed as part of this PR
because it was commented on the linked issue.

Fixes: #20233 

## Test plan

1. Added a new extractor
2. Added regression tests
3. All existing tests pass
2026-06-22 15:40:58 +02:00
..
fuzz Hoist oxide/crates to just crates (#13333) 2024-03-23 09:00:48 -04:00
src Handle template toolkit %]…[% syntax (#20269) 2026-06-22 15:40:58 +02:00
tests Restrict walking sibling folders when using a pattern (#20263) 2026-06-19 22:39:57 +02:00
Cargo.toml Remove unused crossbeam dependency in oxide (#19256) 2025-11-04 10:37:21 -05:00