mirror of
https://github.com/github/semantic.git
synced 2024-11-23 16:37:50 +03:00
Add a function to branches only.
This commit is contained in:
parent
0b89844b84
commit
7949048e13
@ -38,6 +38,7 @@ library
|
||||
build-depends: base >= 4.8 && < 5
|
||||
, bifunctors
|
||||
, blaze-html
|
||||
, blaze-markup
|
||||
, bytestring
|
||||
, c-storable-deriving
|
||||
, containers
|
||||
|
@ -15,6 +15,7 @@ import Range
|
||||
import Control.Monad.Free
|
||||
import Text.Blaze.Html
|
||||
import Text.Blaze.Html5 hiding (map)
|
||||
import qualified Text.Blaze.Internal as Blaze
|
||||
import qualified Text.Blaze.Html5.Attributes as A
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Text.Lazy as TL
|
||||
@ -103,6 +104,12 @@ instance ToMarkup f => ToMarkup (Renderable (Info, Syntax a (f, Range))) where
|
||||
where markupForSeparatorAndChild :: ToMarkup f => ([Markup], Int) -> (f, Range) -> ([Markup], Int)
|
||||
markupForSeparatorAndChild (rows, previous) (child, range) = (rows ++ [ string (toString $ slice (Range previous $ start range) source), toMarkup child ], end range)
|
||||
|
||||
wrapIn _ l@Blaze.Leaf{} = l
|
||||
wrapIn _ l@Blaze.CustomLeaf{} = l
|
||||
wrapIn _ l@Blaze.Content{} = l
|
||||
wrapIn _ l@Blaze.Comment{} = l
|
||||
wrapIn f p = f p
|
||||
|
||||
contentElements children = let (elements, previous) = foldl' markupForSeparatorAndChild ([], start range) children in
|
||||
elements ++ [ string . toString $ slice (Range previous $ end range) source ]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user