Skip to content

Commit

Permalink
chore(GLEAM-3256): initial state for reproduction
Browse files Browse the repository at this point in the history
  • Loading branch information
mscharley committed Jun 10, 2024
1 parent a6c970f commit c90f669
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/commonmark/internal/parser.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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,
)
}
}
}

Expand Down

0 comments on commit c90f669

Please sign in to comment.