File tree Expand file tree Collapse file tree 6 files changed +21
-5
lines changed Expand file tree Collapse file tree 6 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
66
77## [ Unreleased]
88
9+ ## [ 0.9.3] - 2023-06-30
10+
11+ - Print empty html-tags on one line if possible
12+
913## [ 0.9.2] - 2023-06-30
1014
1115- Handle whitespace in HTML-strings using ERB-tags
Original file line number Diff line number Diff line change 11PATH
22 remote: .
33 specs:
4- w_syntax_tree-erb (0.9.2 )
4+ w_syntax_tree-erb (0.9.3 )
55 prettier_print (>= 1.2.0 )
66 syntax_tree (>= 6.1.1 )
77
Original file line number Diff line number Diff line change @@ -49,7 +49,12 @@ def visit_block(node)
4949 end
5050
5151 def visit_html ( node )
52- visit_block ( node )
52+ # Make sure to group the tags together if there is no child nodes.
53+ if node . elements . size == 0
54+ q . group { visit_block ( node ) }
55+ else
56+ visit_block ( node )
57+ end
5358 end
5459
5560 def visit_erb_block ( node )
Original file line number Diff line number Diff line change 22
33module SyntaxTree
44 module ERB
5- VERSION = "0.9.2 "
5+ VERSION = "0.9.3 "
66 end
77end
Original file line number Diff line number Diff line change 4242 assign_c ||= "c"
4343%>
4444
45- < div class ="card mb-2 <%= condition ? "pb-3" : "pb-0" %> mt- <%= 5 * 5 %> ">
46- </ div >
45+ < div class ="card mb-2 <%= condition ? "pb-3" : "pb-0" %> mt- <%= 5 * 5 %> "> </ div >
Original file line number Diff line number Diff line change @@ -89,5 +89,13 @@ def test_html_attribute_without_quotes
8989 formatted = ERB . format ( source )
9090 assert_equal ( "<div class=\" card\" >\n Hello World\n </div>\n " , formatted )
9191 end
92+
93+ def test_html_attribute_without_content
94+ source = "<component-without-content>\n </component-without-content>\n "
95+ expected = "<component-without-content></component-without-content>\n "
96+
97+ formatted = ERB . format ( source )
98+ assert_equal ( expected , formatted )
99+ end
92100 end
93101end
You can’t perform that action at this time.
0 commit comments