1
1
mirror of https://github.com/github/semantic.git synced 2025-01-06 06:46:07 +03:00

Add a function to render numbered lines to markup with indication of changes.

This commit is contained in:
Rob Rix 2015-12-22 17:55:30 -05:00
parent b89218a944
commit e974ea43af

View File

@ -45,6 +45,9 @@ split diff before after = return . renderHtml
columnWidth = max (20 + digits maxNumber * 8) 40
numberedLinesToMarkup :: (Int, Line (SplitDiff a Info), Int, Line (SplitDiff a Info)) -> Markup
numberedLinesToMarkup (m, left, n, right) = tr $ toMarkup (foldl (||) False $ hasChanges <$> unLine left, m, renderable before left) <> toMarkup (foldl (||) False $ hasChanges <$> unLine right, n, renderable after right) <> string "\n"
renderable source = fmap (Renderable . (,) source)
hasChanges diff = foldl (||) False $ const True <$> diff