From c90f66907db08be65c9924a592e8fa3f79a6a39a Mon Sep 17 00:00:00 2001 From: Matthew Scharley Date: Tue, 11 Jun 2024 06:40:25 +1000 Subject: [PATCH] chore(GLEAM-3256): initial state for reproduction --- src/commonmark/internal/parser.gleam | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/commonmark/internal/parser.gleam b/src/commonmark/internal/parser.gleam index 6497f66..c5a53e2 100644 --- a/src/commonmark/internal/parser.gleam +++ b/src/commonmark/internal/parser.gleam @@ -21,6 +21,13 @@ type BlockState { IndentedCodeBlockBuilder(List(String)) BlockQuoteBuilder(List(String)) UnorderedListBuilder(List(String), List(List(BlockParseState)), String, Int) + OrderedListBuilder( + List(String), + List(List(BlockParseState)), + String, + Int, + Int, + ) } type InlineState { @@ -35,6 +42,7 @@ pub opaque type BlockParseState { CodeBlock(Option(String), Option(String), String) BlockQuote(List(BlockParseState)) UnorderedList(List(List(BlockParseState)), ast.UnorderedListMarker) + OrderedList(List(List(BlockParseState)), ast.OrderedListMarker) } fn ol_marker(marker: String) -> ast.OrderedListMarker { @@ -192,6 +200,21 @@ pub fn parse_block_state(state: BlockParseState) -> ast.BlockNode { marker, ) } + OrderedList(items, marker, start) -> { + let tight = True + + ast.OrderedList( + items + |> list.map(list.map(_, parse_block_state(_))) + |> list.map(fn(l) { + case tight { + True -> ast.TightListItem(l) + False -> ast.ListItem(l) + } + }), + marker, + ) + } } }