ginger-0.1.5.0: An implementation of the Jinja2 template language in Haskell

Safe HaskellNone
LanguageHaskell2010

Text.Ginger.Parse

Description

Ginger parser.

Synopsis

Documentation

parseGinger :: Monad m => IncludeResolver m -> Maybe SourceName -> Source -> m (Either ParserError Template) Source

Parse Ginger source from memory.

parseGingerFile :: Monad m => IncludeResolver m -> SourceName -> m (Either ParserError Template) Source

Parse Ginger source from a file.

data ParserError Source

Error information for Ginger parser errors.

Constructors

ParserError 

Fields

peErrorMessage :: String

Human-readable error message

peSourceName :: Maybe SourceName

Source name, if any

peSourceLine :: Maybe Int

Line number, if available

peSourceColumn :: Maybe Int

Column number, if available

type IncludeResolver m = SourceName -> m (Maybe Source) Source

Used to resolve includes. Ginger will call this function whenever it encounters an {% include %}, {% import %}, or {% extends %} directive. If the required source code is not available, the resolver should return Nothing, else Just the source.

type Source = String Source

Input type for the parser (source code).

type SourceName = String Source

A source identifier (typically a filename).