pandoc-2.7.3: Conversion between markup formats

CopyrightCopyright (C) 2009-2019 John MacFarlane
LicenseGNU GPL, version 2 or above
MaintainerJohn MacFarlane <jgm@berkeley.edu>
Stabilityalpha
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Text.Pandoc.Templates

Description

A simple templating system with variable substitution and conditionals.

Synopsis

Documentation

renderTemplate :: (ToJSON a, TemplateTarget b) => Template -> a -> b #

Render a compiled template using context to resolve variables.

compileTemplate :: Text -> Either String Template #

Compile a template.

varListToJSON :: [(String, String)] -> Value #

A convenience function for passing in an association list of string values instead of a JSON Value.

data Template #

A Template is essentially a function that takes a JSON Value and produces Text.

Instances
Semigroup Template 
Instance details

Defined in Text.DocTemplates

Monoid Template 
Instance details

Defined in Text.DocTemplates

class TemplateTarget a #

Minimal complete definition

toTarget

Instances
TemplateTarget String 
Instance details

Defined in Text.DocTemplates

Methods

toTarget :: Text -> String #

TemplateTarget ByteString 
Instance details

Defined in Text.DocTemplates

Methods

toTarget :: Text -> ByteString #

TemplateTarget Text 
Instance details

Defined in Text.DocTemplates

Methods

toTarget :: Text -> Text #

TemplateTarget Html 
Instance details

Defined in Text.DocTemplates

Methods

toTarget :: Text -> Html #

renderTemplate' :: (PandocMonad m, ToJSON a, TemplateTarget b) => String -> a -> m b Source #

Like applyTemplate, but runs in PandocMonad and raises an error if compilation fails.

getDefaultTemplate Source #

Arguments

:: PandocMonad m 
=> String

Name of writer

-> m String 

Get default template for the specified writer.