aboutsummaryrefslogtreecommitdiffstats
path: root/app/Issue
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-11-27 13:55:04 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-11-27 13:55:04 +0100
commit34e3154c7ae1b002ff85cd0837c3cbf7d672d458 (patch)
tree882101d5712bddc17047f1a80a971a89aee25243 /app/Issue
parentd08746a03ef75eb2c4fecb157248a762545cca1f (diff)
close separate-database-issues-and-history-issues
Diffstat (limited to 'app/Issue')
-rw-r--r--app/Issue/Text.hs25
1 files changed, 23 insertions, 2 deletions
diff --git a/app/Issue/Text.hs b/app/Issue/Text.hs
index 7c81c91..5d1dddb 100644
--- a/app/Issue/Text.hs
+++ b/app/Issue/Text.hs
@@ -1,6 +1,11 @@
-module Issue.Text (extractText) where
+module Issue.Text
+ ( extractText,
+ stripIssueMarkers,
+ issueMarkers,
+ )
+where
-import Control.Arrow (second)
+import Control.Arrow (first, second)
import Data.List (find)
import Data.Maybe (fromMaybe)
import Data.Text (Text)
@@ -46,3 +51,19 @@ stripBlockComment blockStart blockEnd text =
. (fromMaybe text . T.stripSuffix blockEnd)
. (fromMaybe text . T.stripPrefix blockStart)
$ text
+
+issueMarkers :: [T.Text]
+issueMarkers =
+ [ "TODO",
+ "FIXME",
+ "QUESTION"
+ ]
+
+stripIssueMarkers :: T.Text -> ([T.Text], T.Text)
+stripIssueMarkers text =
+ case [marker | marker <- issueMarkers, T.isPrefixOf marker text] of
+ (marker : _) ->
+ first (marker :) . stripIssueMarkers $
+ T.stripStart (T.drop (T.length marker) text)
+ [] ->
+ ([], text)