aboutsummaryrefslogtreecommitdiffstats
path: root/app/Issue
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-11-27 13:28:31 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-11-27 13:33:07 +0100
commit775540e3eeb6c2259e654151b18aed9927867949 (patch)
tree3861953b0cd71a72d827c5c65c898e66f92d7919 /app/Issue
parent8015bdc11b63e46ff4685075e90bb49197076653 (diff)
don't cache `internalTags`
Diffstat (limited to 'app/Issue')
-rw-r--r--app/Issue/Tag.hs29
1 files changed, 1 insertions, 28 deletions
diff --git a/app/Issue/Tag.hs b/app/Issue/Tag.hs
index 29c69d9..ca550aa 100644
--- a/app/Issue/Tag.hs
+++ b/app/Issue/Tag.hs
@@ -1,7 +1,6 @@
module Issue.Tag
( Tag (..),
extractTags,
- internalTags,
tagKey,
tagValue,
tagValuesOf,
@@ -11,11 +10,9 @@ where
import CMark qualified as D
import Data.Binary (Binary)
import Data.Maybe (catMaybes, mapMaybe)
-import Data.Text (Text, pack)
+import Data.Text (Text)
import Data.Text qualified as T
-import Data.Time.Clock (UTCTime (utctDay))
import GHC.Generics (Generic)
-import Issue.Provenance (Author (..), Commit (..), Provenance (..))
data Tag = Tag Text (Maybe Text) deriving (Show, Generic, Binary, Eq)
@@ -56,27 +53,3 @@ extractTags = collect . D.commonmarkToNode []
. T.words
)
. T.lines
-
-internalTags :: Text -> Maybe Provenance -> [T.Text] -> [Tag]
-internalTags title provenance' markers =
- concat
- [ [ Tag "id" $ Just $ toSpinalCase title,
- Tag "title" $ Just $ title
- ],
- maybe
- []
- ( \provenance ->
- [ Tag "createdAt" $ Just $ pack $ show $ utctDay provenance.first.date,
- Tag "modifiedAt" $ Just $ pack $ show $ utctDay provenance.last.date,
- Tag "author" $ Just $ provenance.first.author.name,
- Tag "editor" $ Just $ provenance.last.author.name
- ]
- )
- provenance',
- map (Tag "type" . Just) markers
- ]
-
-toSpinalCase :: Text -> Text
-toSpinalCase = T.replace " " "-" . T.filter keep . T.toLower
- where
- keep = (`elem` (concat [[' ', '-'], ['a' .. 'z'], ['0' .. '9']]))