Skip to content

Handle ERB tag immediately before closing bracket#91

Open
averydev wants to merge 3 commits into
threedaymonk:masterfrom
averydev:fix-erb-before-closing-bracket
Open

Handle ERB tag immediately before closing bracket#91
averydev wants to merge 3 commits into
threedaymonk:masterfrom
averydev:fix-erb-before-closing-bracket

Conversation

@averydev

Copy link
Copy Markdown

When an ERB tag immediately precedes the closing bracket of an HTML tag (e.g., <option <%= "selected" if x %>>), the open_element regex failed to match because [^/]> requires a character between %> and >.

Changed [^/]> to (?:%>|[^/])> to allow either %> or a non-/ character before the final >.

Before: Multi-line tags with ERB conditional attributes would cause incorrect indentation of subsequent elements.

After: Indentation is preserved correctly.

Covers edge case where <option value="<%= x %>"> inside an each
loop is followed by a div with ERB before closing bracket (%>>).
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.

1 participant