mirror of
https://github.com/github/semantic.git
synced 2025-01-01 11:46:14 +03:00
add text-icu
This commit is contained in:
parent
d4b41f8109
commit
e80bc4590d
@ -53,6 +53,7 @@ executable semantic-diff-exe
|
|||||||
, optparse-applicative
|
, optparse-applicative
|
||||||
, filepath
|
, filepath
|
||||||
, text >= 1.2.1.3
|
, text >= 1.2.1.3
|
||||||
|
, text-icu
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
default-extensions: OverloadedStrings
|
default-extensions: OverloadedStrings
|
||||||
extra-libraries: bridge
|
extra-libraries: bridge
|
||||||
@ -74,6 +75,7 @@ executable semantic-diff-profile
|
|||||||
, optparse-applicative
|
, optparse-applicative
|
||||||
, filepath
|
, filepath
|
||||||
, text >= 1.2.1.3
|
, text >= 1.2.1.3
|
||||||
|
, text-icu
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
default-extensions: OverloadedStrings
|
default-extensions: OverloadedStrings
|
||||||
extra-libraries: bridge
|
extra-libraries: bridge
|
||||||
|
@ -66,7 +66,7 @@ split diff before after = return . TL.toStrict . HText.renderHtml
|
|||||||
. (table ! A.class_ "diff")
|
. (table ! A.class_ "diff")
|
||||||
. mconcat $ toMarkup <$> (reverse $ foldl numberRows [] rows)
|
. mconcat $ toMarkup <$> (reverse $ foldl numberRows [] rows)
|
||||||
where
|
where
|
||||||
rows = fst $ diffToRows diff (0, 0) before after
|
rows = normalizedDiffToRows diff before after
|
||||||
|
|
||||||
numberRows :: [(Int, Line, Int, Line)] -> Row -> [(Int, Line, Int, Line)]
|
numberRows :: [(Int, Line, Int, Line)] -> Row -> [(Int, Line, Int, Line)]
|
||||||
numberRows [] (Row EmptyLine EmptyLine) = []
|
numberRows [] (Row EmptyLine EmptyLine) = []
|
||||||
@ -78,6 +78,9 @@ split diff before after = return . TL.toStrict . HText.renderHtml
|
|||||||
numberRows rows@((leftCount, _, rightCount, _):_) (Row EmptyLine right@(Line _)) = (leftCount, EmptyLine, rightCount + 1, right):rows
|
numberRows rows@((leftCount, _, rightCount, _):_) (Row EmptyLine right@(Line _)) = (leftCount, EmptyLine, rightCount + 1, right):rows
|
||||||
numberRows rows@((leftCount, _, rightCount, _):_) (Row left right) = (leftCount + 1, left, rightCount + 1, right):rows
|
numberRows rows@((leftCount, _, rightCount, _):_) (Row left right) = (leftCount + 1, left, rightCount + 1, right):rows
|
||||||
|
|
||||||
|
normalizedDiffToRows :: Diff a Info -> T.Text -> T.Text -> [Row]
|
||||||
|
normalizedDiffToRows diff before after = fst $ diffToRows diff (0, 0) before after
|
||||||
|
|
||||||
|
|
||||||
data Row = Row Line Line
|
data Row = Row Line Line
|
||||||
deriving Eq
|
deriving Eq
|
||||||
|
Loading…
Reference in New Issue
Block a user