From 2b93e0bce102d7ccf8402b4506be9e55698f2ea9 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Wed, 4 Oct 2023 15:48:26 +0200 Subject: strip tags from description --- app/Issue.hs | 6 +++++- app/Main.hs | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/Issue.hs b/app/Issue.hs index 72fbad3..0d9f6ad 100644 --- a/app/Issue.hs +++ b/app/Issue.hs @@ -32,7 +32,7 @@ fromMatch result match = Just Issue { title = stripMarker (T.strip (T.unlines title)), - description = T.strip (T.unlines description), + description = stripTags (T.strip (T.unlines description)), start = match.start, end = match.end, tags = I.extract text @@ -48,6 +48,10 @@ fromMatch result match = marker :: Text marker = "TODO" +stripTags :: Text -> Text +stripTags text = + T.strip (T.unlines (filter (not . T.isPrefixOf "@") (T.lines text))) + stripMarker :: Text -> Text stripMarker text = maybe text T.stripStart (T.stripPrefix marker text) diff --git a/app/Main.hs b/app/Main.hs index 151115e..44b4242 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -134,7 +134,13 @@ showMatches issues = do [ [P.annotate P.bold (P.pretty issue.title)], if not (T.null issue.description) then [P.pretty issue.description] - else [] + else [], + map + ( \(I.Tag k v) -> + P.annotate (P.colorDull P.Yellow) $ + P.pretty ("@" `T.append` k `T.append` " " `T.append` v) + ) + issue.tags ] ) ) -- cgit v1.2.3