-- 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.0.4
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
type ToC = Cofree [] String
data SbConfig
SbConfig :: FilePath -> FilePath -> Text -> ReaderOptions -> WriterOptions -> Int -> SbConfig
[sbSrcDir] :: SbConfig -> FilePath
[sbOutDir] :: SbConfig -> FilePath
[sbBaseUrl] :: SbConfig -> Text
[sbMdRead] :: SbConfig -> ReaderOptions
[sbHTWrite] :: SbConfig -> WriterOptions
[sbPPP] :: SbConfig -> Int
class HasSbConfig a
sbConfigL :: HasSbConfig a => Lens' a SbConfig
newtype Shakebook r a
Shakebook :: ReaderT r Rules a -> Shakebook r a
newtype ShakebookA r a
ShakebookA :: ReaderT r Action a -> ShakebookA r a
runShakebook :: r -> Shakebook r a -> Rules a
runShakebookA :: r -> ShakebookA r a -> Action a
class MonadAction m
liftAction :: MonadAction m => Action a -> m a
class MonadRules m
liftRules :: MonadRules m => Rules a -> m a
data ShakebookEnv
ShakebookEnv :: LogFunc -> SbConfig -> ShakebookEnv
[logFunc] :: ShakebookEnv -> LogFunc
[sbConfig] :: ShakebookEnv -> SbConfig
type MonadShakebook r m = (MonadReader r m, HasSbConfig r, HasLogFunc r, MonadIO m)
type MonadShakebookAction r m = (MonadShakebook r m, MonadAction m)
type MonadShakebookRules r m = (MonadShakebook r m, MonadRules m)
-- | 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
-- | Filepath/URL calculators - these work but don't try to do the wrong
-- thing or it will explode.
typicalFullOutToSrcPath :: MonadShakebook r m => m (String -> String)
typicalFullOutToFullSrcPath :: MonadShakebook r m => m (String -> String)
typicalFullOutHTMLToMdSrcPath :: MonadShakebook r m => m (String -> String)
typicalMdSrcPathToHTMLFullOut :: MonadShakebook r m => m (String -> String)
typicalSrcPathToUrl :: Text -> Text
enrichTypicalUrl :: Value -> Value
-- | Get a JSON Value of Markdown Data with markdown body as "contents"
-- field and the srcPath as "srcPath" field.
readMarkdownFile' :: MonadShakebookAction r m => String -> m Value
loadIfExists :: (FilePath -> Action Value) -> FilePath -> Action Value
getMarkdown :: MonadShakebookAction r m => [FilePattern] -> m [Value]
-- | Build a single page straight from a template, a loaded Value, and a
-- pure enrichment.
genBuildPageAction :: MonadShakebookAction r m => FilePath -> (FilePath -> m Value) -> (Value -> Value) -> FilePath -> m Value
traverseToSnd :: Functor f => (a -> f b) -> a -> f (a, b)
lower :: Cofree [] Value -> [Value]
-- | 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 [(FilePath, Value)]
-- | The same as loadSortFilterEnrich but without filtering.
loadSortEnrich :: (MonadShakebookAction r m, Ord b) => [FilePattern] -> (Value -> b) -> (Value -> Value) -> m [(String, Value)]
instance Control.Monad.IO.Class.MonadIO (Shakebook.Data.ShakebookA r)
instance Control.Monad.Reader.Class.MonadReader r (Shakebook.Data.ShakebookA r)
instance GHC.Base.Monad (Shakebook.Data.ShakebookA r)
instance GHC.Base.Applicative (Shakebook.Data.ShakebookA r)
instance GHC.Base.Functor (Shakebook.Data.ShakebookA r)
instance Control.Monad.IO.Class.MonadIO (Shakebook.Data.Shakebook r)
instance Control.Monad.Reader.Class.MonadReader r (Shakebook.Data.Shakebook r)
instance GHC.Base.Monad (Shakebook.Data.Shakebook r)
instance GHC.Base.Applicative (Shakebook.Data.Shakebook r)
instance GHC.Base.Functor (Shakebook.Data.Shakebook r)
instance GHC.Show.Show Shakebook.Data.SbConfig
instance Shakebook.Data.HasSbConfig Shakebook.Data.ShakebookEnv
instance RIO.Prelude.Logger.HasLogFunc Shakebook.Data.ShakebookEnv
instance Shakebook.Data.MonadRules (Shakebook.Data.Shakebook r)
instance Shakebook.Data.MonadAction (Shakebook.Data.ShakebookA r)
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
-- | Zipper utils that weren't in Control.Comonad.Store.Zipper
module Shakebook.Zipper
paginate :: Int -> [a] -> Maybe (Zipper [] [a])
zipperNextMaybe :: Zipper [] a -> Maybe a
zipperPreviousMaybe :: Zipper [] a -> Maybe a
zipperWithin :: Int -> Zipper [] a -> [a]
-- | 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 :: [Value] -> Text -> (Text -> Text) -> Int -> Maybe (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.Defaults
defaultMonthURLFormat :: UTCTime -> String
defaultPrettyMonthFormat :: UTCTime -> String
defaultPrettyTimeFormat :: UTCTime -> String
defaultMonthIndexUrlFormat :: UTCTime -> String
defaultEnrichPost :: Value -> Value
defaultMarkdownReaderOptions :: ReaderOptions
defaultHtml5WriterOptions :: WriterOptions
defaultLatexWriterOptions :: WriterOptions
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 -> ShakebookA r (Zipper [] Value)) -> (Zipper [] Value -> ShakebookA r (Zipper [] Value)) -> m ()
defaultPostIndexPatterns :: MonadShakebookRules r m => [FilePattern] -> FilePath -> (Zipper [] Value -> ShakebookA r (Zipper [] Value)) -> m ()
defaultTagIndexPatterns :: MonadShakebookRules r m => [FilePattern] -> FilePath -> (Zipper [] Value -> ShakebookA r (Zipper [] Value)) -> m ()
defaultMonthIndexPatterns :: MonadShakebookRules r m => [FilePattern] -> FilePath -> (Zipper [] Value -> ShakebookA r (Zipper [] Value)) -> m ()
-- | Default Posts Pager.
defaultPostsPatterns :: MonadShakebookRules r m => FilePattern -> FilePath -> (Value -> ShakebookA r Value) -> (Zipper [] Value -> ShakebookA r (Zipper [] Value)) -> m ()
makePDFLaTeX :: Pandoc -> PandocIO (Either ByteString ByteString)
handleImages :: (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 => Cofree [] String -> String -> 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 :: MonadShakebookRules r m => FilePath -> FilePath -> (Value -> ShakebookA 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 => 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 ()
-- | 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 :: MonadShakebookRules r m => [FilePattern] -> m ()
-- | Default "shake docs" phony rule, takes a Cofree [] String as a table
-- of contents.
defaultDocsPhony :: MonadShakebookRules r m => Cofree [] String -> m ()