erb-formatter 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/erb/formatter/version.rb +1 -1
- data/lib/erb/formatter.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 360fdcbb367ec4e87072a757436ffceae053d2020bcf9b0f3b3d72d497f1687d
|
4
|
+
data.tar.gz: 78d63c4817533bc6d651dda6e48773e599907c9a7321ddbe6a718bd310fc4264
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ee0269dee3ad8e5c1240af3730bc0b166faf7581b801e771c81d7c69d121b0aed6abca7176e8cb746ac67a290ddd626484730dbb762c723ddad8a0180101f5a
|
7
|
+
data.tar.gz: 2ed97281f686c7d33f40f604003857e5c182a89a984a4bb23cd16ec7c65b3bfc9d8876f43fdaceac5012a0c3dec9b9508fb36cba1c8bc9b04b01926d36cf712d
|
data/lib/erb/formatter.rb
CHANGED
@@ -61,6 +61,7 @@ class ERB::Formatter
|
|
61
61
|
end.freeze
|
62
62
|
end
|
63
63
|
|
64
|
+
RUBY_STANDALONE_BLOCK = /\A(yield|next)\b/
|
64
65
|
RUBY_CLOSE_BLOCK = /\Aend\z/
|
65
66
|
RUBY_REOPEN_BLOCK = /\A(else|elsif\b(.*)|when\b(.*))\z/
|
66
67
|
|
@@ -306,6 +307,10 @@ class ERB::Formatter
|
|
306
307
|
erb_open << ' ' unless ruby_code.start_with?('#')
|
307
308
|
|
308
309
|
case ruby_code
|
310
|
+
when RUBY_STANDALONE_BLOCK
|
311
|
+
ruby_code = format_ruby(ruby_code, autoclose: false)
|
312
|
+
full_erb_tag = "#{erb_open}#{ruby_code} #{erb_close}"
|
313
|
+
html << (erb_pre_match.match?(/\s+\z/) ? indented(full_erb_tag) : full_erb_tag)
|
309
314
|
when RUBY_CLOSE_BLOCK
|
310
315
|
full_erb_tag = "#{erb_open}#{ruby_code} #{erb_close}"
|
311
316
|
tag_stack_pop('%erb%', ruby_code)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erb-formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elia Schito
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: syntax_tree
|