fixup! 68b47e4b64caec48783d8e001c5d58f6c9de9044

This commit is contained in:
Noah Hellman 2023-01-23 21:11:49 +01:00
parent 64c7678775
commit c02b13327c

View file

@ -305,6 +305,7 @@ impl<'s> TreeParser<'s> {
if let Some(OpenList { depth, .. }) = self.open_lists.last() { if let Some(OpenList { depth, .. }) = self.open_lists.last() {
assert!(usize::from(*depth) <= self.tree.depth()); assert!(usize::from(*depth) <= self.tree.depth());
if self.tree.depth() == (*depth).into() { if self.tree.depth() == (*depth).into() {
self.prev_blankline = false;
self.tree.exit(); // list self.tree.exit(); // list
self.open_lists.pop(); self.open_lists.pop();
} }
@ -1004,6 +1005,19 @@ mod test {
(Inline, "ab"), (Inline, "ab"),
(Exit(Leaf(Paragraph)), ""), (Exit(Leaf(Paragraph)), ""),
(Atom(Blankline), "\n"), (Atom(Blankline), "\n"),
(Exit(Container(ListItem(Unordered(b'+')))), "+"),
(
Exit(Container(List {
ty: Unordered(b'+'),
tight: true,
})),
"+",
),
(Exit(Container(ListItem(Unordered(b'-')))), "-"),
(Enter(Container(ListItem(Unordered(b'-')))), "-"),
(Enter(Leaf(Paragraph)), ""),
(Inline, "b"),
(Exit(Leaf(Paragraph)), ""),
(Exit(Container(ListItem(Unordered(b'-')))), "-"), (Exit(Container(ListItem(Unordered(b'-')))), "-"),
( (
Exit(Container(List { Exit(Container(List {
@ -1034,8 +1048,48 @@ mod test {
), ),
(Enter(Container(ListItem(Unordered(b'-')))), "-"), (Enter(Container(ListItem(Unordered(b'-')))), "-"),
(Enter(Leaf(Paragraph)), ""), (Enter(Leaf(Paragraph)), ""),
(Inline, "a"),
(Exit(Leaf(Paragraph)), ""),
(Atom(Blankline), "\n"),
(
Enter(Container(List {
ty: Unordered(b'+'),
tight: true,
})),
"+",
),
(Enter(Container(ListItem(Unordered(b'+')))), "+"),
(Enter(Leaf(Paragraph)), ""),
(Inline, "b"), (Inline, "b"),
(Exit(Leaf(Paragraph)), ""), (Exit(Leaf(Paragraph)), ""),
(Atom(Blankline), "\n"),
(
Enter(Container(List {
ty: Unordered(b'*'),
tight: true,
})),
"*",
),
(Enter(Container(ListItem(Unordered(b'*')))), "*"),
(Enter(Leaf(Paragraph)), ""),
(Inline, "c"),
(Exit(Leaf(Paragraph)), ""),
(Exit(Container(ListItem(Unordered(b'*')))), "*"),
(
Exit(Container(List {
ty: Unordered(b'*'),
tight: true,
})),
"*",
),
(Exit(Container(ListItem(Unordered(b'+')))), "+"),
(
Exit(Container(List {
ty: Unordered(b'+'),
tight: true,
})),
"+",
),
(Exit(Container(ListItem(Unordered(b'-')))), "-"), (Exit(Container(ListItem(Unordered(b'-')))), "-"),
( (
Exit(Container(List { Exit(Container(List {