Skip to content

Commit

Permalink
Merge branch 'hamlet-2' of https://github.com/gregwebs/consolidate.js
Browse files Browse the repository at this point in the history
…into gregwebs-hamlet-2
  • Loading branch information
doowb committed Feb 7, 2015
2 parents 223ef59 + 8592fed commit 9ad9c9b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- [ejs](https://github.com/visionmedia/ejs)
- [haml](https://github.com/visionmedia/haml.js) [(website)](http://haml-lang.com/)
- [haml-coffee](https://github.com/9elements/haml-coffee) [(website)](http://haml-lang.com/)
- [hamlet](https://github.com/gregwebs/hamlet.js)
- [handlebars](https://github.com/wycats/handlebars.js/) [(website)](http://handlebarsjs.com/)
- [hogan](https://github.com/twitter/hogan.js) [(website)](http://twitter.github.com/hogan.js/)
- [htmling](https://github.com/codemix/htmling)
Expand Down
20 changes: 20 additions & 0 deletions lib/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,26 @@ exports.haml.render = function(str, options, fn){
}
};

/**
* Hamlet support.
*/

exports.hamlet = fromStringRenderer('hamlet');

/**
* Hamlet string support.
*/

exports.hamlet.render = function(str, options, fn){
var engine = requires.hamlet || (requires.hamlet = require('hamlet'));
try {
options.locals = options;
fn(null, engine.render(str, options).trimLeft());
} catch (err) {
fn(err);
}
};

/**
* Whiskers support.
*/
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"jqtpl": "1.1.0",
"liquor": "0.0.4",
"lodash": "1.2.0",
"hamlet": "0.3.3",
"hamljs": "0.6.1",
"whiskers": "0.2.2",
"haml-coffee": "1.4.0",
Expand Down
1 change: 1 addition & 0 deletions test/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require('./shared').test('jazz');
require('./shared').test('jqtpl');
require('./shared').test('liquor');
require('./shared').test('haml');
require('./shared').test('hamlet');
require('./shared').test('eco');
require('./shared').test('whiskers');
require('./shared').test('haml-coffee');
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/hamlet/user.hamlet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<p>#{user.name}
>

0 comments on commit 9ad9c9b

Please sign in to comment.