mirror of
https://github.com/github/semantic.git
synced 2024-12-28 09:21:35 +03:00
Assign images.
This commit is contained in:
parent
046fec7f26
commit
b5a7b90d69
@ -73,3 +73,9 @@ data Link a = Link { linkURL :: ByteString, linkTitle :: ByteString }
|
||||
|
||||
instance Eq1 Link where liftEq = genericLiftEq
|
||||
instance Show1 Link where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data Image a = Image { imageURL :: ByteString, imageTitle :: ByteString }
|
||||
deriving (Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable)
|
||||
|
||||
instance Eq1 Image where liftEq = genericLiftEq
|
||||
instance Show1 Image where liftShowsPrec = genericLiftShowsPrec
|
||||
|
@ -29,6 +29,7 @@ type Syntax =
|
||||
, Markup.UnorderedList
|
||||
-- Inline elements
|
||||
, Markup.Emphasis
|
||||
, Markup.Image
|
||||
, Markup.Link
|
||||
, Markup.Strong
|
||||
, Markup.Text
|
||||
@ -71,7 +72,7 @@ blockQuote = makeTerm <$> symbol BlockQuote <*> children (Markup.BlockQuote <$>
|
||||
-- Inline elements
|
||||
|
||||
inlineElement :: Assignment
|
||||
inlineElement = strong <|> emphasis <|> text <|> link
|
||||
inlineElement = strong <|> emphasis <|> text <|> link <|> image
|
||||
|
||||
strong :: Assignment
|
||||
strong = makeTerm <$> symbol Strong <*> children (Markup.Strong <$> many inlineElement)
|
||||
@ -85,6 +86,9 @@ text = makeTerm <$> symbol Text <*> (Markup.Text <$> source)
|
||||
link :: Assignment
|
||||
link = makeTerm <$> symbol Link <*> (uncurry Markup.Link <$> project (\ (((CMark.LINK url title) :. _) :< _) -> (toS url, toS title))) <* source
|
||||
|
||||
image :: Assignment
|
||||
image = makeTerm <$> symbol Image <*> (uncurry Markup.Image <$> project (\ (((CMark.IMAGE url title) :. _) :< _) -> (toS url, toS title))) <* source
|
||||
|
||||
|
||||
-- Implementation details
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user