iso date break?

This commit is contained in:
Pagwin 2024-11-05 13:27:17 -05:00
parent 45cbabcd3a
commit a99f4aee1f
No known key found for this signature in database
GPG key ID: 81137023740CA260
3 changed files with 5 additions and 3 deletions

View file

@ -10,7 +10,7 @@ import Development.Shake.FilePath ((</>))
import GHC.Stack (HasCallStack)
import qualified Text.Mustache as Mus
import qualified Text.Mustache.Compile as Mus
import Types (Post (postAuthor, postContent, postDate, postLink, postTags, postTitle), RenderedPost (RenderedPost, rPostAuthor, rPostContent, rPostDate, rPostHasTags, rPostLink, rPostTags, rPostTitle))
import Types (Post (postAuthor, postContent, postDate, postLink, postTags, postTitle), RenderedPost (RenderedPost, rPostAuthor, rPostContent, rPostDate, rPostHasTags, rPostIsoDate, rPostLink, rPostTags, rPostTitle))
applyTemplate :: (HasCallStack, (ToJSON a)) => String -> a -> Action Text
applyTemplate templateName context = do
@ -51,6 +51,7 @@ fromPost post =
rPostTags = postTags post,
rPostHasTags = not . null . postTags $ post,
rPostDate = postDate post,
rPostIsoDate = postDate post,
rPostContent = postContent post,
rPostLink = postLink post
}

View file

@ -14,6 +14,7 @@ data RenderedPost = RenderedPost
rPostTags :: [Text],
rPostHasTags :: Bool,
rPostDate :: Maybe Text,
rPostIsoDate :: Maybe Text,
rPostContent :: Maybe Text,
rPostLink :: Maybe Text
}

View file

@ -131,8 +131,8 @@ markdownToPost path = do
yamlToPost :: FilePath -> Action Post
yamlToPost path = do
post <- decodeFileThrow path
let post' = dateTransform post
return $ fromMaybe post post'
-- let post' = dateTransform post
return post
where
dateTransform post@(Post {postDate}) = do
postDate' <- postDate