Skip to content

Commit

Permalink
Merge pull request #261 from danlevan/bracket
Browse files Browse the repository at this point in the history
Added support for bracket-template
  • Loading branch information
niftylettuce authored Nov 17, 2016
2 parents 122cb94 + 053ddb2 commit 3b279ea
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
## Supported template engines

- [atpl](https://github.com/soywiz/atpl.js)
- [bracket](https://github.com/danlevan/bracket-template)
- [doT.js](https://github.com/olado/doT) [(website)](http://olado.github.io/doT/)
- [dust (unmaintained)](https://github.com/akdubya/dustjs) [(website)](http://akdubya.github.com/dustjs/)
- [dustjs-linkedin (maintained fork of dust)](https://github.com/linkedin/dustjs) [(website)](http://linkedin.github.io/dustjs/)
Expand Down
22 changes: 22 additions & 0 deletions lib/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,28 @@ exports.dot.render = function (str, options, fn) {
});
};

/**
* bracket support.
*/

exports.bracket = fromStringRenderer('bracket');

/**
* bracket string support.
*/

exports.bracket.render = function (str, options, fn) {
return promisify(fn, function (fn) {
var engine = requires.bracket || (requires.bracket = require('bracket-template'));
try {
var tmpl = cache(options) || cache(options, engine.default.compile(str));
fn(null, tmpl(options));
} catch (err) {
fn(err);
}
});
};

/**
* Ractive support.
*/
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"atpl": ">=0.7.6",
"babel-core": "^6.7.6",
"babel-preset-react": "^6.5.0",
"bracket-template": "^1.0.3",
"dot": "^1.0.1",
"dust": "^0.3.0",
"dustjs-helpers": "^1.1.1",
Expand Down
1 change: 1 addition & 0 deletions test/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ require('./shared/filters').test('arc-templates');
require('./shared/includes').test('arc-templates');
require('./shared/partials').test('arc-templates');
require('./shared').test('marko');
require('./shared').test('bracket');
1 change: 1 addition & 0 deletions test/fixtures/bracket/user.bracket
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>[[= model.user.name ]]</p>

0 comments on commit 3b279ea

Please sign in to comment.