From 775540e3eeb6c2259e654151b18aed9927867949 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Mon, 27 Nov 2023 13:28:31 +0100 Subject: don't cache `internalTags` --- app/Issue/Tag.hs | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) (limited to 'app/Issue') 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']])) -- cgit v1.2.3