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

Safe HaskellNone
LanguageHaskell2010

Shakebook.Data

Synopsis

Documentation

data SbConfig Source #

Instances
Show SbConfig Source # 
Instance details

Defined in Shakebook.Data

class HasSbConfig a where Source #

Instances
HasSbConfig ShakebookEnv Source # 
Instance details

Defined in Shakebook.Data

newtype Shakebook r a Source #

Constructors

Shakebook (ReaderT r Rules a) 
Instances
MonadReader r (Shakebook r) Source # 
Instance details

Defined in Shakebook.Data

Methods

ask :: Shakebook r r #

local :: (r -> r) -> Shakebook r a -> Shakebook r a #

reader :: (r -> a) -> Shakebook r a #

Monad (Shakebook r) Source # 
Instance details

Defined in Shakebook.Data

Methods

(>>=) :: Shakebook r a -> (a -> Shakebook r b) -> Shakebook r b #

(>>) :: Shakebook r a -> Shakebook r b -> Shakebook r b #

return :: a -> Shakebook r a #

fail :: String -> Shakebook r a #

Functor (Shakebook r) Source # 
Instance details

Defined in Shakebook.Data

Methods

fmap :: (a -> b) -> Shakebook r a -> Shakebook r b #

(<$) :: a -> Shakebook r b -> Shakebook r a #

Applicative (Shakebook r) Source # 
Instance details

Defined in Shakebook.Data

Methods

pure :: a -> Shakebook r a #

(<*>) :: Shakebook r (a -> b) -> Shakebook r a -> Shakebook r b #

liftA2 :: (a -> b -> c) -> Shakebook r a -> Shakebook r b -> Shakebook r c #

(*>) :: Shakebook r a -> Shakebook r b -> Shakebook r b #

(<*) :: Shakebook r a -> Shakebook r b -> Shakebook r a #

MonadIO (Shakebook r) Source # 
Instance details

Defined in Shakebook.Data

Methods

liftIO :: IO a -> Shakebook r a #

MonadRules (Shakebook r) Source # 
Instance details

Defined in Shakebook.Data

Methods

liftRules :: Rules a -> Shakebook r a Source #

newtype ShakebookA r a Source #

Constructors

ShakebookA (ReaderT r Action a) 
Instances
MonadReader r (ShakebookA r) Source # 
Instance details

Defined in Shakebook.Data

Methods

ask :: ShakebookA r r #

local :: (r -> r) -> ShakebookA r a -> ShakebookA r a #

reader :: (r -> a) -> ShakebookA r a #

Monad (ShakebookA r) Source # 
Instance details

Defined in Shakebook.Data

Methods

(>>=) :: ShakebookA r a -> (a -> ShakebookA r b) -> ShakebookA r b #

(>>) :: ShakebookA r a -> ShakebookA r b -> ShakebookA r b #

return :: a -> ShakebookA r a #

fail :: String -> ShakebookA r a #

Functor (ShakebookA r) Source # 
Instance details

Defined in Shakebook.Data

Methods

fmap :: (a -> b) -> ShakebookA r a -> ShakebookA r b #

(<$) :: a -> ShakebookA r b -> ShakebookA r a #

Applicative (ShakebookA r) Source # 
Instance details

Defined in Shakebook.Data

Methods

pure :: a -> ShakebookA r a #

(<*>) :: ShakebookA r (a -> b) -> ShakebookA r a -> ShakebookA r b #

liftA2 :: (a -> b -> c) -> ShakebookA r a -> ShakebookA r b -> ShakebookA r c #

(*>) :: ShakebookA r a -> ShakebookA r b -> ShakebookA r b #

(<*) :: ShakebookA r a -> ShakebookA r b -> ShakebookA r a #

MonadIO (ShakebookA r) Source # 
Instance details

Defined in Shakebook.Data

Methods

liftIO :: IO a -> ShakebookA r a #

MonadAction (ShakebookA r) Source # 
Instance details

Defined in Shakebook.Data

Methods

liftAction :: Action a -> ShakebookA r a Source #

class MonadAction m where Source #

Methods

liftAction :: Action a -> m a Source #

Instances
MonadAction (ShakebookA r) Source # 
Instance details

Defined in Shakebook.Data

Methods

liftAction :: Action a -> ShakebookA r a Source #

class MonadRules m where Source #

Methods

liftRules :: Rules a -> m a Source #

Instances
MonadRules (Shakebook r) Source # 
Instance details

Defined in Shakebook.Data

Methods

liftRules :: Rules a -> Shakebook r a Source #

viewSrcPath :: Value -> Text Source #

View the "srcPath" field of a JSON Value.

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

Add "srcPath" field based on input Text.

withBaseUrl :: Text -> Value -> Value Source #

Add "baseUrl" field from input Text.

withFullUrl :: Text -> Value -> Value Source #

Add "fullUrl" field from input Text.

viewUrl :: Value -> Text Source #

View the "url" field of a JSON Value.

withUrl :: Text -> Value -> Value Source #

Add "url" field from input Text.

enrichFullUrl :: Text -> Value -> Value Source #

Assuming a "url" field, enrich via a baseURL

enrichUrl :: (Text -> Text) -> Value -> Value Source #

Assuming a srcPath field, enrich using withUrl using a Text -> Text transformation.

typicalFullOutToSrcPath :: MonadShakebook r m => m (String -> String) Source #

Filepath/URL calculators - these work but don't try to do the wrong thing or it will explode.

readMarkdownFile' :: MonadShakebookAction r m => String -> m Value Source #

Get a JSON Value of Markdown Data with markdown body as "contents" field and the srcPath as "srcPath" field.

genBuildPageAction Source #

Arguments

:: MonadShakebookAction r m 
=> FilePath

The HTML template

-> (FilePath -> m Value)

How to get from FilePath to Value, can use Actions.

-> (Value -> Value)

Additional modifiers for the value.

-> FilePath

The out filepath

-> m Value 

Build a single page straight from a template, a loaded Value, and a pure enrichment.

traverseToSnd :: Functor f => (a -> f b) -> a -> f (a, b) Source #

loadSortFilterEnrich Source #

Arguments

:: (MonadShakebookAction r m, Ord b) 
=> [FilePattern]

A shake filepattern to load, relative to srcDir from SbConfig.

-> (Value -> b)

A value to sortOn e.g (Down . viewPostTime)

-> (Value -> Bool)

A filtering predicate e.g (elem tag . viewTags)

-> (Value -> Value)

An initial enrichment. This is pure so can only be data derived from the initial markdown.

-> m [(FilePath, Value)]

A list of Values indexed by their srcPath.

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

loadSortEnrich Source #

Arguments

:: (MonadShakebookAction r m, Ord b) 
=> [FilePattern]

A Shake filepattern to load.

-> (Value -> b)

A value to sortOn e.g (Down . viewPostTime).

-> (Value -> Value)

An initial pure enrichment.

-> m [(String, Value)]

A list of Values index by their srcPath.

The same as loadSortFilterEnrich but without filtering.