-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Small template engine -- -- Haskell implementation of a subset of the PHP-Smarty template language @package HSmarty @version 0.4.2 module Text.HSmarty.Parser.Util eolP :: Parser Text boolP :: Parser Bool stringP :: Parser Text identP :: (Char -> Bool) -> (Char -> Bool) -> Parser Text stripSpace :: forall c. Parser c -> Parser c space_ :: Parser () optSpace_ :: Parser () between :: Parser a -> Parser b -> Parser c -> Parser c skipWhile1 :: (Char -> Bool) -> Parser () quotedString :: Char -> Parser Text escapeSeq :: Parser Char unicodeSeq :: Parser Char decodeHexUnsafe :: String -> Integer hexDigitUpper :: Parser Char hexDigit :: Parser Char braced :: Parser l -> Parser r -> Parser a -> Parser a listLike :: Parser l -> Parser r -> Parser s -> Parser a -> Parser [a] tupleP :: Parser p -> Parser [p] module Text.HSmarty.Types data Smarty Smarty :: FilePath -> [SmartyStmt] -> Smarty [s_name] :: Smarty -> FilePath [s_template] :: Smarty -> [SmartyStmt] type PrintDirective = Text data SmartyStmt SmartyText :: Text -> SmartyStmt SmartyComment :: Text -> SmartyStmt SmartyIf :: If -> SmartyStmt SmartyForeach :: Foreach -> SmartyStmt SmartyCapture :: Capture -> SmartyStmt SmartyLet :: Let -> SmartyStmt SmartyPrint :: Expr -> [PrintDirective] -> SmartyStmt SmartyScope :: Scope -> SmartyStmt SmartyFun :: FunctionDef -> SmartyStmt data Expr ExprVar :: Variable -> Expr ExprLit :: Value -> Expr ExprFun :: FunctionCall -> Expr ExprBin :: BinOp -> Expr data Variable Variable :: Text -> [Text] -> Maybe Expr -> Maybe Text -> Variable [v_name] :: Variable -> Text [v_path] :: Variable -> [Text] [v_index] :: Variable -> Maybe Expr [v_prop] :: Variable -> Maybe Text data FunctionCall FunctionCall :: Text -> [(Text, Expr)] -> FunctionCall [f_name] :: FunctionCall -> Text [f_args] :: FunctionCall -> [(Text, Expr)] data BinOp BinEq :: Expr -> Expr -> BinOp BinNot :: Expr -> BinOp BinAnd :: Expr -> Expr -> BinOp BinOr :: Expr -> Expr -> BinOp BinLarger :: Expr -> Expr -> BinOp BinSmaller :: Expr -> Expr -> BinOp BinLargerEq :: Expr -> Expr -> BinOp BinSmallerEq :: Expr -> Expr -> BinOp BinPlus :: Expr -> Expr -> BinOp BinMinus :: Expr -> Expr -> BinOp BinMul :: Expr -> Expr -> BinOp BinDiv :: Expr -> Expr -> BinOp data Let Let :: Text -> Expr -> Let [l_name] :: Let -> Text [l_expr] :: Let -> Expr data Scope Scope :: [SmartyStmt] -> Scope [s_stmts] :: Scope -> [SmartyStmt] data Capture Capture :: Text -> Maybe Text -> [SmartyStmt] -> Capture [c_name] :: Capture -> Text [c_assign] :: Capture -> Maybe Text [c_stmts] :: Capture -> [SmartyStmt] data FunctionDef FunctionDef :: Text -> [(Text, Expr)] -> [SmartyStmt] -> FunctionDef [fd_name] :: FunctionDef -> Text [fd_defArgs] :: FunctionDef -> [(Text, Expr)] [fd_body] :: FunctionDef -> [SmartyStmt] data If If :: [(Expr, [SmartyStmt])] -> Maybe [SmartyStmt] -> If [if_cases] :: If -> [(Expr, [SmartyStmt])] [if_else] :: If -> Maybe [SmartyStmt] data Foreach Foreach :: Expr -> Maybe Text -> Text -> [SmartyStmt] -> Maybe [SmartyStmt] -> Foreach [f_source] :: Foreach -> Expr [f_key] :: Foreach -> Maybe Text [f_item] :: Foreach -> Text [f_body] :: Foreach -> [SmartyStmt] [f_else] :: Foreach -> Maybe [SmartyStmt] instance GHC.Show.Show Text.HSmarty.Types.Variable instance GHC.Classes.Eq Text.HSmarty.Types.Variable instance GHC.Show.Show Text.HSmarty.Types.FunctionCall instance GHC.Classes.Eq Text.HSmarty.Types.FunctionCall instance GHC.Show.Show Text.HSmarty.Types.Expr instance GHC.Classes.Eq Text.HSmarty.Types.Expr instance GHC.Show.Show Text.HSmarty.Types.BinOp instance GHC.Classes.Eq Text.HSmarty.Types.BinOp instance GHC.Classes.Eq Text.HSmarty.Types.Let instance GHC.Show.Show Text.HSmarty.Types.Let instance GHC.Classes.Eq Text.HSmarty.Types.Scope instance GHC.Show.Show Text.HSmarty.Types.Scope instance GHC.Classes.Eq Text.HSmarty.Types.Capture instance GHC.Show.Show Text.HSmarty.Types.Capture instance GHC.Classes.Eq Text.HSmarty.Types.FunctionDef instance GHC.Show.Show Text.HSmarty.Types.FunctionDef instance GHC.Show.Show Text.HSmarty.Types.If instance GHC.Classes.Eq Text.HSmarty.Types.If instance GHC.Show.Show Text.HSmarty.Types.SmartyStmt instance GHC.Classes.Eq Text.HSmarty.Types.SmartyStmt instance GHC.Show.Show Text.HSmarty.Types.Foreach instance GHC.Classes.Eq Text.HSmarty.Types.Foreach instance GHC.Show.Show Text.HSmarty.Types.Smarty instance GHC.Classes.Eq Text.HSmarty.Types.Smarty module Text.HSmarty.Parser.Smarty parseSmarty :: MonadFail m => FilePath -> Text -> m Smarty pRoot :: Parser [SmartyStmt] pStmt :: Parser SmartyStmt pPrintDirective :: Parser PrintDirective pExpr :: Parser Expr pValExpr :: Parser Expr pLit :: Parser Value pVar :: Parser Variable pName :: Parser Text pLiteral :: Parser Text pComment :: Parser Text pFunCall :: Parser FunctionCall pOpen :: Text -> Parser Text pOpenExpr :: Text -> Parser Expr pClose :: Text -> Parser Text pLet :: Parser Let pScope :: Parser Scope pCapture :: Parser Capture pFunDef :: Parser FunctionDef pIf :: Parser If pForeach :: Parser Foreach opTable :: [[Operator Text Expr]] module Text.HSmarty -- | Maps template variables to template params type ParamMap = HashMap Text Value mkParam :: ToJSON a => a -> Value data SmartyCtx newtype SmartyError SmartyError :: Text -> SmartyError [unSmartyError] :: SmartyError -> Text -- | Parse and compile a template prepareTemplate :: FilePath -> IO SmartyCtx -- | Parse and compiles templates matching a glob in a directiry prepareTemplates :: String -> FilePath -> IO SmartyCtx -- | Fill a template with values and print it as Text applyTemplate :: FilePath -> SmartyCtx -> ParamMap -> Either SmartyError Text -- | Fill a template with values and print it as Text applyTemplateFromJson :: ToJSON a => FilePath -> SmartyCtx -> a -> Either SmartyError Text