1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

Collect the left/right elements.

This commit is contained in:
Rob Rix 2015-12-03 10:20:02 -05:00
parent db0b5eca8f
commit f8f392262d

View File

@ -29,7 +29,9 @@ diffToRows :: Diff a Info -> String -> String -> [Row]
diffToRows (Free (Annotated (left, right) syntax)) = annotationAndSyntaxToRows (left, right) syntax
annotationAndSyntaxToRows :: (Info, Info) -> Syntax a (Diff a Info) -> String -> String -> [Row]
annotationAndSyntaxToRows (Info left _ leftCategories, Info right _ rightCategories) (Leaf _) before after = []
annotationAndSyntaxToRows (Info left _ leftCategories, Info right _ rightCategories) (Leaf _) before after = [] where
leftElements = Span (classify leftCategories) <$> lines (substring left before)
rightElements = Span (classify rightCategories) <$> lines (substring right after)
splitDiff :: Diff a Info -> String -> String -> Patch (HTML, Range)
splitDiff diff before after = iter toElements $ splitPatch before after <$> diff