erb-formatter 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba78d2f06a198fd4f9af049e11a4f0ec92fcfa56e16688eaa65b3ea9253320ca
4
- data.tar.gz: 5d06c40737f856c445cf70fd530639e8876c60dad08d9fdc91acc12e42c9e086
3
+ metadata.gz: 9746e0224608b37531674e86d589b087a67875791440318536b7d55ec66c8548
4
+ data.tar.gz: 73b0639da80cba0761eb5b6a58270b32db5b146cca710b446ebae61737bba385
5
5
  SHA512:
6
- metadata.gz: 4997b2e942b1fe2ed3a0bf0b0e828ba7565090bf781508accd4d64540e90b986d7d0414534e066cd149d56d8d208342dd20c6ac1ba749498e03b080d4e799a10
7
- data.tar.gz: 59901e642196b0538e88379384d655a8f6a174007ba30fa7829b25db829cedbc8bcb94ef80e58b026e6223cc166fa442db798c84a18d38baecf5c36d63cee3cf
6
+ metadata.gz: d2658816da104a74d23952c1f59c70726c27668763ed94332914112fcd04e76c61ab95e738fea856c44e1f0bd72d0dae61d8ee7c6ec38d28abd927e91b970e56
7
+ data.tar.gz: 57a63692f5f533077df12677bbdf1dfa414ac564f897621d58fa08607e707d1af02fa9a78d7b0493e9340b27f046b2abee779758a0a6c8239e135abe3811da8b
@@ -3,5 +3,5 @@
3
3
  require 'erb'
4
4
 
5
5
  class ERB::Formatter
6
- VERSION = "0.5.0"
6
+ VERSION = "0.5.1"
7
7
  end
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|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erb-formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elia Schito