liquid-0.1.0.1: Liquid template language library

Safe HaskellNone
LanguageHaskell2010

Text.Liquid.Renderer

Synopsis

Documentation

interpretWithJson Source

Arguments

:: Value

JSON context

-> Text

Raw template

-> Rendering Text 

Interpret function - for use in testing the lib

interpret :: Value -> [Expr] -> Rendering Text Source

Interpret the raw data if it is ok

renderTemplate :: Value -> Expr -> Rendering Text Source

Rendering types

Main template block rendering fn

evalLogic Source

Arguments

:: Value

JSON Context

-> Rendering Bool

Predicate / logical expression result

-> [Expr]

Expressions to evaluate if true

-> Rendering Text 

Evaluate predicate result and render

evalCaseLogic Source

Arguments

:: Value 
-> Rendering Value

Extracted JSON value for case match

-> [(Expr, Expr)] 
-> Rendering Text 

Evaluate case logic

renderText :: Value -> Expr -> Rendering Text Source

Render a renderable Expr as Text

numberOrTextFormat :: Rendering Value -> Rendering Text Source

Format variable as either number or Text

evalKeyTruthiness :: Value -> Expr -> Rendering Bool Source

Eval key present & not null

containsCheck :: Value -> Expr -> Expr -> Rendering Bool Source

Check if the variable contains the thing on the rhs

getStringsFromArray :: Value -> [Text] Source

Aggregate all the strings in the underlying array - if present

getNumbersFromArray :: Value -> [Scientific] Source

Aggregate all the numbers in the underlying array - if present

varComparisons :: Value -> (Maybe Scientific -> Maybe Scientific -> Bool) -> Expr -> Expr -> Rendering Bool Source

Truth evaluation with variables ONLY numberic comparison allowed, text comparisons not supported

bothSidesEqual Source

Arguments

:: Value

JSON context

-> Expr

lhs

-> Expr

rhs

-> Rendering Bool 

Evaluate a binary comparison

extractValue :: Value -> JsonVarPath -> Rendering Value Source

Fold over multiple layers of variable syntax, and deal with future event nesting

applyFilter :: Value -> Expr -> Rendering Text Source

Apply a filter to the input

applyCellsM :: Value -> [Expr] -> Maybe Text Source

Apply a chain of functions from l -> r

applyFilterM Source

Arguments

:: Text

LHS

-> Expr

FilterCell

-> Maybe Text 

Apply a filter

arrayFilterM :: Value -> Expr -> Maybe Text Source

Apply the array filter if the targeted value is an array, otherwise the reg filter

applyArrayFilterM :: [Value] -> Expr -> Maybe Text Source

Apply an array filter to an array

renderEachArrayElem :: [Value] -> Maybe [Text] Source

Render each array element (can only contain strings or numbers!)