Skip to content

Parser: Fix ERB control flow tags in attribute positions#873

Merged
marcoroth merged 7 commits into
mainfrom
fix-erb-control-flow-in-attributes
Feb 11, 2026
Merged

Parser: Fix ERB control flow tags in attribute positions#873
marcoroth merged 7 commits into
mainfrom
fix-erb-control-flow-in-attributes

Conversation

@marcoroth

@marcoroth marcoroth commented Nov 13, 2025

Copy link
Copy Markdown
Owner

This pull request fixes the parser to correctly handle ERB control flow tags when parsing HTML attributes.

Previously, control flow tags like <% if %>, <% end %>, and <%# comment %> were incorrectly included as part of attribute names and values. Now, only ERB output tags (<%=, <%==) can be part of attribute names, while control flow tags properly terminate attribute name and attribute value parsing.

This enables patterns like this, where there is no space between the closing %> and the attribute name:

<dialog data-controller="dialog" <% if condition %>data-turbo-permanent<% end %>></dialog>
<div <% if admin? %>data-admin data-role="admin"<% end %>></div>

Resolves #872
Resolves #1063

Comment thread src/parser.c Outdated
@pkg-pr-new

pkg-pr-new Bot commented Feb 11, 2026

Copy link
Copy Markdown
npx https://pkg.pr.new/@herb-tools/formatter@873
npx https://pkg.pr.new/@herb-tools/language-server@873
npx https://pkg.pr.new/@herb-tools/linter@873

commit: f69460b

@github-actions

github-actions Bot commented Feb 11, 2026

Copy link
Copy Markdown

🌿 Interactive Playground and Documentation Preview

A preview deployment has been built for this pull request. Try out the changes live in the interactive playground:


🌱 Grown from commit f69460b


✅ Preview deployment has been cleaned up.

@marcoroth marcoroth merged commit ae9821a into main Feb 11, 2026
38 of 39 checks passed
@marcoroth marcoroth deleted the fix-erb-control-flow-in-attributes branch February 11, 2026 19:16
@marcoroth marcoroth added this to the v1.0.0 milestone Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parser: Conditional boolean attribute attribute Incorrect MissingERBEndTagError

2 participants