started scaffolding out a new way to do lists

This commit is contained in:
Pagwin 2026-04-13 15:09:26 -04:00
parent aa69b3f6ef
commit ef61e282d2
No known key found for this signature in database
GPG key ID: 81137023740CA260

View file

@ -95,9 +95,41 @@ blockQuote attrs = do
space
manyTill anySingle $ lookAhead newline
newtype ListTypeEq = LTE ListType
instance Eq ListTypeEq where
(LTE (Ordered {style = s1})) == (LTE (Ordered {style = s2})) = s1 == s2
(LTE (Unordered {style = s1})) == (LTE (Unordered {style = s2})) = s1 == s2
_ == _ = False
listBlock :: (Logger m, Characters s) => Attrs -> Parser s m Element
listBlock attrs = do
error "todo"
(list_type, item) <- listItem
remaining_items <- many $ listItem' list_type
pure $ List (L {list_type, items = item : remaining_items}) attrs
where
listItem = do
list_type <- listMarker
first_line <- listLine $ pure ()
content <- some $ listLine $ notFollowedBy $ listMarker' list_type
error "todo"
-- any listMarker
-- can probably just use listMarker' via choice or smth like that
listMarker = error "todo"
-- listItem which must be of list_type
listItem' list_type = do
listMarker' list_type
first_line <- listLine $ pure ()
content <- some $ listLine $ notFollowedBy $ listMarker' list_type
error "todo"
-- listMarker which must be of list_type
listMarker' list_type = error "todo"
-- list line which must parse check before the rest of the line
listLine check = do
check
manyTill anySingle newline
taskListBlock :: (Logger m, Characters s) => Attrs -> Parser s m Element
taskListBlock attrs = do