erb-formatter 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/erb/formatter/version.rb +1 -1
- data/lib/erb/formatter.rb +9 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9746e0224608b37531674e86d589b087a67875791440318536b7d55ec66c8548
|
4
|
+
data.tar.gz: 73b0639da80cba0761eb5b6a58270b32db5b146cca710b446ebae61737bba385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2658816da104a74d23952c1f59c70726c27668763ed94332914112fcd04e76c61ab95e738fea856c44e1f0bd72d0dae61d8ee7c6ec38d28abd927e91b970e56
|
7
|
+
data.tar.gz: 57a63692f5f533077df12677bbdf1dfa414ac564f897621d58fa08607e707d1af02fa9a78d7b0493e9340b27f046b2abee779758a0a6c8239e135abe3811da8b
|
data/lib/erb/formatter.rb
CHANGED
@@ -124,15 +124,21 @@ class ERB::Formatter
|
|
124
124
|
|
125
125
|
attrs.scan(ATTR).flatten.each do |attr|
|
126
126
|
attr.strip!
|
127
|
-
full_attr = indented(attr)
|
128
127
|
name, value = attr.split('=', 2)
|
129
128
|
|
129
|
+
if value.nil?
|
130
|
+
attr_html << indented("#{name}")
|
131
|
+
next
|
132
|
+
end
|
133
|
+
|
134
|
+
value_parts = value[1...-1].strip.split(/\s+/)
|
135
|
+
|
136
|
+
full_attr = indented("#{name}=#{value[0]}#{value_parts.join(" ")}#{value[-1]}")
|
137
|
+
|
130
138
|
if full_attr.size > line_width && MULTILINE_ATTR_NAMES.include?(name) && attr.match?(QUOTED_ATTR)
|
131
139
|
attr_html << indented("#{name}=#{value[0]}")
|
132
140
|
tag_stack_push('attr"', value)
|
133
141
|
|
134
|
-
value_parts = value[1...-1].strip.split(/\s+/)
|
135
|
-
|
136
142
|
if !@single_class_per_line && name == 'class'
|
137
143
|
line = value_parts.shift
|
138
144
|
value_parts.each do |value_part|
|