diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-12-05 10:11:54 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-12-05 14:55:59 +0100 |
commit | 23bacb83e6ea67ffdd62be630626ab50ff665abf (patch) | |
tree | fcb7691e3f8862400c00f0ca823503e5087f411e /app/Issue.hs | |
parent | 1b1c3faabae530229eb675a2e70e744c2f45cbbe (diff) |
feat: parse issues as markdown
Diffstat (limited to 'app/Issue.hs')
-rw-r--r-- | app/Issue.hs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/app/Issue.hs b/app/Issue.hs index 65afdd6..303862d 100644 --- a/app/Issue.hs +++ b/app/Issue.hs @@ -1,3 +1,5 @@ +{-# OPTIONS_GHC -fno-warn-orphans #-} + module Issue ( Issue (..), Provenance (..), @@ -7,7 +9,9 @@ module Issue ) where -import Data.Binary (Binary) +import CMark qualified as D +import Data.Binary (Binary (..)) +import Data.List.NonEmpty (NonEmpty) import Data.Text qualified as T import Data.Text.IO qualified as T import Data.Time.Clock (UTCTime (utctDay)) @@ -15,13 +19,14 @@ import GHC.Generics (Generic) import GHC.Records (HasField (..)) import Issue.Provenance (Author (..), Commit (..), Provenance (..)) import Issue.Tag (Tag (..)) +import Render qualified as P import TreeGrepper.Comment qualified as G import TreeGrepper.Match qualified as G import Prelude hiding (id) data Issue = Issue { title :: T.Text, - description :: Maybe T.Text, + description :: Maybe (NonEmpty D.Node), file :: String, provenance :: Provenance, start :: G.Position, @@ -30,11 +35,18 @@ data Issue = Issue markers :: [T.Text], rawText :: T.Text, commentStyle :: G.CommentStyle, - comments :: [T.Text], + comments :: Maybe (NonEmpty [D.Node]), closed :: Bool } deriving (Show, Binary, Generic, Eq) +-- TODO Resolve Binary D.Node instance +-- +-- @related reduce-cached-data-size +instance Binary D.Node where + put = put . show . P.render + get = D.commonmarkToNode [] <$> get + id :: Issue -> T.Text id issue = toSpinalCase issue.title where |