Skip to content

Commit e9f161c

Browse files
author
hogrammer
committed
keep unescape script node when child
1 parent 12dfde9 commit e9f161c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/syntax_tree/haml/format.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def initialize(
1616
.lines
1717
.each
1818
.with_index(1) do |line, index|
19-
@literal_lines[index] = line.rstrip if line.start_with?("!")
19+
@literal_lines[index] = line.strip if line.lstrip.start_with?("!")
2020
end
2121

2222
super(source, *rest, options: options)

test/script_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@ def test_preserve_escape_html
2222
def test_unescape
2323
assert_format("!= hello")
2424
end
25+
26+
def test_child_unescape
27+
assert_format(<<~HAML)
28+
.container
29+
!= hello
30+
HAML
31+
end
2532
end

0 commit comments

Comments
 (0)