Skip to content

fix: use correct FAST syntax in f-template directive attributes#227

Merged
mohamedmansour merged 2 commits intomainfrom
users/janechu/fix-webui-integration-issues-ftemplate-blocks
Apr 14, 2026
Merged

fix: use correct FAST syntax in f-template directive attributes#227
mohamedmansour merged 2 commits intomainfrom
users/janechu/fix-webui-integration-issues-ftemplate-blocks

Conversation

@janechu
Copy link
Copy Markdown
Contributor

@janechu janechu commented Apr 13, 2026

Summary

Fix the FAST parser plugin to emit double curly braces in <f-when> and <f-repeat> value attributes, matching the FAST-HTML client-side parser expectations.

Before

<f-when value="{show}">
<f-repeat value="{item in items}">

After

<f-when value="{{show}}">
<f-repeat value="{{item in items}}">

Changes

crates/webui-parser/src/plugin/fast.rs

  • convert_if_tag: emit {{EXPR}} instead of {EXPR} in <f-when value>
  • convert_for_tag: emit {{EXPR}} instead of {EXPR} in <f-repeat value>
  • Add regression tests: for-loop conversion, shadow DOM with directive conversion, nested if+for conversion
  • Update doc comments to reflect corrected syntax

DESIGN.md

  • Update FastParserPlugin syntax documentation to show double-brace format

Copy link
Copy Markdown
Contributor

@mohamedmansour mohamedmansour left a comment

Choose a reason for hiding this comment

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

These changes should go inside fast.rs not in core infra code.

Add regression tests in the FAST parser plugin verifying that generated
f-template blocks always use FAST syntax (<f-when>/<f-repeat>) instead
of webui syntax (<if>/<for>):

- For loop: <for> converted to <f-repeat> in generated f-template
- Shadow DOM: shadowrootmode stripped and directives converted
- Nested: both <if> and <for> converted when nested together

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@janechu janechu force-pushed the users/janechu/fix-webui-integration-issues-ftemplate-blocks branch from 2389b0c to 41d1302 Compare April 13, 2026 23:38
Change FAST syntax conversion to emit double curly braces:
- <if condition="X"> → <f-when value="{{X}}">
- <for each="X"> → <f-repeat value="{{X}}">

Update DESIGN.md to reflect the corrected syntax.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@janechu janechu changed the title test: add regression tests for FAST f-template syntax conversion fix: use correct FAST syntax in f-template directive attributes Apr 13, 2026
@janechu janechu marked this pull request as ready for review April 13, 2026 23:44
@mohamedmansour mohamedmansour merged commit 02f17a3 into main Apr 14, 2026
21 checks passed
@mohamedmansour mohamedmansour deleted the users/janechu/fix-webui-integration-issues-ftemplate-blocks branch April 14, 2026 01:20
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.

2 participants