mustache-2.3.0: A mustache template parser library.

Copyright | (c) Justus Adam 2015
License | BSD3
Maintainer | dev@justus.science
Stability | experimental
Portability | POSIX
Safe Haskell | None
Language | Haskell2010

Text.Mustache.Parser

Contents

- Generic parsing functions
- Configurations
- Parser
- Mustache Constants

Description

Synopsis

- parse :: FilePath -> Text -> Either ParseError STree
- parseWithConf :: MustacheConf -> FilePath -> Text -> Either ParseError STree
- data MustacheConf = MustacheConf {
  - delimiters :: (String, String)
  }
- defaultConf :: MustacheConf
- type Parser = Parsec Text MustacheState
- data MustacheState
- sectionBegin :: Char
- sectionEnd :: Char
- invertedSectionBegin :: Char
- unescape2 :: (Char, Char)
- unescape1 :: Char
- delimiterChange :: Char
- nestingSeparator :: Char

# Generic parsing functions

parse :: FilePath -> Text -> Either ParseError STree Source #

Runs the parser for a mustache template, returning the syntax tree.

parseWithConf :: MustacheConf -> FilePath -> Text -> Either ParseError STree Source #

Parse using a custom initial configuration

# Configurations

data MustacheConf Source #

Initial configuration for the parser

Constructors

MustacheConf |

Fields

- delimiters :: (String, String)

defaultConf :: MustacheConf Source #

Default configuration (delimiters = ("{{", "}}"))

# Parser

type Parser = Parsec Text MustacheState Source #

The parser monad in use

data MustacheState Source #

User state for the parser

# Mustache Constants

sectionBegin :: Char Source #

    #

sectionEnd :: Char Source #

    /

invertedSectionBegin :: Char Source #

    ^

unescape2 :: (Char, Char) Source #

`{` and `}`

unescape1 :: Char Source #

    &

delimiterChange :: Char Source #

    =

nestingSeparator :: Char Source #

    .