Copyright | Copyright (C) 2009-2021 John MacFarlane |
---|---|
License | GNU GPL, version 2 or above |
Maintainer | John MacFarlane <jgm@berkeley.edu> |
Stability | alpha |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Utility functions for working with pandoc templates.
Synopsis
- data Template a
- newtype WithDefaultPartials m a = WithDefaultPartials {
- runWithDefaultPartials :: m a
- newtype WithPartials m a = WithPartials {
- runWithPartials :: m a
- compileTemplate :: (TemplateMonad m, TemplateTarget a) => FilePath -> Text -> m (Either String (Template a))
- renderTemplate :: (TemplateTarget a, ToContext a b) => Template a -> b -> Doc a
- getTemplate :: PandocMonad m => FilePath -> m Text
- getDefaultTemplate :: PandocMonad m => Text -> m Text
- compileDefaultTemplate :: PandocMonad m => Text -> m (Template Text)
Documentation
A template.
Instances
newtype WithDefaultPartials m a Source #
Wrap a Monad in this if you want partials to be taken only from the default data files.
Instances
newtype WithPartials m a Source #
Wrap a Monad in this if you want partials to be looked for locally (or, when the main template is at a URL, via HTTP), falling back to default data files.
WithPartials | |
|
Instances
Monad m => Monad (WithPartials m) Source # | |
Defined in Text.Pandoc.Templates (>>=) :: WithPartials m a -> (a -> WithPartials m b) -> WithPartials m b # (>>) :: WithPartials m a -> WithPartials m b -> WithPartials m b # return :: a -> WithPartials m a # | |
Functor m => Functor (WithPartials m) Source # | |
Defined in Text.Pandoc.Templates fmap :: (a -> b) -> WithPartials m a -> WithPartials m b # (<$) :: a -> WithPartials m b -> WithPartials m a # | |
Applicative m => Applicative (WithPartials m) Source # | |
Defined in Text.Pandoc.Templates pure :: a -> WithPartials m a # (<*>) :: WithPartials m (a -> b) -> WithPartials m a -> WithPartials m b # liftA2 :: (a -> b -> c) -> WithPartials m a -> WithPartials m b -> WithPartials m c # (*>) :: WithPartials m a -> WithPartials m b -> WithPartials m b # (<*) :: WithPartials m a -> WithPartials m b -> WithPartials m a # | |
PandocMonad m => TemplateMonad (WithPartials m) Source # | |
Defined in Text.Pandoc.Templates getPartial :: FilePath -> WithPartials m Text # |
compileTemplate :: (TemplateMonad m, TemplateTarget a) => FilePath -> Text -> m (Either String (Template a)) #
Compile a template. The FilePath parameter is used to determine a default path and extension for partials and may be left empty if partials are not used.
renderTemplate :: (TemplateTarget a, ToContext a b) => Template a -> b -> Doc a #
Render a compiled template in a "context" which provides values for the template's variables.
getTemplate :: PandocMonad m => FilePath -> m Text Source #
Retrieve text for a template.
:: PandocMonad m | |
=> Text | Name of writer |
-> m Text |
Get default template for the specified writer.
compileDefaultTemplate :: PandocMonad m => Text -> m (Template Text) Source #
Get and compile default template for the specified writer. Raise an error on compilation failure.