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

CopyrightCopyright (C) 2020 Daniel Firth
MaintainerDaniel Firth <dan.firth@homotopic.tech
Safe HaskellNone
LanguageHaskell2010

Shakebook.Pandoc

Contents

Description

License : MIT Stability : experimental

Pandoc utilities lifted to MonadAction.

Synopsis

runPandocA

runPandocA :: (MonadAction m, MonadThrow m) => PandocIO a -> m a Source #

Natural transformation from PandocIO to a MonadAction

Readers

readFilePandoc :: (MonadAction m, MonadThrow m, FileLike b a) => (ReaderOptions -> Text -> PandocIO Pandoc) -> ReaderOptions -> a -> m Pandoc Source #

Run a Pandoc reader as a Shake action.

readCSVFile :: (MonadAction m, MonadThrow m, FileLike b a) => ReaderOptions -> a -> m Pandoc Source #

Read a CSV file and return a Pandoc as an Action.

readLaTeXFile :: (MonadAction m, MonadThrow m, FileLike b a) => ReaderOptions -> a -> m Pandoc Source #

Read a LaTeX file and return a Pandoc as an Action.

readMarkdownFile :: (MonadAction m, MonadThrow m, FileLike b a) => ReaderOptions -> a -> m Pandoc Source #

Read a markdown file and return a Pandoc as an Action.

readMediaWikiFile :: (MonadAction m, MonadThrow m, FileLike b a) => ReaderOptions -> a -> m Pandoc Source #

Read a mediawiki file and return a Pandoc as an Action.

loadMarkdownAsJSON :: (MonadAction m, MonadThrow m) => ReaderOptions -> WriterOptions -> Within Rel (Path Rel File) -> m Value Source #

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

Writers

makePDFLaTeX :: (MonadAction m, MonadThrow m) => WriterOptions -> Pandoc -> m ByteString Source #

Make a pdflatex in an Action.

File Rules

needPandocImagesIn :: (MonadAction m, MonadThrow m) => Path Rel Dir -> Pandoc -> m () Source #

Find all the images in a Pandoc data structure and call need on them.

Filters

flattenMeta :: MonadAction m => (Pandoc -> PandocIO Text) -> Meta -> m Value Source #

Flatten a pandoc Meta object to a Value.

prefixAllImages :: Path Rel Dir -> Pandoc -> Pandoc Source #

Prefix all images in a Pandoc with a directory.

progressivelyDemoteHeaders :: Cofree [] Pandoc -> Cofree [] Pandoc Source #

Precarious function that demotes Header numbers within the Pandoc according to its depth in the Cofree. This is so that Headers that H1s that would correctly display for an HTML page will be lower in the table of contents in the PDF equivalent.

replaceUnusableImages :: MonadThrow m => [String] -> (Text -> Inline) -> Pandoc -> m Pandoc Source #

For a list of file extensions, replace the images with an Inline based on its src path.

Lenses

viewContent :: ToJSON a => a -> Text Source #

View the "content" field of a JSON value.

viewSrcPath :: ToJSON a => a -> Text Source #

View the "src-path" field of a JSON Value.

viewUrl :: ToJSON a => a -> Text Source #

View the "url" field of a JSON Value.