w_syntax_tree-erb 0.10.4 → 0.10.5

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: 5da234530c78c55f3594957cdf44e380ed603b92e52c023df68f015d0d8c7f45
4
- data.tar.gz: 99b3b25d533a09e6337cc552c5f6d9224e977586272afb4c358df277e08c09eb
3
+ metadata.gz: d75bcbb66fc50b3559fa73a7ecb906aaa208a16bf041ae95793aed008bdd60f6
4
+ data.tar.gz: d2f882155d6e2ab774de0367586926c853a367c55123f7bc05edebebbba9fe6d
5
5
  SHA512:
6
- metadata.gz: a408ef26dd34ae012f516224090d65eea520b795c7a50080a8ed603b09095bc0eb7198e97b0ea7d75b9d113896344496cf1854442bf3ee9eab276e2437e86893
7
- data.tar.gz: dbd2ff290949bc982fe16b7c3153ae01b09adfd8d4fd9e710cca7b6a3dce19646b770274cd00f0438d42ca3daa7a89b824411a9624db98e4aff13b014db03478
6
+ metadata.gz: d7e9cc9b0c675244216ffd52db0751ee59b6ba79af00cb2b56ff955e351aa51c5a5d25d2737084283fa00707d51f4fb38fb7b6bbddf0c6bcc9f2831afd1fe9e1
7
+ data.tar.gz: 2cd81b89e3ebdd1b1010f7c7509c9ef9a81eacf30d2285c34c36d3a97b7e86cb8d7d4f460ea3a7ba2ad1dd333b2e2e6a709056d328ff373b8692218701892d57
@@ -8,7 +8,7 @@ assignees: davidwessman
8
8
  ---
9
9
 
10
10
  <details>
11
- <summary>ERB-snippet</summary
11
+ <summary>ERB-snippet</summary>
12
12
 
13
13
  ```html
14
14
  <% code %>
@@ -16,14 +16,14 @@ assignees: davidwessman
16
16
  </details>
17
17
 
18
18
  <details>
19
- <summary>Expected formatting</summary
19
+ <summary>Expected formatting</summary>
20
20
 
21
21
  ```html
22
22
  <% code %>
23
23
  ```
24
24
  </details>
25
25
  <details>
26
- <summary>Actual formatting</summary
26
+ <summary>Actual formatting</summary>
27
27
 
28
28
  ```html
29
29
  <% code %>
data/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.10.5] - 2023-09-03
10
+
11
+ - Handle ERB-tags inside HTML-tags, like `<div <%= "class='foo'" %>>`
12
+ - Handles indentation for multiline ERB-comment
13
+ - Handles spaces between do-arguments and ERB-tags
14
+
9
15
  ## [0.10.4] - 2023-08-28
10
16
 
11
17
  - Avoid grouping single tags
@@ -103,7 +109,8 @@ Output:
103
109
  - Can format a lot of .html.erb-syntax and works as a plugin to syntax_tree.
104
110
  - This is still early and there are a lot of different weird syntaxes out there.
105
111
 
106
- [unreleased]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.4...HEAD
112
+ [unreleased]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.5...HEAD
113
+ [0.10.5]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.4...v0.10.5
107
114
  [0.10.4]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.3...v0.10.4
108
115
  [0.10.3]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.2...v0.10.3
109
116
  [0.10.2]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.1...v0.10.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- w_syntax_tree-erb (0.10.4)
4
+ w_syntax_tree-erb (0.10.5)
5
5
  prettier_print (~> 1.2, >= 1.2.0)
6
6
  syntax_tree (~> 6.1, >= 6.1.1)
7
7
 
@@ -121,7 +121,10 @@ module SyntaxTree
121
121
  end
122
122
 
123
123
  def visit_erb_do_close(node)
124
- visit(node.closing)
124
+ closing = node.closing.value.end_with?("-%>") ? "-%>" : "%>"
125
+ q.text(node.closing.value.gsub(closing, "").rstrip)
126
+ q.text(" ")
127
+ q.text(closing)
125
128
  end
126
129
 
127
130
  def visit_erb_close(node)
@@ -236,7 +239,9 @@ module SyntaxTree
236
239
  end
237
240
 
238
241
  def visit_erb_comment(node)
239
- visit(node.token)
242
+ q.seplist(node.token.value.split("\n"), -> { q.breakable }) do |line|
243
+ q.text(line.lstrip)
244
+ end
240
245
  end
241
246
 
242
247
  # Visit a CharData node.
@@ -368,10 +368,17 @@ module SyntaxTree
368
368
  def parse_html_opening_tag
369
369
  opening = consume(:open)
370
370
  name = consume(:name)
371
+
371
372
  if name.value =~ /\A[@:#]/
372
373
  raise ParseError, "Invalid html-tag name #{name}"
373
374
  end
374
- attributes = many { parse_html_attribute }
375
+
376
+ attributes =
377
+ many do
378
+ atleast do
379
+ maybe { parse_erb_tag } || maybe { parse_html_attribute }
380
+ end
381
+ end
375
382
 
376
383
  closing =
377
384
  atleast do
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SyntaxTree
4
4
  module ERB
5
- VERSION = "0.10.4"
5
+ VERSION = "0.10.5"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: w_syntax_tree-erb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.4
4
+ version: 0.10.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Newton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-08-28 00:00:00.000000000 Z
12
+ date: 2023-09-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: prettier_print
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
161
  requirements: []
162
- rubygems_version: 3.4.10
162
+ rubygems_version: 3.4.19
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: Syntax Tree support for ERB