Parse templates with logic [singleton].
| js. | Parse templates with logic [singleton]. |
| Variables | |
| options | parser config |
| Functions | |
| parse | parse template string. |
| findTemplate | |
| parser | |
| tokenize | split logic template to tokens |
| generateJS | generate native JS from <parsedTree> |
| replace | templater was written on PHP, so this function is port from it. |
| buildLine | Builds php or js string. |
| braceVar | add braces and quotes to var name |
| makeVariableName | make full variable name |
| trim | right trim |
| isArray | check if obj is Array |
| toArray | makes array |
| lCase | toLowerCase wrapper |
| addSlashes | wraps slashes with more slashes |
| getJSF | return JS template function |
| js. | |
| Functions | |
| collectorNew | Creates collectors. |
| collectorPush | Pushes element in collector |
| o | Function makes object from Array or pass as is if object. |
| l | Get Object\Array length. |
parse: function( text, identity )
parse template string. Wraps parser
| text | template string |
<parsedTree>
replace: function( search, replace, subject )
templater was written on PHP, so this function is port from it. It do one replacement of each search
| search | array of substring to search |
| replace | array of substring to replace ( replaces have equal indexes to search array) |
| subject | string |
replaced string
| Functions | |
| collectorNew | Creates collectors. |
| collectorPush | Pushes element in collector |
| o | Function makes object from Array or pass as is if object. |
| l | Get Object\Array length. |
parser config
options: { braces: [ '{{', '}}' ], replaceArray: { 'and': '&&', 'or': '||', 'not': '!' }, 'checkVars': true, 'cache': true }
parse template string.
parse: function( text, identity )
findTemplate: function( text )
parser: function( text )
split logic template to tokens
tokenize: function( text, lastTID )
generate native JS from parsedTree
generateJS: function ( identity )
templater was written on PHP, so this function is port from it.
replace: function( search, replace, subject )
Builds php or js string.
buildLine: function( text, logic, php, checkVars )
add braces and quotes to var name
braceVar: function( aVar, autoQuote )
make full variable name
makeVariableName: function( aVar, php, checkVars )
right trim
trim: function( text )
check if obj is Array
isArray: function( obj )
makes array
toArray: function( obj )
toLowerCase wrapper
lCase:function( text )
wraps slashes with more slashes
addSlashes: function( str )
return JS template function
getJSF: function( text )
Creates collectors.
collectorNew: function( )
Pushes element in collector
collectorPush: function( name, val )
Function makes object from Array or pass as is if object.
o: function( a )