1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 04:51:57 +03:00

Use choice for markdown assignment

This commit is contained in:
Timothy Clem 2017-11-20 13:45:52 -08:00
parent 031a187c79
commit fcf455f9b1

View File

@ -61,7 +61,16 @@ assignment = Syntax.handleError $ makeTerm <$> symbol Document <*> children (Mar
-- Block elements
blockElement :: Assignment
blockElement = paragraph <|> list <|> blockQuote <|> codeBlock <|> thematicBreak <|> htmlBlock <|> section <|> table
blockElement = choice
[ paragraph
, list
, blockQuote
, codeBlock
, thematicBreak
, htmlBlock
, section
, table
]
paragraph :: Assignment
paragraph = makeTerm <$> symbol Paragraph <*> children (Markup.Paragraph <$> many inlineElement)
@ -106,7 +115,18 @@ tableCell = makeTerm <$> symbol TableCell <*> children (Markup.TableCell <$> man
-- Inline elements
inlineElement :: Assignment
inlineElement = strong <|> emphasis <|> strikethrough <|> text <|> link <|> htmlInline <|> image <|> code <|> lineBreak <|> softBreak
inlineElement = choice
[ strong
, emphasis
, strikethrough
, text
, link
, htmlInline
, image
, code
, lineBreak
, softBreak
]
strong :: Assignment
strong = makeTerm <$> symbol Strong <*> children (Markup.Strong <$> many inlineElement)