1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 16:33:03 +03:00

Add a renderLine convenience.

This commit is contained in:
Rob Rix 2016-02-29 11:30:32 -05:00
parent 5b5f22711a
commit ed48c7f427

View File

@ -81,6 +81,9 @@ split diff blobs = renderHtml
numberedLinesToMarkup :: (Int, Line (SplitDiff a Info), Int, Line (SplitDiff a Info)) -> Markup
numberedLinesToMarkup (m, left, n, right) = tr $ toMarkup (or $ hasChanges <$> left, m, renderable before left) <> toMarkup (or $ hasChanges <$> right, n, renderable after right) <> string "\n"
renderLine :: (Int, Line (SplitDiff leaf Info)) -> Source Char -> Markup
renderLine (number, line) source = toMarkup (or $ hasChanges <$> line, number, renderable source line)
renderable source = fmap (Renderable . (,) source)
hasChanges diff = or $ const True <$> diff