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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4d4aa4df0dfb6331993b2586513da76d3c4bb9443f536e5738adf68ef1cbb37
4
- data.tar.gz: 0d6a144fd792f2eb78fb6a7112f49e330aae42a6c4b5de0b3b2fe42f6fb513d6
3
+ metadata.gz: 360fdcbb367ec4e87072a757436ffceae053d2020bcf9b0f3b3d72d497f1687d
4
+ data.tar.gz: 78d63c4817533bc6d651dda6e48773e599907c9a7321ddbe6a718bd310fc4264
5
5
  SHA512:
6
- metadata.gz: 5db13cddb929dec25486feafd48261068365d4f6847e514ec1c99df903d45bd036e4fa82b54c4de08534af079e8d1dd7c879c282595cb2f539b0e07a44fda135
7
- data.tar.gz: 4bacbaecf5078bc4fc43c89cdc183a5883522a23e015a7642fc6b56384bfa34440585a1afb7964e8643db2492d325994eaf6f0d41d2f790a4ddfd81add43e774
6
+ metadata.gz: 0ee0269dee3ad8e5c1240af3730bc0b166faf7581b801e771c81d7c69d121b0aed6abca7176e8cb746ac67a290ddd626484730dbb762c723ddad8a0180101f5a
7
+ data.tar.gz: 2ed97281f686c7d33f40f604003857e5c182a89a984a4bb23cd16ec7c65b3bfc9d8876f43fdaceac5012a0c3dec9b9508fb36cba1c8bc9b04b01926d36cf712d
@@ -3,5 +3,5 @@
3
3
  require 'erb'
4
4
 
5
5
  class ERB::Formatter
6
- VERSION = "0.7.2"
6
+ VERSION = "0.7.3"
7
7
  end
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.2
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-02-26 00:00:00.000000000 Z
11
+ date: 2024-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: syntax_tree