diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/luigi-template.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/js/luigi-template.js b/js/luigi-template.js index 925b811..5018b7b 100644 --- a/js/luigi-template.js +++ b/js/luigi-template.js @@ -238,8 +238,9 @@ LuigiTemplate = (function() { return r; } - function init(s) { + function init(s, filters) { this.s = s; + this.filters = filters || FILTERS; this.actions = parse_template(s); }; @@ -257,7 +258,7 @@ LuigiTemplate = (function() { throw new Error('missing key: ' + row.key) return reduce(row.filters, function(r, f) { - return FILTERS[f.name](r, f.args, o, this); + return this.filters[f.name](r, f.args, o, this); }, o[row.key]); } else { /* never reached */ @@ -334,8 +335,8 @@ LuigiTemplate = (function() { T.VERSION = VERSION; // add singleton run - T.run = function(s, o) { - return new T(s).run(o); + T.run = function(s, o, f) { + return new T(s, f).run(o); } // expose interface |