-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Shake-based technical documentation generator; HTML & PDF -- -- Shakebook is a documentation generator aimed at covering all the bases -- for mathematical, technical and scientific diagrams and typesetting. -- Shakebook provides combinators for taking markdown files and combining -- them into documents, but allowing the user to control how. Shakebook -- provides general combinators for templating single pages, cofree -- comonads for representing tables of contents, and zipper comonads for -- representing pagers. @package shakebook @version 0.2.2.0 module Shakebook.Aeson -- | Union two JSON values together. withJSON :: ToJSON a => a -> Value -> Value -- | Add a String field to a JSON value. withStringField :: Text -> Text -> Value -> Value -- | Add an Array field to a JSON value. withArrayField :: Text -> [Value] -> Value -> Value -- | Add an Object field to a JSON value. withObjectField :: Text -> Value -> Value -> Value -- | Maybe add an Object field to a JSON value. withObjectFieldMaybe :: Text -> Maybe Value -> Value -> Value module Shakebook.Data needLocalOut :: (MonadAction m, MonadReader r m, HasLocalOut r) => [Path Rel File] -> m () (%->) :: (MonadReader r m, MonadRules m, HasLocalOut r) => FilePattern -> (Within Rel File -> RAction r ()) -> m () class HasLocalOut r localOutL :: HasLocalOut r => Lens' r (Path Rel Dir) class HasLocalSrc r localSrcL :: HasLocalSrc r => Lens' r (Path Rel Dir) newtype PathDisplay a t PathDisplay :: Path a t -> PathDisplay a t newtype WithinDisplay a t WithinDisplay :: Within a t -> WithinDisplay a t type ToC = Cofree [] String data SbConfig SbConfig :: Path Rel Dir -> Path Rel Dir -> Text -> ReaderOptions -> WriterOptions -> Int -> SbConfig [sbSrcDir] :: SbConfig -> Path Rel Dir [sbOutDir] :: SbConfig -> Path Rel Dir [sbBaseUrl] :: SbConfig -> Text [sbMdRead] :: SbConfig -> ReaderOptions [sbHTWrite] :: SbConfig -> WriterOptions [sbPPP] :: SbConfig -> Int class HasSbConfig a sbConfigL :: HasSbConfig a => Lens' a SbConfig data ShakebookEnv ShakebookEnv :: LogFunc -> SbConfig -> ShakebookEnv [logFunc] :: ShakebookEnv -> LogFunc [sbConfig] :: ShakebookEnv -> SbConfig -- | View the "srcPath" field of a JSON Value. viewSrcPath :: Value -> Text -- | Add "srcPath" field based on input Text. withSrcPath :: Text -> Value -> Value -- | Add "baseUrl" field from input Text. withBaseUrl :: Text -> Value -> Value -- | Add "fullUrl" field from input Text. withFullUrl :: Text -> Value -> Value -- | View the "url" field of a JSON Value. viewUrl :: Value -> Text -- | Add "url" field from input Text. withUrl :: Text -> Value -> Value -- | Assuming a "url" field, enrich via a baseURL enrichFullUrl :: Text -> Value -> Value -- | Assuming a srcPath field, enrich using withUrl using a Text -- -> Text transformation. enrichUrl :: (Text -> Text) -> Value -> Value leadingSlash :: Path Abs Dir withHtmlExtension :: MonadThrow m => Path Rel File -> m (Path Rel File) withMarkdownExtension :: MonadThrow m => Path Rel File -> m (Path Rel File) generateSupposedUrl :: MonadThrow m => Path Rel File -> m (Path Abs File) enrichSupposedUrl :: (MonadReader r m, HasSbConfig r, MonadThrow m) => Value -> m Value -- | Get a JSON Value of Markdown Data with markdown body as "contents" -- field and the srcPath as "srcPath" field. readMarkdownFile' :: (MonadReader r m, HasSbConfig r, MonadAction m) => Within Rel File -> m Value data PaginationException EmptyContentsError :: PaginationException paginate' :: MonadThrow m => Int -> [a] -> m (Zipper [] [a]) lower :: Cofree [] Value -> [Value] type MonadShakebook r m = (MonadReader r m, HasSbConfig r, HasLogFunc r, MonadIO m, MonadThrow m, HasLocalOut r) type MonadShakebookAction r m = (MonadShakebook r m, MonadAction m) type MonadShakebookRules r m = (MonadShakebook r m, MonadRules m) -- | Multi-markdown loader. Allows you to load a filepattern of markdown as -- a list of JSON values ready to pass to an HTML template. You will -- probably want to add additional data before you write. See the -- examples in Shakebook.Defaults loadSortFilterEnrich :: (MonadShakebookAction r m, Ord b) => [FilePattern] -> (Value -> b) -> (Value -> Bool) -> (Value -> Value) -> m [(Within Rel File, Value)] -- | The same as loadSortFilterEnrich but without filtering. loadSortEnrich :: (MonadShakebookAction r m, Ord b) => [FilePattern] -> (Value -> b) -> (Value -> Value) -> m [(Within Rel File, Value)] instance GHC.Classes.Eq Shakebook.Data.PaginationException instance GHC.Show.Show Shakebook.Data.PaginationException instance GHC.Show.Show Shakebook.Data.SbConfig instance GHC.Exception.Type.Exception Shakebook.Data.PaginationException instance Shakebook.Data.HasLocalOut Shakebook.Data.ShakebookEnv instance Shakebook.Data.HasSbConfig Shakebook.Data.ShakebookEnv instance RIO.Prelude.Logger.HasLogFunc Shakebook.Data.ShakebookEnv instance RIO.Prelude.Display.Display (Shakebook.Data.WithinDisplay a t) instance RIO.Prelude.Display.Display [Shakebook.Data.WithinDisplay a t] instance RIO.Prelude.Display.Display (Shakebook.Data.PathDisplay a t) -- | Conventions used for common shakebook projects, lenses, enrichments, -- affixes. module Shakebook.Conventions -- | View the "content" field of a JSON Value. viewContent :: Value -> Text -- | View the "date" field of a JSON Value as a UTCTime. viewPostTime :: Value -> UTCTime -- | View the "date" field of a JSON Value as Text. viewPostTimeRaw :: Value -> Text -- | View the "srcPath" field of a JSON Value. viewSrcPath :: Value -> Text -- | View the "tags" field of a JSON Value as a list. viewTags :: Value -> [Text] -- | View the "title" field of a JSON Value. viewTitle :: Value -> Text -- | View all post tags for a list of posts. viewAllPostTags :: [Value] -> [Text] -- | View all posts times for a list of posts. viewAllPostTimes :: [Value] -> [UTCTime] -- | Add "highlighting-css" field from input Style. withHighlighting :: Style -> Value -> Value -- | Add "next" field from input Value. withNext :: Maybe Value -> Value -> Value -- | Add "pages" field from input [Value]. withPages :: [Value] -> Value -> Value -- | Add "prettydate" field using input Text. withPrettyDate :: Text -> Value -> Value -- | Add "previous" field using input Value. withPrevious :: Maybe Value -> Value -> Value -- | Add "posts" field based on input [Value]. withPosts :: [Value] -> Value -> Value -- | Add "recentposts" field using input Value. withRecentPosts :: [Value] -> Value -> Value -- | Add "srcPath" field based on input Text. withSrcPath :: Text -> Value -> Value -- | Add "subsections" field based on inpt [Value]. withSubsections :: [Value] -> Value -> Value -- | Add "tagindex" field based on input [Value]. withTagIndex :: [Value] -> Value -> Value -- | Add "taglinks" field based on input [Value]. withTagLinks :: [Value] -> Value -> Value -- | Add "teaser" field based on input Text. withTeaser :: Text -> Value -> Value -- | Add "title" field based on input Text. withTitle :: Text -> Value -> Value -- | Assuming a "date" field, enrich using withPrettyDate and a format -- string. enrichPrettyDate :: (UTCTime -> String) -> Value -> Value -- | Assuming a "tags" field, enrich using withTagLinks. enrichTagLinks :: (Text -> Text) -> Value -> Value -- | Assuming a "content" field with a spitter section, enrich using -- withTeaser enrichTeaser :: Text -> Value -> Value -- | Extend a Zipper of JSON Values to add "next" objects. extendNext :: Zipper [] Value -> Zipper [] Value -- | Extend a Zipper of JSON Values to add "previous" objects. extendPrevious :: Zipper [] Value -> Zipper [] Value -- | Add both "next" and "previous" fields using withPostNext and -- withPostPrevious extendNextPrevious :: Zipper [] Value -> Zipper [] Value extendPageNeighbours :: Int -> Zipper [] Value -> Zipper [] Value -- | Create a blog navbar object for a posts section, with layers "toc1", -- "toc2", and "toc3". genBlogNavbarData :: Text -> Text -> (UTCTime -> Text) -> (UTCTime -> Text) -> [Value] -> Value genIndexPageData :: MonadThrow m => [Value] -> Text -> (Text -> Text) -> Int -> m (Zipper [] Value) -- | Create link data object with fields "id" and "url" using an id and a -- function | transforming an id into a url. genLinkData :: Text -> (Text -> Text) -> Value genPageData :: Text -> (Text -> Text) -> Zipper [] [Value] -> Value -- | Create a toc navbar object for a docs section, with layers "toc1", -- "toc2" and "toc3". genTocNavbarData :: Cofree [] Value -> Value -- | Sort a lists of posts by date. dateSortPosts :: [Value] -> [Value] monthFilterPosts :: UTCTime -> [Value] -> [Value] -- | Check whether two posts were posted in the same month. sameMonth :: UTCTime -> UTCTime -> Bool -- | Filter a lists of posts by tag. tagFilterPosts :: Text -> [Value] -> [Value] module Shakebook.Feed asAtomEntry :: Value -> Entry buildFeed :: Text -> Text -> [Value] -> FilePath -> Action () module Shakebook.Mustache -- | A compiled Template with metadata. data Template -- | Build a single page straight from a template. buildPageAction :: MonadAction m => Path Rel File -> Value -> Path Rel File -> m () buildPageActionWithin :: MonadAction m => Within Rel File -> Value -> Within Rel File -> m () compileTemplate' :: MonadAction m => Path Rel File -> m Template module Shakebook.Defaults defaultMonthUrlFormat :: UTCTime -> String defaultPrettyMonthFormat :: UTCTime -> String defaultPrettyTimeFormat :: UTCTime -> String defaultIndexFileFragment :: Path Rel File defaultMonthDirFragment :: MonadThrow m => UTCTime -> m (Path Rel Dir) defaultMonthUrlFragment :: UTCTime -> Text defaultEnrichPost :: Value -> Value defaultMarkdownReaderOptions :: ReaderOptions defaultHtml5WriterOptions :: WriterOptions defaultLatexWriterOptions :: WriterOptions defaultSbSrcDir :: Path Rel Dir defaultSbOutDir :: Path Rel Dir defaultPostsPerPage :: Int defaultSbConfig :: Text -> SbConfig affixBlogNavbar :: MonadShakebookAction r m => [FilePattern] -> Text -> Text -> (UTCTime -> Text) -> (UTCTime -> Text) -> (Value -> Value) -> Value -> m Value affixRecentPosts :: MonadShakebookAction r m => [FilePattern] -> Int -> (Value -> Value) -> Value -> m Value defaultDocsPatterns :: MonadShakebookRules r m => Cofree [] FilePath -> FilePath -> (Value -> Value) -> m () defaultPostIndexData :: MonadShakebookAction r m => [FilePattern] -> (a -> Value -> Bool) -> (a -> Text) -> (a -> Text -> Text) -> a -> m (Zipper [] Value) defaultPagerPattern :: MonadShakebookRules r m => FilePattern -> FilePath -> (FilePattern -> Int) -> (FilePattern -> a) -> (a -> RAction r (Zipper [] Value)) -> (Zipper [] Value -> RAction r (Zipper [] Value)) -> m () defaultPostIndexPatterns :: MonadShakebookRules r m => [FilePattern] -> FilePath -> (Zipper [] Value -> RAction r (Zipper [] Value)) -> m () defaultTagIndexPatterns :: MonadShakebookRules r m => [FilePattern] -> FilePath -> (Zipper [] Value -> RAction r (Zipper [] Value)) -> m () defaultMonthIndexPatterns :: MonadShakebookRules r m => [FilePattern] -> FilePath -> (Zipper [] Value -> RAction r (Zipper [] Value)) -> m () -- | Default Posts Pager. defaultPostsPatterns :: MonadShakebookRules r m => FilePattern -> FilePath -> (Value -> RAction r Value) -> (Zipper [] Value -> RAction r (Zipper [] Value)) -> m () makePDFLaTeX :: Pandoc -> PandocIO (Either ByteString ByteString) handleImages :: Text -> (Text -> Text) -> Inline -> Inline handleHeaders :: Int -> Block -> Block pushHeaders :: Int -> Cofree [] Pandoc -> Cofree [] Pandoc -- | Build a PDF from a Cofree table of contents. buildPDF :: (MonadShakebookAction r m, MonadFail m) => Cofree [] String -> Path Rel File -> FilePath -> m () -- | Default Single Page Pattern, see tests for usage. It's possible this -- could just be called singlePagePattern, as there's no hardcoded -- strings here, but it would need to run entirely within the monad to -- translate filepaths. defaultSinglePagePattern :: (MonadRules m, MonadReader r m, HasSbConfig r, HasLocalOut r) => FilePath -> FilePath -> (Value -> RAction r Value) -> m () -- | Default statics patterns. Takes a list of filepatterns and adds a rule -- that copies everything verbatim defaultStaticsPatterns :: MonadShakebookRules r m => [FilePattern] -> m () -- | Default "shake clean" phony, cleans your output directory. defaultCleanPhony :: MonadShakebookRules r m => m () defaultSinglePagePhony :: MonadShakebookRules r m => String -> FilePath -> m () -- | Default "shake statics" phony rule. automatically runs need on -- "<out>/thing/*" for every thing found in "images/", "css/", -- "js/" and "webfonts/" defaultStaticsPhony :: MonadShakebookRules r m => [FilePattern] -> m () -- | Default "shake posts" phony rule. takes a [FilePattern] pointing to -- the posts and and calls need on -- "<out>/posts/<filename>.html" for each markdown post -- found. defaultPostsPhony :: MonadShakebookRules r m => [FilePattern] -> m () -- | Default "shake posts-index" phony rule. Takes a [FilePattern] of posts -- to discover and calls need on "<out>/posts/index.html" and -- "<out>/posts/pages/<n>/index.html" for each page required. defaultPostIndexPhony :: MonadShakebookRules r m => [FilePattern] -> m () -- | Default "shake tag-index" phony rule. Takes a [FilePattern] of posts -- to discover and calls need on -- "<out>/posts/tags/<tag>/index.html" and -- "<out>/posts/tags/<tag>/pages/<n>/index.html" for -- each tag discovered and for each page required per tag filter. defaultTagIndexPhony :: MonadShakebookRules r m => [FilePattern] -> m () defaultPagePaths :: MonadThrow m => Path Rel Dir -> Zipper [] [a] -> m [Path Rel File] fileIndexHTML :: Path Rel File dirPosts :: Path Rel Dir dirMonths :: Path Rel Dir dirPages :: Path Rel Dir dirTags :: Path Rel Dir -- | Default "shake month-index" phony rule. Takes a [FilePattern] of posts -- to discover and calls need on -- "<out>/posts/months/<yyyy-md>/index.html" and -- "<out>/posts/months/<yyyy-md>/pages/<n>/index.html" -- for each month discovered that contains a post and for each page -- required per month filter. defaultMonthIndexPhony :: (MonadRules m, MonadReader r m, HasSbConfig r, HasLocalOut r) => [FilePattern] -> m () -- | Default "shake docs" phony rule, takes a Cofree [] String as a table -- of contents. defaultDocsPhony :: MonadShakebookRules r m => Cofree [] String -> m () module Shakebook.Rules -- | Generates Shake Rules from a FilePattern via an action that -- returns a ComonadStore. comonadStoreRuleGen :: ComonadStore s w => FilePattern -> (FilePattern -> s) -> (FilePattern -> a) -> (a -> Action (w b)) -> (b -> FilePath -> Action ()) -> Rules () -- | Generates Shake Rules from a ComonadCofree of -- FilePath sources. cofreeRuleGen :: (Traversable w, ComonadCofree f w) => w FilePath -> (FilePath -> FilePath) -> (w FilePath -> FilePath -> Action ()) -> Rules () module Shakebook