- interpBlock :: BlockElement -> IO BlockElement
- interpBlock (List list) = interpList list >>= return . List
- interpBlock (DefinitionList defs) = mapM interpDefinition defs >>= return . DefinitionList
- interpBlock (Preformatted xs) = mapM interpInline xs >>= return . Preformatted
- interpBlock (Paragraph xs) = mapM interpInline xs >>= return . Paragraph
- interpBlock (Div attrs xs) = mapM interpBlock xs >>= return . Div attrs
- interpBlock (BlockCmd cmd) = interpBlockCmd cmd
- interpBlock others = return others
-
- interpList :: ListElement -> IO ListElement
- interpList list = do items <- mapM interpListItem (listItems list)
- return $ list { listItems = items }
-
- interpListItem :: ListItem -> IO ListItem
- interpListItem [] = return []
- interpListItem ((Left nested):xs) = do x <- interpList nested >>= return . Left
- xs <- interpListItem xs
- return (x:xs)
- interpListItem ((Right inline):xs) = do x <- interpInline inline >>= return . Right
- xs <- interpListItem xs
- return (x:xs)
-
- interpDefinition :: Definition -> IO Definition
- interpDefinition def = do term <- mapM interpInline (defTerm def)
- desc <- mapM interpInline (defDesc def)
- return $ def { defTerm = term, defDesc = desc }
-
- interpBlockCmd :: BlockCommand -> IO BlockElement
- interpBlockCmd cmd
+ interpBlockCmd :: BlockElement -> IO BlockElement
+ interpBlockCmd (BlockCmd cmd) = interpBlockCmd' cmd
+ interpBlockCmd others = return others
+
+ interpBlockCmd' :: BlockCommand -> IO BlockElement
+ interpBlockCmd' cmd