From 0288440d9a3ff78f19b75a14202be719c553893d Mon Sep 17 00:00:00 2001 From: tmgemedia Date: Wed, 3 Apr 2024 11:34:25 -0400 Subject: [PATCH] Fix error on != within script tag 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. --- lib/erb/formatter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/erb/formatter.rb b/lib/erb/formatter.rb index 3e1db4f..9f149ec 100644 --- a/lib/erb/formatter.rb +++ b/lib/erb/formatter.rb @@ -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