fixup! 6a1fcf07cc01a64ab2665cbe249bc5b047869e37

This commit is contained in:
Noah Hellman 2023-01-21 12:33:41 +01:00
parent 73baa48706
commit 7a5ef1e695

View file

@ -90,9 +90,9 @@ pub enum Container {
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ListType { pub enum ListType {
Bullet(u8), Unordered(u8),
Task,
Ordered(crate::OrderedListNumbering, crate::OrderedListStyle), Ordered(crate::OrderedListNumbering, crate::OrderedListStyle),
Task,
Description, Description,
} }
@ -320,7 +320,7 @@ impl BlockParser {
(Block::Container(ListItem(Task)), Span::by_len(start, 5)) (Block::Container(ListItem(Task)), Span::by_len(start, 5))
} else { } else {
( (
Block::Container(ListItem(Bullet(b as u8))), Block::Container(ListItem(Unordered(b as u8))),
Span::by_len(start, 1), Span::by_len(start, 1),
) )
} }
@ -345,9 +345,9 @@ impl BlockParser {
) )
}) })
} }
c => maybe_ordered_list_item(c, &mut chars).map(|(num, fmt, len)| { c => maybe_ordered_list_item(c, &mut chars).map(|(num, style, len)| {
( (
Block::Container(ListItem(Ordered(num, fmt))), Block::Container(ListItem(Ordered(num, style))),
Span::by_len(start, len), Span::by_len(start, len),
) )
}), }),
@ -763,11 +763,11 @@ mod test {
fn parse_list() { fn parse_list() {
test_parse!( test_parse!(
"- abc\n", "- abc\n",
(Enter(Container(ListItem(Bullet(b'-')))), "-"), (Enter(Container(ListItem(Unordered(b'-')))), "-"),
(Enter(Leaf(Paragraph)), ""), (Enter(Leaf(Paragraph)), ""),
(Inline, "abc"), (Inline, "abc"),
(Exit(Leaf(Paragraph)), ""), (Exit(Leaf(Paragraph)), ""),
(Exit(Container(ListItem(Bullet(b'-')))), "-"), (Exit(Container(ListItem(Unordered(b'-')))), "-"),
); );
} }
@ -937,9 +937,24 @@ mod test {
#[test] #[test]
fn block_list_bullet() { fn block_list_bullet() {
test_block!("- abc\n", Block::Container(ListItem(Bullet(b'-'))), "-", 1); test_block!(
test_block!("+ abc\n", Block::Container(ListItem(Bullet(b'+'))), "+", 1); "- abc\n",
test_block!("* abc\n", Block::Container(ListItem(Bullet(b'*'))), "*", 1); Block::Container(ListItem(Unordered(b'-'))),
"-",
1
);
test_block!(
"+ abc\n",
Block::Container(ListItem(Unordered(b'+'))),
"+",
1
);
test_block!(
"* abc\n",
Block::Container(ListItem(Unordered(b'*'))),
"*",
1
);
} }
#[test] #[test]