From c70c54b4b36333b70777fe113b69414507a6de9a Mon Sep 17 00:00:00 2001 From: Phil Schalm Date: Tue, 6 Feb 2024 01:18:03 -0800 Subject: [PATCH] Update code to handle currently-broken test --- lib/erb/formatter.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/erb/formatter.rb b/lib/erb/formatter.rb index fff8be1..ebc899a 100644 --- a/lib/erb/formatter.rb +++ b/lib/erb/formatter.rb @@ -136,16 +136,17 @@ def format_attributes(tag_name, attrs, tag_closing) attrs.scan(ATTR).flatten.each do |attr| attr.strip! name, value = attr.split('=', 2) - if UNQUOTED_ATTR =~ attr - attr_html << indented("#{name}=\"#{value}\"") - next - end if value.nil? attr_html << indented("#{name}") next end + if value[0] != '"' && value[0] != "'" + attr_html << indented("#{name}=\"#{value}\"") + next + end + value_parts = value[1...-1].strip.split(/\s+/) value_parts.sort_by!(&@css_class_sorter) if name == 'class' && @css_class_sorter