1
1
mirror of https://github.com/github/semantic.git synced 2025-01-05 05:58:34 +03:00

Define toMarkup for Renderable terms via the Renderable syntax instance.

This commit is contained in:
Rob Rix 2015-12-22 11:28:20 -05:00
parent 0c7a59f9c9
commit 0af18aa16d

View File

@ -146,6 +146,8 @@ instance ToMarkup f => ToMarkup (Renderable (Info, Syntax a (f, Range))) where
contentElements children = let (elements, previous) = foldl markupForSeparatorAndChild ([], start range) children in
elements ++ [ string $ substring (Range previous $ end range) source ]
instance ToMarkup (Renderable (Term a Info)) where
toMarkup (Renderable (source, term)) = fst $ cata (\ info@(Info range _) syntax -> (toMarkup $ Renderable (source, (info, syntax)), range)) term
instance ToMarkup (Renderable (SplitDiff a Info)) where
toMarkup (Renderable (source, Pure term)) = toMarkup (Renderable (source, term))