Skip to content

Commit

Permalink
Also ignore html block
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed Dec 18, 2024
1 parent 43378a6 commit 7f122c8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions parser/src/ignore_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ impl IgnoreBlocks {
}
}
}
} else if let Event::Start(Tag::HtmlBlock) = event {
let start = range.start;
while let Some((event, range)) = parser.next() {
if let Event::End(TagEnd::HtmlBlock) = event {
ignore.push(start..range.end);
break;
}
}
} else if let Event::InlineHtml(_) = event {
ignore.push(range);
} else if let Event::Code(_) = event {
Expand Down Expand Up @@ -253,3 +261,24 @@ fn cbs_11() {
],
);
}

#[test]
fn cbs_12() {
assert_eq!(
bodies(
"
Test
<!-- Test -->
<!--
This is an HTML comment.
-->
"
),
[
Ignore::No("\nTest\n\n"),
Ignore::Yes("<!-- Test -->\n"),
Ignore::Yes("<!--\nThis is an HTML comment.\n-->\n")
],
);
}

0 comments on commit 7f122c8

Please sign in to comment.