Skip to content

Commit 7f122c8

Browse files
committed
Also ignore html block
1 parent 43378a6 commit 7f122c8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

parser/src/ignore_block.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ impl IgnoreBlocks {
3333
}
3434
}
3535
}
36+
} else if let Event::Start(Tag::HtmlBlock) = event {
37+
let start = range.start;
38+
while let Some((event, range)) = parser.next() {
39+
if let Event::End(TagEnd::HtmlBlock) = event {
40+
ignore.push(start..range.end);
41+
break;
42+
}
43+
}
3644
} else if let Event::InlineHtml(_) = event {
3745
ignore.push(range);
3846
} else if let Event::Code(_) = event {
@@ -253,3 +261,24 @@ fn cbs_11() {
253261
],
254262
);
255263
}
264+
265+
#[test]
266+
fn cbs_12() {
267+
assert_eq!(
268+
bodies(
269+
"
270+
Test
271+
272+
<!-- Test -->
273+
<!--
274+
This is an HTML comment.
275+
-->
276+
"
277+
),
278+
[
279+
Ignore::No("\nTest\n\n"),
280+
Ignore::Yes("<!-- Test -->\n"),
281+
Ignore::Yes("<!--\nThis is an HTML comment.\n-->\n")
282+
],
283+
);
284+
}

0 commit comments

Comments
 (0)