aboutsummaryrefslogtreecommitdiffstats
path: root/app/Issue/Tag.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Issue/Tag.hs')
-rw-r--r--app/Issue/Tag.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/Issue/Tag.hs b/app/Issue/Tag.hs
index c227491..8b6d6d4 100644
--- a/app/Issue/Tag.hs
+++ b/app/Issue/Tag.hs
@@ -8,7 +8,7 @@ import Data.Time.Clock (UTCTime (utctDay))
import GHC.Generics (Generic)
import Issue.Provenance (Provenance (..))
-data Tag = Tag Text Text deriving (Show, Generic, Binary)
+data Tag = Tag Text (Maybe Text) deriving (Show, Generic, Binary)
extractTags :: Text -> [Tag]
extractTags =
@@ -16,7 +16,9 @@ extractTags =
. map
( ( \case
((T.uncons -> Just ('@', k)) : v) ->
- Just (Tag k (T.unwords v))
+ case T.strip (T.unwords v) of
+ "" -> Just (Tag k Nothing)
+ v' -> Just (Tag k (Just v'))
_ -> Nothing
)
. T.words
@@ -26,12 +28,12 @@ extractTags =
internalTags :: Text -> Maybe Provenance -> [Tag]
internalTags title provenance' =
concat
- [ [ Tag "id" (toSpinalCase title)
+ [ [ Tag "id" $ Just $ toSpinalCase title
],
maybe
[]
( \provenance ->
- [ Tag "createdAt" (pack (show (utctDay provenance.date)))
+ [ Tag "createdAt" $ Just $ pack $ show $ utctDay provenance.date
]
)
provenance'