Skip to content

Commit

Permalink
Fix error on != within script tag
Browse files Browse the repository at this point in the history
Added exclamation point as exception for attr name matching (i.e does not match "!="), so that the javascript "!=" operator is not flagged as a tag attribute.
  • Loading branch information
tmgemedia authored Apr 3, 2024
1 parent 8c1c7b2 commit c1b204e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/erb/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Error < StandardError; end
SPACES = /\s+/m

# https://stackoverflow.com/a/317081
ATTR_NAME = %r{[^\r\n\t\f\v= '"<>]*[^\r\n\t\f\v= '"<>/]} # not ending with a slash
ATTR_NAME = %r{[^\r\n\t\f\v\!= '"<>]*[^\r\n\t\f\v\!= '"<>/]} # not ending with a slash
UNQUOTED_VALUE = %r{[^<>'"\s]+}
UNQUOTED_ATTR = %r{#{ATTR_NAME}=#{UNQUOTED_VALUE}}
SINGLE_QUOTE_ATTR = %r{(?:#{ATTR_NAME}='[^']*?')}m
Expand Down

0 comments on commit c1b204e

Please sign in to comment.