Skip to content

Commit

Permalink
Merge pull request #100 from annettemmm/unescape-haml
Browse files Browse the repository at this point in the history
keep unescape script node when child of tag
  • Loading branch information
kddnewton authored Feb 6, 2024
2 parents 12dfde9 + e9f161c commit 3b32452
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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

0 comments on commit 3b32452

Please sign in to comment.