1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 15:35:14 +03:00

Add a function which appends an element onto the last line of a list of HTML lines.

This commit is contained in:
Rob Rix 2015-12-02 16:36:02 -05:00
parent 0bf32bc50f
commit 5523a89eb5

View File

@ -66,5 +66,9 @@ splitHTMLIntoLines (Span className string) = Span className <$> lines string
splitHTMLIntoLines (Ul className children) = Ul className . splitHTMLIntoLines <$> children
splitHTMLIntoLines (Dt string) = [ Dt string ]
appendOntoLastLine :: HTML -> [[HTML]] -> [[HTML]]
appendOntoLastLine line [ x ] = [ line : x ]
appendOntoLastLine line (x : xs) = x : appendOntoLastLine line xs
classify :: Set.Set Category -> Maybe ClassName
classify = foldr (const . Just) Nothing