shakebook-0.2.2.0: Shake-based technical documentation generator; HTML & PDF

Safe HaskellNone
LanguageHaskell2010

Shakebook.Conventions

Contents

Description

Conventions used for common shakebook projects, lenses, enrichments, affixes.

Synopsis

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.

viewTags :: Value -> [Text] Source #

View the "tags" field of a JSON Value as a list.

viewTitle :: Value -> Text Source #

View the "title" 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.

withHighlighting :: Style -> Value -> Value Source #

Add "highlighting-css" field from input Style.

withNext :: Maybe Value -> Value -> Value Source #

Add "next" field from input Value.

withPages :: [Value] -> Value -> Value Source #

Add "pages" field from input [Value].

withPrettyDate :: Text -> Value -> Value Source #

Add "prettydate" field using input Text.

withPrevious :: Maybe Value -> Value -> Value Source #

Add "previous" field using input Value.

withPosts :: [Value] -> Value -> Value Source #

Add "posts" field based on input [Value].

withRecentPosts :: [Value] -> Value -> Value Source #

Add "recentposts" field using input Value.

withSrcPath :: Text -> Value -> Value Source #

Add "srcPath" field based on input Text.

withSubsections :: [Value] -> Value -> Value Source #

Add "subsections" field based on inpt [Value].

withTagIndex :: [Value] -> Value -> Value Source #

Add "tagindex" field based on input [Value].

withTagLinks :: [Value] -> Value -> Value Source #

Add "taglinks" field based on input [Value].

withTeaser :: Text -> Value -> Value Source #

Add "teaser" field based on input Text.

withTitle :: Text -> Value -> Value Source #

Add "title" field based on input Text.

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

genBlogNavbarData Source #

Arguments

:: 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".

genIndexPageData :: MonadThrow m => [Value] -> Text -> (Text -> Text) -> Int -> m (Zipper [] Value) Source #

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.

sameMonth :: UTCTime -> UTCTime -> Bool Source #

Check whether two posts were posted in the same month.

tagFilterPosts :: Text -> [Value] -> [Value] Source #

Filter a lists of posts by tag.