fix: use quote-aware tag close detection in FAST parser plugin#242
Merged
fix: use quote-aware tag close detection in FAST parser plugin#242
Conversation
e99221e to
1684126
Compare
4 tasks
mohamedmansour
approved these changes
Apr 16, 2026
When condition expressions contain `>` or `>=` operators (e.g.,
`<if condition="vara > 2">`), the naive `tag_str.find('>')` matches
the `>` inside the quoted attribute value instead of the actual tag
closing bracket. This causes the conversion to produce malformed
`<f-template>` output with mismatched `<if condition=...></f-when>` tags.
Replace all `tag_str.find('>')` calls with `find_tag_close()` that
skips `>` characters inside double-quoted attribute values.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1684126 to
abf8c8d
Compare
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.
Description
Fix malformed
<f-template>output when condition expressions contain>or>=operators.When converting
<if condition="vara > 2">to<f-when value="{{vara > 2}}">, the naivetag_str.find('>')call matches the>inside the quoted attribute value instead of the actual tag-closing bracket. This produces malformed output with mismatched tags:<if condition="vara > 2">Over two</f-when>.The fix introduces
find_tag_close()— a quote-aware scanner that skips>characters inside double-quoted attribute values. All tag-closing searches in the FAST parser plugin (convert_if_tag,convert_for_tag,convert_route_tag,convert_complex_attrs,strip_shadowrootmode) now use this function.Test Plan
>,>=, and<operators inconvert_btr_to_fast()find_tag_close()with quoted>characterscargo xtask checkpasses (license-headers, fmt, clippy, test)Checklist