Copyright | Copyright (C) 2009-2020 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
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.