erb-formatter 0.4.0 → 0.4.2
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 +6 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddc79db481ece2c7a1a3c3dedbce6f65f176ad045805125cbd997fdaf5f4fb11
|
4
|
+
data.tar.gz: e27fe52c37feb8fe80386af2fb0083a5b6398a9319189ec0baec5251db4a1a31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e08e5783a5315111f5bbe0acc0f8d819b7e8b80f0a6626ec6283006441005dcba10526282ea6d331b54e7e6fc56c8a24cecb93c235f11b2394448195cf2f264
|
7
|
+
data.tar.gz: 5ca38f5fd851e57056a87490d5f668a0fa2a9374e6ff46cf0efe7b6cb39af0dc813e0026cee9bf7fc57f99a86833c5385979e1b0bd8c2d03a7d83f969daf494f
|
data/lib/erb/formatter.rb
CHANGED
@@ -222,6 +222,8 @@ class ERB::Formatter
|
|
222
222
|
|
223
223
|
def format_text(text)
|
224
224
|
p format_text: text if @debug
|
225
|
+
return unless text
|
226
|
+
|
225
227
|
starting_space = text.match?(/\A\s/)
|
226
228
|
|
227
229
|
final_newlines_count = text.match(/(\s*)\z/m).captures.last.count("\n")
|
@@ -264,8 +266,9 @@ class ERB::Formatter
|
|
264
266
|
SyntaxTree::Command.prepend SyntaxTreeCommandPatch
|
265
267
|
|
266
268
|
code = begin
|
267
|
-
SyntaxTree.format(code)
|
268
|
-
rescue SyntaxTree::Parser::ParseError
|
269
|
+
SyntaxTree.format(code, @line_width)
|
270
|
+
rescue SyntaxTree::Parser::ParseError => error
|
271
|
+
p RUBY_PARSE_ERROR: error if @debug
|
269
272
|
code
|
270
273
|
end
|
271
274
|
|
@@ -289,7 +292,7 @@ class ERB::Formatter
|
|
289
292
|
if erb_scanner.scan_until(erb_tags_regexp)
|
290
293
|
p PRE_MATCH: [erb_pre_pos, '..', erb_scanner.pre_match] if @debug
|
291
294
|
erb_pre_match = erb_scanner.pre_match
|
292
|
-
erb_pre_match = erb_pre_match[erb_pre_pos..]
|
295
|
+
erb_pre_match = erb_pre_match[erb_pre_pos..].to_s
|
293
296
|
erb_pre_pos = erb_scanner.pos
|
294
297
|
|
295
298
|
erb_code = erb_tags[erb_scanner.captures.first]
|
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.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elia Schito
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: syntax_tree
|
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
requirements: []
|
71
|
-
rubygems_version: 3.
|
71
|
+
rubygems_version: 3.4.5
|
72
72
|
signing_key:
|
73
73
|
specification_version: 4
|
74
74
|
summary: Format ERB files with speed and precision.
|