-
Notifications
You must be signed in to change notification settings - Fork 4
Filter module
donnerjack13589 edited this page Aug 31, 2010
·
4 revisions
This is a standart module included with nTPL.
require("./nTPL.filter");
Note that you must require nTPL before and nTPL.filter.js must be in your project’s folder.
Template
< div >
{%filter safe %}
< script >
alert(" I am evil script! ");
</ script >
{%/filter %}
</ div>
Rendering this template will produce safe code, with brackets replace to <
and >
and other simple replacements.
- safe
- escape
- lower
- upper
Note: Escape will simply run escape
function from javascript
nTPL.filters
is exposed object that is holding all filters for this module.
nTPL.filters["my-filter-name"] = function ( str ) {
return "_" + str + "_"
}