aboutsummaryrefslogtreecommitdiffstats
path: root/app/Issue/Tag.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-11-07 14:53:26 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-11-07 14:54:04 +0100
commitd9400635bcb28674c8510d71aa6eed94194bf669 (patch)
tree537bbad294aa4cfee520de5f4edd874a6b49ee63 /app/Issue/Tag.hs
parent6b912f5b477de3374dee38661e0acf72920d4f5e (diff)
add issue marker as internal tag @type
Diffstat (limited to 'app/Issue/Tag.hs')
-rw-r--r--app/Issue/Tag.hs19
1 files changed, 15 insertions, 4 deletions
diff --git a/app/Issue/Tag.hs b/app/Issue/Tag.hs
index c2358a8..90c7520 100644
--- a/app/Issue/Tag.hs
+++ b/app/Issue/Tag.hs
@@ -4,11 +4,12 @@ module Issue.Tag
internalTags,
tagKey,
tagValue,
+ tagValuesOf,
)
where
import Data.Binary (Binary)
-import Data.Maybe (catMaybes)
+import Data.Maybe (catMaybes, mapMaybe)
import Data.Text (Text, pack)
import Data.Text qualified as T
import Data.Time.Clock (UTCTime (utctDay))
@@ -23,6 +24,15 @@ tagKey (Tag k _) = k
tagValue :: Tag -> Maybe Text
tagValue (Tag _ v) = v
+tagValuesOf :: Text -> [Tag] -> [Text]
+tagValuesOf key =
+ mapMaybe
+ ( \tag ->
+ if tagKey tag == key
+ then tagValue tag
+ else Nothing
+ )
+
extractTags :: Text -> [Tag]
extractTags =
catMaybes
@@ -38,8 +48,8 @@ extractTags =
)
. T.lines
-internalTags :: Text -> Maybe Provenance -> [Tag]
-internalTags title provenance' =
+internalTags :: Text -> Maybe Provenance -> [T.Text] -> [Tag]
+internalTags title provenance' markers =
concat
[ [ Tag "id" $ Just $ toSpinalCase title
],
@@ -52,7 +62,8 @@ internalTags title provenance' =
Tag "editor" $ Just $ provenance.last.author.name
]
)
- provenance'
+ provenance',
+ map (Tag "type" . Just) markers
]
toSpinalCase :: Text -> Text