1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 09:15:01 +03:00

Use the right categories on the right side.

This commit is contained in:
Rob Rix 2015-12-04 10:01:52 -05:00
parent e6c96ed60b
commit 4fe345086d

View File

@ -27,8 +27,8 @@ split _ _ _ = return mempty
data Row = Row [HTML] [HTML]
deriving (Eq, Show)
bimap :: ([HTML] -> HTML) -> Row -> Row
bimap f (Row a b) = Row [ f a ] [ f b ]
bimap :: ([HTML] -> HTML) -> ([HTML] -> HTML) -> Row -> Row
bimap f g (Row a b) = Row [ f a ] [ g b ]
instance Monoid Row where
mempty = Row [] []
@ -44,7 +44,7 @@ annotatedToRows (Annotated (Info left _ leftCategories, Info right _ rightCatego
leftElements = Span (classify leftCategories) <$> lines (substring left before)
rightElements = Span (classify rightCategories) <$> lines (substring right after)
annotatedToRows (Annotated (Info left _ leftCategories, Info right _ rightCategories) (Indexed i)) before after = (bimap (Ul $ classify leftCategories) <$> rows, left, right)
annotatedToRows (Annotated (Info left _ leftCategories, Info right _ rightCategories) (Indexed i)) before after = (bimap (Ul $ classify leftCategories) (Ul $ classify rightCategories) <$> rows, left, right)
where
rows = snd $ foldl sumRows ((start left, start right), []) i
sumRows ((previousLeft, previousRight), rows) child = ((end left, end right), rows ++ contextRows ++ childRows)