diff --git a/lib/erb/formatter.rb b/lib/erb/formatter.rb index 193620c..fff8be1 100644 --- a/lib/erb/formatter.rb +++ b/lib/erb/formatter.rb @@ -136,6 +136,10 @@ 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}") diff --git a/test/fixtures/attributes.html.erb b/test/fixtures/attributes.html.erb new file mode 100644 index 0000000..68c1352 --- /dev/null +++ b/test/fixtures/attributes.html.erb @@ -0,0 +1,8 @@ +Responsive Image diff --git a/test/fixtures/attributes.html.expected.erb b/test/fixtures/attributes.html.expected.erb new file mode 100644 index 0000000..b2c55ff --- /dev/null +++ b/test/fixtures/attributes.html.expected.erb @@ -0,0 +1,7 @@ +Responsive Image