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 GHC.Stack (HasCallStack)
|
||||||
import qualified Text.Mustache as Mus
|
import qualified Text.Mustache as Mus
|
||||||
import qualified Text.Mustache.Compile 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 :: (HasCallStack, (ToJSON a)) => String -> a -> Action Text
|
||||||
applyTemplate templateName context = do
|
applyTemplate templateName context = do
|
||||||
|
@ -51,6 +51,7 @@ fromPost post =
|
||||||
rPostTags = postTags post,
|
rPostTags = postTags post,
|
||||||
rPostHasTags = not . null . postTags $ post,
|
rPostHasTags = not . null . postTags $ post,
|
||||||
rPostDate = postDate post,
|
rPostDate = postDate post,
|
||||||
|
rPostIsoDate = postDate post,
|
||||||
rPostContent = postContent post,
|
rPostContent = postContent post,
|
||||||
rPostLink = postLink post
|
rPostLink = postLink post
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ data RenderedPost = RenderedPost
|
||||||
rPostTags :: [Text],
|
rPostTags :: [Text],
|
||||||
rPostHasTags :: Bool,
|
rPostHasTags :: Bool,
|
||||||
rPostDate :: Maybe Text,
|
rPostDate :: Maybe Text,
|
||||||
|
rPostIsoDate :: Maybe Text,
|
||||||
rPostContent :: Maybe Text,
|
rPostContent :: Maybe Text,
|
||||||
rPostLink :: Maybe Text
|
rPostLink :: Maybe Text
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,8 +131,8 @@ markdownToPost path = do
|
||||||
yamlToPost :: FilePath -> Action Post
|
yamlToPost :: FilePath -> Action Post
|
||||||
yamlToPost path = do
|
yamlToPost path = do
|
||||||
post <- decodeFileThrow path
|
post <- decodeFileThrow path
|
||||||
let post' = dateTransform post
|
-- let post' = dateTransform post
|
||||||
return $ fromMaybe post post'
|
return post
|
||||||
where
|
where
|
||||||
dateTransform post@(Post {postDate}) = do
|
dateTransform post@(Post {postDate}) = do
|
||||||
postDate' <- postDate
|
postDate' <- postDate
|
||||||
|
|
Loading…
Reference in a new issue