Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
keep unescape script node when child
  • Loading branch information
hogrammer committed Feb 6, 2024
commit e9f161c7f5f72ba4c7dbd23e17b087d3dd27f5fb
2 changes: 1 addition & 1 deletion lib/syntax_tree/haml/format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def initialize(
.lines
.each
.with_index(1) do |line, index|
@literal_lines[index] = line.rstrip if line.start_with?("!")
@literal_lines[index] = line.strip if line.lstrip.start_with?("!")
end

super(source, *rest, options: options)
Expand Down
7 changes: 7 additions & 0 deletions test/script_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@ def test_preserve_escape_html
def test_unescape
assert_format("!= hello")
end

def test_child_unescape
assert_format(<<~HAML)
.container
!= hello
HAML
end
end