TemplateParser
Module | ejs.template |
Definition | class TemplateParser |
Inheritance | TemplateParser ![]() |
Specified | ejscript-2.5 |
Stability | Prototype (. |
Web Page Template Parser - Parse an ejs web page and emit an Ejscript source file (.es).
This parser handles embedded Ejscript using <% %> directives. It supports:
- <% Begin an ejs directive section containing statements
- <%= Begin an ejs directive section that contains an expression to evaluate and substitute
- %> End an ejs directive
- <%@ include "file" %> Include an ejs file
- <%@ layout "file" %> Specify a layout page to use. Use layout "" to disable layout management.
- <%@ view "[module::]class" %> Specify a view class to use with optional module.
- <%@ content Mark the location to substitute content in a layout page
- @@var — To expand the value of "var". Var can also be simple expressions (without spaces).
Properties
(No own properties defined)
TemplateParser Class Methods
Qualifiers | Method |
---|
TemplateParser Instance Methods
Qualifiers | Method |
---|---|
build(script: String, options: Object = expression): String | |
Build a templated page. | |
parse(script: String, options: Object = expression): String | |
Template parser. |
Method Detail
- Description
- Build a templated page.
- Parameters
script: String String containing the script to parse. options: Object Object hash with options to control parsing. [default: expression]
- Options
layout Path Layout file. dir Path Base directory to use for including files and for resolving layout directives.
- Description
- Template parser. Parse the given script and return the compiled (Ejscript) result.
- Parameters
script: String String containing the script to parse. options: Object Object hash with options to control parsing. [default: expression]
- Options
layout Path Layout file. dir Path Base directory to use for including files and for resolving layout directives.
- Returns
- The parsed and expanded template P.