iso date break?
This commit is contained in:
parent
45cbabcd3a
commit
a99f4aee1f
3 changed files with 5 additions and 3 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ data RenderedPost = RenderedPost
|
|||
rPostTags :: [Text],
|
||||
rPostHasTags :: Bool,
|
||||
rPostDate :: Maybe Text,
|
||||
rPostIsoDate :: Maybe Text,
|
||||
rPostContent :: Maybe Text,
|
||||
rPostLink :: Maybe Text
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue