mirror of
https://github.com/github/semantic.git
synced 2024-12-23 14:54:16 +03:00
🔥 the Cost constraints.
This commit is contained in:
parent
e3eeb617a6
commit
590509aaf8
@ -53,7 +53,7 @@ splitPatchToClassName patch = stringValue $ "patch " <> case patch of
|
||||
SplitReplace _ -> "replace"
|
||||
|
||||
-- | Render a diff as an HTML split diff.
|
||||
split :: (HasField fields Category, HasField fields Cost, HasField fields Range) => Renderer (Record fields)
|
||||
split :: (HasField fields Category, HasField fields Range) => Renderer (Record fields)
|
||||
split diff blobs = TL.toStrict . renderHtml
|
||||
. docTypeHtml
|
||||
. ((head $ link ! A.rel "stylesheet" ! A.href "style.css") <>)
|
||||
@ -107,15 +107,15 @@ wrapIn f p = f p
|
||||
|
||||
-- Instances
|
||||
|
||||
instance (ToMarkup f, HasField fields Category, HasField fields Cost, HasField fields Range) => ToMarkup (Renderable (CofreeF (Syntax leaf) (Record fields) (f, Range))) where
|
||||
instance (ToMarkup f, HasField fields Category, HasField fields Range) => ToMarkup (Renderable (CofreeF (Syntax leaf) (Record fields) (f, Range))) where
|
||||
toMarkup (Renderable source (info :< syntax)) = classifyMarkup (category info) $ case syntax of
|
||||
Leaf _ -> span . string . toString $ slice (characterRange info) source
|
||||
_ -> ul . mconcat $ wrapIn li <$> contentElements source (characterRange info) (toList syntax)
|
||||
|
||||
instance (HasField fields Category, HasField fields Cost, HasField fields Range) => ToMarkup (Renderable (Term leaf (Record fields))) where
|
||||
instance (HasField fields Category, HasField fields Range) => ToMarkup (Renderable (Term leaf (Record fields))) where
|
||||
toMarkup (Renderable source term) = Prologue.fst $ cata (\ t -> (toMarkup $ Renderable source t, characterRange (headF t))) term
|
||||
|
||||
instance (HasField fields Category, HasField fields Cost, HasField fields Range) => ToMarkup (Renderable (SplitDiff leaf (Record fields))) where
|
||||
instance (HasField fields Category, HasField fields Range) => ToMarkup (Renderable (SplitDiff leaf (Record fields))) where
|
||||
toMarkup (Renderable source diff) = Prologue.fst . iter (\ t -> (toMarkup $ Renderable source t, characterRange (headF t))) $ toMarkupAndRange <$> diff
|
||||
where toMarkupAndRange patch = let term@(info :< _) = runCofree $ getSplitTerm patch in
|
||||
((div ! patchAttribute patch `withCostAttribute` maybeCost info) . toMarkup $ Renderable source (cofree term), characterRange info)
|
||||
|
Loading…
Reference in New Issue
Block a user