File tree Expand file tree Collapse file tree 5 files changed +19
-4
lines changed Expand file tree Collapse file tree 5 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
66
77## [ Unreleased]
88
9+ ## [ 0.10.5] - 2023-09-03
10+
911- Handle ERB-tags inside HTML-tags, like ` <div <%= "class='foo'" %>> `
1012- Handles indentation for multiline ERB-comment
13+ - Handles spaces between do-arguments and ERB-tags
1114
1215## [ 0.10.4] - 2023-08-28
1316
@@ -106,7 +109,8 @@ Output:
106109- Can format a lot of .html.erb-syntax and works as a plugin to syntax_tree.
107110- This is still early and there are a lot of different weird syntaxes out there.
108111
109- [ 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
110114[ 0.10.4 ] : https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.3...v0.10.4
111115[ 0.10.3 ] : https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.2...v0.10.3
112116[ 0.10.2 ] : https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.1...v0.10.2
Original file line number Diff line number Diff line change 11PATH
22 remote: .
33 specs:
4- w_syntax_tree-erb (0.10.4 )
4+ w_syntax_tree-erb (0.10.5 )
55 prettier_print (~> 1.2 , >= 1.2.0 )
66 syntax_tree (~> 6.1 , >= 6.1.1 )
77
Original file line number Diff line number Diff line change @@ -121,7 +121,10 @@ def visit_erb(node)
121121 end
122122
123123 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 )
125128 end
126129
127130 def visit_erb_close ( node )
Original file line number Diff line number Diff line change 22
33module SyntaxTree
44 module ERB
5- VERSION = "0.10.4 "
5+ VERSION = "0.10.5 "
66 end
77end
Original file line number Diff line number Diff line change @@ -139,6 +139,14 @@ def test_erb_whitespace
139139 assert_formatting ( source , expected )
140140 end
141141
142+ def test_erb_block_do_arguments
143+ source = "<%= link_to(url) do |link, other_arg|%>Whaaaaaaat<% end %>"
144+ expected =
145+ "<%= link_to(url) do |link, other_arg| %>\n Whaaaaaaat\n <% end %>\n "
146+
147+ assert_formatting ( source , expected )
148+ end
149+
142150 def test_erb_newline
143151 source = "<%= what if this %>\n <h1>hej</h1>"
144152 expected = "<%= what if this %>\n <h1>hej</h1>\n "
You can’t perform that action at this time.
0 commit comments