diff options
Diffstat (limited to 'app/History/PartialCommitInfo.hs')
-rw-r--r-- | app/History/PartialCommitInfo.hs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/app/History/PartialCommitInfo.hs b/app/History/PartialCommitInfo.hs index 21a890a..6d93e88 100644 --- a/app/History/PartialCommitInfo.hs +++ b/app/History/PartialCommitInfo.hs @@ -4,7 +4,7 @@ module History.PartialCommitInfo ) where -import Control.Arrow (second) +import CMark qualified as D import Control.Exception (catch, handle) import Data.Binary (Binary) import Data.ByteString.Lazy.Char8 qualified as LB8 @@ -19,11 +19,13 @@ import Git qualified import History.Cache (cached) import History.CommitHash (CommitHash (..)) import Issue (Issue (..)) +import Issue.Parser qualified as I import Issue.Provenance qualified as I import Issue.Tag qualified as I import Issue.Text qualified as I import Parallel (parMapM) import Process (proc, sh) +import Render qualified as P import System.Directory (getCurrentDirectory) import System.FilePath ((</>)) import System.IO.Temp (withSystemTempDirectory) @@ -85,31 +87,28 @@ fromComment cwd comment = do commit <- I.commitFromHEAD cwd let provenance = I.Provenance commit commit - pure - ( if any (\marker -> T.isPrefixOf marker title') I.issueMarkers - then - Just - Issue + pure $ + ( \parseResult -> + let (markers, title) = + I.stripIssueMarkers (T.pack (show (P.render parseResult.heading))) + in Issue { title = title, - description = description, + description = N.nonEmpty parseResult.paragraphs, file = comment.file, provenance = provenance, start = comment.start, end = comment.end, - tags = maybe [] I.extractTags description, + tags = I.extractTags parseResult.tags, markers = markers, rawText = rawText, commentStyle = commentStyle, - comments = comments, + comments = N.nonEmpty parseResult.comments, closed = False } - else Nothing ) + <$> I.parse I.issueMarkers (D.commonmarkToNode [] rawText) where (commentStyle, rawText) = G.uncomment comment.file_type comment.text - (title', description') = I.extractText rawText - (markers, title) = I.stripIssueMarkers title' - (comments, description) = maybe ([], Nothing) (second Just . I.extractComments) description' dieOfInvalidTreeGrepperResult :: E.InvalidTreeGrepperResult -> IO a dieOfInvalidTreeGrepperResult (E.InvalidTreeGrepperResult e) = |