Safe Haskell | None |
---|---|
Language | Haskell2010 |
Conventions used for common shakebook projects, lenses, enrichments, affixes.
Synopsis
- viewContent :: Value -> Text
- viewPostTime :: Value -> UTCTime
- viewPostTimeRaw :: Value -> Text
- viewSrcPath :: Value -> Text
- viewTags :: Value -> [Text]
- viewTitle :: Value -> Text
- viewAllPostTags :: [Value] -> [Text]
- viewAllPostTimes :: [Value] -> [UTCTime]
- withHighlighting :: Style -> Value -> Value
- withNext :: Maybe Value -> Value -> Value
- withPages :: [Value] -> Value -> Value
- withPrettyDate :: Text -> Value -> Value
- withPrevious :: Maybe Value -> Value -> Value
- withPosts :: [Value] -> Value -> Value
- withRecentPosts :: [Value] -> Value -> Value
- withSrcPath :: Text -> Value -> Value
- withSubsections :: [Value] -> Value -> Value
- withTagIndex :: [Value] -> Value -> Value
- withTagLinks :: [Value] -> Value -> Value
- withTeaser :: Text -> Value -> Value
- withTitle :: Text -> Value -> Value
- enrichPrettyDate :: (UTCTime -> String) -> Value -> Value
- enrichTagLinks :: (Text -> Text) -> Value -> Value
- enrichTeaser :: Text -> Value -> Value
- extendNext :: Zipper [] Value -> Zipper [] Value
- extendPrevious :: Zipper [] Value -> Zipper [] Value
- extendNextPrevious :: Zipper [] Value -> Zipper [] Value
- extendPageNeighbours :: Int -> Zipper [] Value -> Zipper [] Value
- genBlogNavbarData :: Text -> Text -> (UTCTime -> Text) -> (UTCTime -> Text) -> [Value] -> Value
- genIndexPageData :: [Value] -> Text -> (Text -> Text) -> Int -> Maybe (Zipper [] Value)
- genLinkData :: Text -> (Text -> Text) -> Value
- genPageData :: Text -> (Text -> Text) -> Zipper [] [Value] -> Value
- genTocNavbarData :: Cofree [] Value -> Value
- dateSortPosts :: [Value] -> [Value]
- monthFilterPosts :: UTCTime -> [Value] -> [Value]
- sameMonth :: UTCTime -> UTCTime -> Bool
- tagFilterPosts :: Text -> [Value] -> [Value]
Lenses
viewContent :: Value -> Text Source #
View the "content" field of a JSON Value.
viewPostTime :: Value -> UTCTime Source #
View the "date" field of a JSON Value as a UTCTime.
viewPostTimeRaw :: Value -> Text Source #
View the "date" field of a JSON Value as Text.
viewSrcPath :: Value -> Text Source #
View the "srcPath" field of a JSON Value.
viewAllPostTags :: [Value] -> [Text] Source #
View all post tags for a list of posts.
viewAllPostTimes :: [Value] -> [UTCTime] Source #
View all posts times for a list of posts.
Enrichments
enrichPrettyDate :: (UTCTime -> String) -> Value -> Value Source #
Assuming a "date" field, enrich using withPrettyDate and a format string.
enrichTagLinks :: (Text -> Text) -> Value -> Value Source #
Assuming a "tags" field, enrich using withTagLinks.
enrichTeaser :: Text -> Value -> Value Source #
Assuming a "content" field with a spitter section, enrich using withTeaser
Extensions
extendNext :: Zipper [] Value -> Zipper [] Value Source #
Extend a Zipper of JSON Values to add "next" objects.
extendPrevious :: Zipper [] Value -> Zipper [] Value Source #
Extend a Zipper of JSON Values to add "previous" objects.
extendNextPrevious :: Zipper [] Value -> Zipper [] Value Source #
Add both "next" and "previous" fields using withPostNext
and withPostPrevious
Generations
:: Text | "Top level title, e.g Blog |
-> Text | Root page, e.g "/posts" |
-> (UTCTime -> Text) | Formatting function to a UTCTime to a title. |
-> (UTCTime -> Text) | Formatting function to convert a UTCTime to a URL link |
-> [Value] | |
-> Value |
Create a blog navbar object for a posts section, with layers "toc1", "toc2", and "toc3".
genLinkData :: Text -> (Text -> Text) -> Value Source #
Create link data object with fields "id" and "url" using an id and a function | transforming an id into a url.
genTocNavbarData :: Cofree [] Value -> Value Source #
Create a toc navbar object for a docs section, with layers "toc1", "toc2" and "toc3".
dateSortPosts :: [Value] -> [Value] Source #
Sort a lists of posts by date.