diff options
Diffstat (limited to 'app/Issue/Tag.hs')
-rw-r--r-- | app/Issue/Tag.hs | 29 |
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']])) |