mirror of
https://github.com/github/semantic.git
synced 2025-01-05 05:58:34 +03:00
Extract function instead of lambda
This commit is contained in:
parent
57dd145dc2
commit
94690bebaf
@ -135,7 +135,8 @@ class CustomHasDeclaration syntax where
|
|||||||
instance CustomHasDeclaration Markdown.Heading where
|
instance CustomHasDeclaration Markdown.Heading where
|
||||||
customToDeclaration Blob{..} ann (Markdown.Heading level terms _)
|
customToDeclaration Blob{..} ann (Markdown.Heading level terms _)
|
||||||
= Just $ HeadingDeclaration (headingText terms) level
|
= Just $ HeadingDeclaration (headingText terms) level
|
||||||
where headingText terms = getSource $ maybe (byteRange ann) sconcat (nonEmpty (fmap (\ (Term (In ann _), _) -> (byteRange ann)) (toList terms)))
|
where headingText terms = getSource $ maybe (byteRange ann) sconcat (nonEmpty (headingByteRange <$> toList terms))
|
||||||
|
headingByteRange (Term (In ann _), _) = byteRange ann
|
||||||
getSource = firstLine . toText . flip Source.slice blobSource
|
getSource = firstLine . toText . flip Source.slice blobSource
|
||||||
firstLine = T.takeWhile (/= '\n')
|
firstLine = T.takeWhile (/= '\n')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user