inline: fix unclosed attrs after cont/verb

This commit is contained in:
Noah Hellman 2023-05-01 21:04:08 +02:00
parent 9d9aded764
commit 45c86da274

View file

@ -337,12 +337,14 @@ impl<'s> Parser<'s> {
matches!(t.kind, lex::Kind::Open(Delimiter::Brace)) matches!(t.kind, lex::Kind::Open(Delimiter::Brace))
}) })
{ {
return self.ahead_attributes( return self
AttributesElementType::Container { .ahead_attributes(
e_placeholder: event_opener - 1, AttributesElementType::Container {
}, e_placeholder: event_opener - 1,
false, },
); false,
)
.or(Some(Continue));
} }
} else { } else {
// continue verbatim // continue verbatim
@ -788,6 +790,7 @@ impl<'s> Parser<'s> {
}, },
false, false,
) )
.or(Some(Continue))
} else { } else {
closed closed
} }
@ -1573,6 +1576,28 @@ mod test {
); );
} }
#[test]
fn container_unclosed_attr() {
test_parse!(
"^.^{unclosed",
(Enter(Superscript), "^"),
(Str, "."),
(Exit(Superscript), "^"),
(Str, "{unclosed"),
);
}
#[test]
fn verbatim_unclosed_attr() {
test_parse!(
"`.`{unclosed",
(Enter(Verbatim), "`"),
(Str, "."),
(Exit(Verbatim), "`"),
(Str, "{unclosed"),
);
}
#[test] #[test]
fn container_unopened() { fn container_unopened() {
test_parse!("*}abc", (Str, "*}abc")); test_parse!("*}abc", (Str, "*}abc"));