From a09a0785bcd7c544ba0b5dd8d2cef20ce0aaa4ea Mon Sep 17 00:00:00 2001 From: study Date: Wed, 23 Jan 2013 20:25:38 -0800 Subject: [PATCH 01/32] some changes --- package.json | 3 ++- test/consolidate.js | 3 ++- test/fixtures/plates/user.html | 1 + test/shared/index.js | 12 ++++++------ 4 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 test/fixtures/plates/user.html diff --git a/package.json b/package.json index 41475bc..8d814d3 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "ect": "0.2.10", "mote": "0.2.0", "toffee": "0.0.52", - "atpl": ">=0.5.5" + "atpl": ">=0.5.5", + "plates": "~0.4.8" }, "main": "index", "scripts": { diff --git a/test/consolidate.js b/test/consolidate.js index d4ec8f8..36d7ca5 100644 --- a/test/consolidate.js +++ b/test/consolidate.js @@ -24,4 +24,5 @@ require('./shared').test('just'); require('./shared').test('ect'); require('./shared').test('mote'); require('./shared').test('toffee'); -require('./shared').test('atpl'); +//require('./shared').test('atpl'); +require('./shared').test('plates'); diff --git a/test/fixtures/plates/user.html b/test/fixtures/plates/user.html new file mode 100644 index 0000000..8e68b1f --- /dev/null +++ b/test/fixtures/plates/user.html @@ -0,0 +1 @@ +

diff --git a/test/shared/index.js b/test/shared/index.js index 200cbbb..4612f34 100644 --- a/test/shared/index.js +++ b/test/shared/index.js @@ -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('

Tobi

'); + html.should.match(/Tobi/); done(); }); }); @@ -40,10 +40,10 @@ exports.test = function(name) { cons[name](path, locals, function(err, html){ if (err) return done(err); - html.should.equal('

Tobi

'); + html.should.match(/Tobi/); cons[name](path, locals, function(err, html){ if (err) return done(err); - html.should.equal('

Tobi

'); + html.should.match(/Tobi/); calls.should.equal(2); done(); }); @@ -61,10 +61,10 @@ exports.test = function(name) { done(new Error('fs.readFile() called with ' + path)); }; - html.should.equal('

Tobi

'); + html.should.match(/Tobi/); cons[name](path, locals, function(err, html){ if (err) return done(err); - html.should.equal('

Tobi

'); + html.should.match(/Tobi/); done(); }); }); @@ -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('

Tobi

'); + html.should.match(/Tobi/); done(); }); }); From f416c41bc635142a1a678303f72a1293ad71c3eb Mon Sep 17 00:00:00 2001 From: Derek Worthen Date: Wed, 23 Jan 2013 21:01:08 -0800 Subject: [PATCH 02/32] Added support for Plates --- lib/consolidate.js | 21 +++++++++++++++++++++ test/fixtures/plates/user.plates | 1 + 2 files changed, 22 insertions(+) create mode 100644 test/fixtures/plates/user.plates diff --git a/lib/consolidate.js b/lib/consolidate.js index 3f664ad..fe1019a 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -654,3 +654,24 @@ exports.toffee.render = function(str, options, fn) { fn(err); } } + +/** +* 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 = cache(options) || cache(options, engine.bind(str, options, map)); + fn(null, tmpl); + } catch (err) { + fn(err); + } +} diff --git a/test/fixtures/plates/user.plates b/test/fixtures/plates/user.plates new file mode 100644 index 0000000..8e68b1f --- /dev/null +++ b/test/fixtures/plates/user.plates @@ -0,0 +1 @@ +

From 49cb9ae365bf9fc5abdb31322d6f19b7d2b68f19 Mon Sep 17 00:00:00 2001 From: Derek Worthen Date: Wed, 23 Jan 2013 21:27:02 -0800 Subject: [PATCH 03/32] Added support for Plates --- test/consolidate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/consolidate.js b/test/consolidate.js index 36d7ca5..d878190 100644 --- a/test/consolidate.js +++ b/test/consolidate.js @@ -24,5 +24,5 @@ require('./shared').test('just'); require('./shared').test('ect'); require('./shared').test('mote'); require('./shared').test('toffee'); -//require('./shared').test('atpl'); +require('./shared').test('atpl'); require('./shared').test('plates'); From 09f81382efb5b7219310020df9fe7f81f35f544c Mon Sep 17 00:00:00 2001 From: Derek Worthen Date: Wed, 23 Jan 2013 21:48:07 -0800 Subject: [PATCH 04/32] Added plates support --- Readme.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Readme.md b/Readme.md index 5a0ac33..875469f 100644 --- a/Readme.md +++ b/Readme.md @@ -23,6 +23,7 @@ - [JUST](https://github.com/baryshev/just) - [liquor](https://github.com/chjj/liquor) - [mustache](https://github.com/janl/mustache.js) + - [plates](https://github.com/flatiron/plates) - [QEJS](https://github.com/jepso/QEJS) - [swig](https://github.com/paularmstrong/swig) [(website)](http://paularmstrong.github.com/swig/) - [toffee](https://github.com/malgorithms/toffee) @@ -67,6 +68,27 @@ cons[name]('views/page.html', { user: 'tobi' }, function(err, html){ console.log(html); }); ``` +### Example using [Plates](https://github.com/flatiron/plates) + +Since plates' bind method accepts a third argument, a map object, consolidate has to map arguments to plates differently than the other engines. To pass a map object to the template add it to options.map. + +```js +var cons = require('consolidate') + , _map = require('plates').Map(); + +_map.class('list').append('views/partial.html', {item: ['one', 'two']}); +cons.plates('views/user.html', {user: 'Tobi', map: _map}, function(err, html) { + if (err) throw err; + console.log(html); +}); + +// user.html +<p id="user"></p> +<ul class="list">> + +// partial.html +<li id="item"></item> +``` ## Caching From 165ec4a5acd13a63a0583897b67c547c0726b758 Mon Sep 17 00:00:00 2001 From: Derek Worthen Date: Wed, 23 Jan 2013 21:49:30 -0800 Subject: [PATCH 05/32] Added plates support --- Readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Readme.md b/Readme.md index 875469f..5c5799e 100644 --- a/Readme.md +++ b/Readme.md @@ -81,7 +81,9 @@ cons.plates('views/user.html', {user: 'Tobi', map: _map}, function(err, html) { if (err) throw err; console.log(html); }); +``` +```html // user.html <p id="user"></p> <ul class="list">> From 2abaf761b35d0092761235e0390f50e01185b1bf Mon Sep 17 00:00:00 2001 From: Derek Worthen Date: Wed, 23 Jan 2013 21:51:01 -0800 Subject: [PATCH 06/32] Added plates support --- Readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 5c5799e..22ad487 100644 --- a/Readme.md +++ b/Readme.md @@ -85,11 +85,11 @@ cons.plates('views/user.html', {user: 'Tobi', map: _map}, function(err, html) { ```html // user.html -<p id="user"></p> -<ul class="list">> +

+
    // partial.html -<li id="item"></item> +
  • ``` ## Caching From 0dec7b08c3145183c21ee5ee633d33decf993635 Mon Sep 17 00:00:00 2001 From: Derek Worthen Date: Wed, 23 Jan 2013 21:52:51 -0800 Subject: [PATCH 07/32] Added plates support --- Readme.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Readme.md b/Readme.md index 22ad487..34f47ca 100644 --- a/Readme.md +++ b/Readme.md @@ -83,15 +83,6 @@ cons.plates('views/user.html', {user: 'Tobi', map: _map}, function(err, html) { }); ``` -```html -// user.html -

    -
      - -// partial.html -
    • -``` - ## Caching To enable caching simply pass `{ cache: true }`. Engines _may_ use this option to cache things reading the file contents, compiled `Function`s etc. Engines which do _not_ support this may simply ignore it. All engines that consolidate.js implements I/O for will cache the file contents, ideal for production environments. From 8c1ea5285ffdaaaa49e4935a421d425ab21f6944 Mon Sep 17 00:00:00 2001 From: Derek Worthen Date: Wed, 23 Jan 2013 21:57:01 -0800 Subject: [PATCH 08/32] Added plates support --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 34f47ca..8d83cbb 100644 --- a/Readme.md +++ b/Readme.md @@ -70,7 +70,7 @@ cons[name]('views/page.html', { user: 'tobi' }, function(err, html){ ``` ### Example using [Plates](https://github.com/flatiron/plates) -Since plates' bind method accepts a third argument, a map object, consolidate has to map arguments to plates differently than the other engines. To pass a map object to the template add it to options.map. +Plates accepts an optional third argument, a mapping object. To pass a map object through consolidate add it to options.map. ```js var cons = require('consolidate') From 4888af3790863195897af3b0b8d8d67d37872f71 Mon Sep 17 00:00:00 2001 From: Derek Worthen Date: Mon, 4 Feb 2013 19:54:01 -0800 Subject: [PATCH 09/32] Fixed caching issue --- Readme.md | 14 -------------- lib/consolidate.js | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/Readme.md b/Readme.md index 8d83cbb..5557ca6 100644 --- a/Readme.md +++ b/Readme.md @@ -68,20 +68,6 @@ cons[name]('views/page.html', { user: 'tobi' }, function(err, html){ console.log(html); }); ``` -### Example using [Plates](https://github.com/flatiron/plates) - -Plates accepts an optional third argument, a mapping object. To pass a map object through consolidate add it to options.map. - -```js -var cons = require('consolidate') - , _map = require('plates').Map(); - -_map.class('list').append('views/partial.html', {item: ['one', 'two']}); -cons.plates('views/user.html', {user: 'Tobi', map: _map}, function(err, html) { - if (err) throw err; - console.log(html); -}); -``` ## Caching diff --git a/lib/consolidate.js b/lib/consolidate.js index fe1019a..5511454 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -669,7 +669,7 @@ exports.plates.render = function(str, options, fn) { var engine = requires.plates || (requires.plates = require('plates')) , map = options.map || undefined; try { - var tmpl = cache(options) || cache(options, engine.bind(str, options, map)); + var tmpl = engine.bind(str, options, map); fn(null, tmpl); } catch (err) { fn(err); From 65e0e45f87429047c39974700027622da129692f Mon Sep 17 00:00:00 2001 From: jschall Date: Sun, 23 Jun 2013 11:01:01 -0600 Subject: [PATCH 10/32] Explain caching better in Readme.md --- Readme.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Readme.md b/Readme.md index d00de1e..ce24de2 100644 --- a/Readme.md +++ b/Readme.md @@ -72,14 +72,8 @@ cons[name]('views/page.html', { user: 'tobi' }, function(err, html){ ## Caching To enable caching simply pass `{ cache: true }`. Engines _may_ use this option to cache things reading the file contents, compiled `Function`s etc. Engines which do _not_ support this may simply ignore it. All engines that consolidate.js implements I/O for will cache the file contents, ideal for production environments. - -```js -var cons = require('consolidate'); -cons.swig('views/page.html', { user: 'tobi' }, function(err, html){ - if (err) throw err; - console.log(html); -}); -``` + When using consolidate directly: `cons.swig('views/page.html', { user: 'tobi', cache:true },callback);` + Using Express 3 or higher: `app.locals.cache = true` or set NODE_ENV to 'production' and Express will do this for you. ## Express 3.x example From 7619b9a05fbea188fad3e60a6f6a21666adeea9d Mon Sep 17 00:00:00 2001 From: Fen Date: Mon, 6 Apr 2015 17:30:38 +0300 Subject: [PATCH 11/32] options overwriting for doT.js --- lib/consolidate.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/consolidate.js b/lib/consolidate.js index 590e1d5..45f5ed2 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -865,8 +865,12 @@ exports.dot = fromStringRenderer('dot'); exports.dot.render = function (str, options, fn) { var engine = requires.dot || (requires.dot = require('dot')); + var extend = (requires.extend || (requires.extend = require('util')._extend)); try { - var tmpl = cache(options) || cache(options, engine.compile(str, options && options._def)); + var settings = {}; + settings = extend(settings, engine.templateSettings); + settings = extend(settings, options ? options.dot : {}); + var tmpl = cache(options) || cache(options, engine.template(str, settings, options && options._def)); fn(null, tmpl(options)); } catch (err) { fn(err); From bcac4381a477c61886811e90f499512da669c206 Mon Sep 17 00:00:00 2001 From: fen Date: Wed, 8 Apr 2015 15:41:42 +0300 Subject: [PATCH 12/32] file data not avaliable in dot.js --- lib/consolidate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/consolidate.js b/lib/consolidate.js index 45f5ed2..16fc033 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -870,7 +870,7 @@ exports.dot.render = function (str, options, fn) { var settings = {}; settings = extend(settings, engine.templateSettings); settings = extend(settings, options ? options.dot : {}); - var tmpl = cache(options) || cache(options, engine.template(str, settings, options && options._def)); + var tmpl = cache(options) || cache(options, engine.template(str, settings, options)); fn(null, tmpl(options)); } catch (err) { fn(err); From 8a9355366c0bd9130f6324451f6450b0f9cdce3f Mon Sep 17 00:00:00 2001 From: vaughan99 Date: Wed, 28 Oct 2015 00:14:48 -0500 Subject: [PATCH 13/32] Update consolidate.js --- lib/consolidate.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/consolidate.js b/lib/consolidate.js index c7b46be..e88bf28 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -46,6 +46,7 @@ var requires = {}; */ exports.clearCache = function(){ + readCache = {}; cacheStore = {}; }; From 714f75c63d9ed889c17c4a6e720970b81782f853 Mon Sep 17 00:00:00 2001 From: Cameron J Roe Date: Mon, 25 Jan 2016 14:03:21 -0500 Subject: [PATCH 14/32] include support for liquid-node --- lib/consolidate.js | 70 ++++++++----------- package.json | 4 +- .../liquid/{footer.html => footer.liquid} | 0 test/fixtures/liquid/include.liquid | 2 +- test/shared/filters.js | 2 +- test/shared/includes.js | 3 +- 6 files changed, 36 insertions(+), 45 deletions(-) rename test/fixtures/liquid/{footer.html => footer.liquid} (100%) diff --git a/lib/consolidate.js b/lib/consolidate.js index 4d05fc0..50f2988 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -189,36 +189,23 @@ exports.liquid = fromStringRenderer('liquid'); exports.liquid.render = function(str, options, fn){ return promisify(fn, function (fn) { - var engine = requires.liquid || (requires.liquid = require('tinyliquid')); + var Liquid = requires.liquid || (requires.liquid = require('liquid-node')); + var engine = new Liquid.Engine; + try { - var context = engine.newContext(); - var k; - - /** - * Note that there's a bug in the library that doesn't allow us to pass - * the locals to newContext(), hence looping through the keys: - */ - - if (options.locals){ - for (k in options.locals){ - context.setLocals(k, options.locals[k]); - } - delete options.locals; - } + var locals = options.locals || {}; if (options.meta){ - context.setLocals('page', options.meta); + locals.pages = options.meta; delete options.meta; } /** * Add any defined filters: */ - - if (options.filters){ - for (k in options.filters){ - context.setFilter(k, options.filters[k]); - } + + if (options.filters) { + engine.registerFilters(options.filters); delete options.filters; } @@ -227,16 +214,7 @@ exports.liquid.render = function(str, options, fn){ */ var includeDir = options.includeDir || process.cwd(); - - context.onInclude(function (name, callback) { - var extname = path.extname(name) ? '' : '.liquid'; - var filename = path.resolve(includeDir, name + extname); - - fs.readFile(filename, {encoding: 'utf8'}, function (err, data){ - if (err) return callback(err); - callback(null, engine.parse(data)); - }); - }); + engine.fileSystem = new Liquid.LocalFileSystem(includeDir, 'liquid'); delete options.includeDir; /** @@ -251,14 +229,15 @@ exports.liquid.render = function(str, options, fn){ if (options.customTags){ var tagFunctions = options.customTags; - + for (k in options.customTags){ + engine.registerTag(k, tagFunctions[k]); /*Tell jshint there's no problem with having this function in the loop */ /*jshint -W083 */ - compileOptions.customTags[k] = function (context, name, body){ - var tpl = tagFunctions[name](body.trim()); - context.astStack.push(engine.parse(tpl)); - }; + // compileOptions.customTags[k] = function (context, name, body){ + // var tpl = tagFunctions[name](body.trim()); + // context.astStack.push(engine.parse(tpl)); + // }; /*jshint +W083 */ } delete options.customTags; @@ -268,16 +247,27 @@ exports.liquid.render = function(str, options, fn){ * Now anything left in `options` becomes a local: */ - for (k in options){ - context.setLocals(k, options[k]); + for (var k in options){ + locals[k] = options[k]; } /** * Finally, execute the template: */ + + return engine + .parseAndRender(str, locals) + .nodeify(function (err, result) { + if (err) { + throw new Error(err); + } else { + return fn(null, result); + } + }); + + // var tmpl = cache(context) || cache(context, engine.compile(str, compileOptions)); + // tmpl(context, fn); - var tmpl = cache(context) || cache(context, engine.compile(str, compileOptions)); - tmpl(context, fn); } catch (err) { fn(err); } diff --git a/package.json b/package.json index 340c502..a71ac5b 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,8 @@ "test": "mocha" }, "dependencies": { - "bluebird": "^3.1.1" + "bluebird": "^3.1.1", + "liquid-node": "^2.6.1", + "slm": "^0.5.0" } } diff --git a/test/fixtures/liquid/footer.html b/test/fixtures/liquid/footer.liquid similarity index 100% rename from test/fixtures/liquid/footer.html rename to test/fixtures/liquid/footer.liquid diff --git a/test/fixtures/liquid/include.liquid b/test/fixtures/liquid/include.liquid index ad766c2..8db7908 100644 --- a/test/fixtures/liquid/include.liquid +++ b/test/fixtures/liquid/include.liquid @@ -1,3 +1,3 @@ {% include user %} {% include sub/file %} -{% include "footer.html" %} \ No newline at end of file +{% include "footer.liquid" %} \ No newline at end of file diff --git a/test/shared/filters.js b/test/shared/filters.js index 625a227..8cb9542 100644 --- a/test/shared/filters.js +++ b/test/shared/filters.js @@ -13,7 +13,7 @@ exports.test = function(name) { var str = fs.readFileSync('test/fixtures/' + name + '/filters.' + name).toString(); var locals = { user: user, filters: { toupper: function(object) { - return object.toUpperCase(); + return String(object).toUpperCase(); }}}; cons[name].render(str, locals, function(err, html){ diff --git a/test/shared/includes.js b/test/shared/includes.js index 17aca58..d108514 100644 --- a/test/shared/includes.js +++ b/test/shared/includes.js @@ -10,14 +10,13 @@ exports.test = function(name) { it('should support includes', function(done) { var str = fs.readFileSync('test/fixtures/' + name + '/include.' + name).toString(); - var locals = { user: user, includeDir: 'test/fixtures/' + name }; cons[name].render(str, locals, function(err, html){ if (err) return done(err); try{ if (name === 'liquid') { - html.should.eql('

      Tobi

      '); + html.should.eql('

      Tobi

      \n
      \n
      '); } else { html.should.eql('

      Tobi

      '); } From e1c35176a052bd26418d4a7ab7baa32577d9f6a2 Mon Sep 17 00:00:00 2001 From: Cameron J Roe Date: Wed, 27 Jan 2016 00:15:50 -0500 Subject: [PATCH 15/32] fix tests --- lib/consolidate.js | 126 ++++++++++++++++-- package.json | 9 +- .../liquid/{footer.liquid => footer.html} | 0 test/fixtures/liquid/include.liquid | 2 +- test/shared/filters.js | 2 +- test/shared/includes.js | 2 +- 6 files changed, 121 insertions(+), 20 deletions(-) rename test/fixtures/liquid/{footer.liquid => footer.html} (100%) diff --git a/lib/consolidate.js b/lib/consolidate.js index 50f2988..49fafdd 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -187,11 +187,123 @@ exports.liquid = fromStringRenderer('liquid'); * `includeDir` will also become a local. */ +function _renderTinyliquid(engine, str, options, fn) { + var context = engine.newContext(); + var k; + + /** + * Note that there's a bug in the library that doesn't allow us to pass + * the locals to newContext(), hence looping through the keys: + */ + + if (options.locals){ + for (k in options.locals){ + context.setLocals(k, options.locals[k]); + } + delete options.locals; + } + + if (options.meta){ + context.setLocals('page', options.meta); + delete options.meta; + } + + /** + * Add any defined filters: + */ + + if (options.filters){ + for (k in options.filters){ + context.setFilter(k, options.filters[k]); + } + delete options.filters; + } + + /** + * Set up a callback for the include directory: + */ + + var includeDir = options.includeDir || process.cwd(); + + context.onInclude(function (name, callback) { + var extname = path.extname(name) ? '' : '.liquid'; + var filename = path.resolve(includeDir, name + extname); + + fs.readFile(filename, {encoding: 'utf8'}, function (err, data){ + if (err) return callback(err); + callback(null, engine.parse(data)); + }); + }); + delete options.includeDir; + + /** + * The custom tag functions need to have their results pushed back + * through the parser, so set up a shim before calling the provided + * callback: + */ + + var compileOptions = { + customTags: {} + }; + + if (options.customTags){ + var tagFunctions = options.customTags; + + for (k in options.customTags){ + /*Tell jshint there's no problem with having this function in the loop */ + /*jshint -W083 */ + compileOptions.customTags[k] = function (context, name, body){ + var tpl = tagFunctions[name](body.trim()); + context.astStack.push(engine.parse(tpl)); + }; + /*jshint +W083 */ + } + delete options.customTags; + } + + /** + * Now anything left in `options` becomes a local: + */ + + for (k in options){ + context.setLocals(k, options[k]); + } + + /** + * Finally, execute the template: + */ + + var tmpl = cache(context) || cache(context, engine.compile(str, compileOptions)); + tmpl(context, fn); +} + exports.liquid.render = function(str, options, fn){ return promisify(fn, function (fn) { - var Liquid = requires.liquid || (requires.liquid = require('liquid-node')); - var engine = new Liquid.Engine; + var engine = requires.liquid; + var Liquid; + + try { + // set up tinyliquid engine + engine = requires.liquid = require('tinyliquid'); + + // use tinyliquid engine + _renderTinyliquid(engine, str, options, fn); + + return; + + } catch (err) { + + // set up liquid-node engine + try { + Liquid = requires.liquid = require('liquid-node'); + engine = new Liquid.Engine; + } catch (err) { + throw err; + } + + } + // use liquid-node engine try { var locals = options.locals || {}; @@ -232,13 +344,6 @@ exports.liquid.render = function(str, options, fn){ for (k in options.customTags){ engine.registerTag(k, tagFunctions[k]); - /*Tell jshint there's no problem with having this function in the loop */ - /*jshint -W083 */ - // compileOptions.customTags[k] = function (context, name, body){ - // var tpl = tagFunctions[name](body.trim()); - // context.astStack.push(engine.parse(tpl)); - // }; - /*jshint +W083 */ } delete options.customTags; } @@ -265,9 +370,6 @@ exports.liquid.render = function(str, options, fn){ } }); - // var tmpl = cache(context) || cache(context, engine.compile(str, compileOptions)); - // tmpl(context, fn); - } catch (err) { fn(err); } diff --git a/package.json b/package.json index a71ac5b..f83573c 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "jazz": "^0.0.18", "jqtpl": "^1.1.0", "just": "^0.1.8", + "liquid-node": "^2.6.1", "liquor": "^0.0.5", "lodash": "^4.0.0", "mocha": "^2.3.4", @@ -41,9 +42,9 @@ "slm": "^0.5.0", "swig": "^1.4.1", "templayed": ">=0.2.3", - "twig": "^0.8.2", - "tinyliquid": "^0.2.22", + "tinyliquid": "^0.2.30", "toffee": "^0.1.12", + "twig": "^0.8.2", "underscore": "^1.3.3", "vash": "^0.8.7", "walrus": "^0.10.1", @@ -59,8 +60,6 @@ "test": "mocha" }, "dependencies": { - "bluebird": "^3.1.1", - "liquid-node": "^2.6.1", - "slm": "^0.5.0" + "bluebird": "^3.1.1" } } diff --git a/test/fixtures/liquid/footer.liquid b/test/fixtures/liquid/footer.html similarity index 100% rename from test/fixtures/liquid/footer.liquid rename to test/fixtures/liquid/footer.html diff --git a/test/fixtures/liquid/include.liquid b/test/fixtures/liquid/include.liquid index 8db7908..ad766c2 100644 --- a/test/fixtures/liquid/include.liquid +++ b/test/fixtures/liquid/include.liquid @@ -1,3 +1,3 @@ {% include user %} {% include sub/file %} -{% include "footer.liquid" %} \ No newline at end of file +{% include "footer.html" %} \ No newline at end of file diff --git a/test/shared/filters.js b/test/shared/filters.js index 8cb9542..625a227 100644 --- a/test/shared/filters.js +++ b/test/shared/filters.js @@ -13,7 +13,7 @@ exports.test = function(name) { var str = fs.readFileSync('test/fixtures/' + name + '/filters.' + name).toString(); var locals = { user: user, filters: { toupper: function(object) { - return String(object).toUpperCase(); + return object.toUpperCase(); }}}; cons[name].render(str, locals, function(err, html){ diff --git a/test/shared/includes.js b/test/shared/includes.js index d108514..fef5389 100644 --- a/test/shared/includes.js +++ b/test/shared/includes.js @@ -16,7 +16,7 @@ exports.test = function(name) { if (err) return done(err); try{ if (name === 'liquid') { - html.should.eql('

      Tobi

      \n
      \n
      '); + html.should.eql('

      Tobi

      '); } else { html.should.eql('

      Tobi

      '); } From 77c49a052633e74ff47fb8ca1cf46695fb51e19d Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Fri, 3 Jun 2016 04:30:26 +0300 Subject: [PATCH 16/32] support layouts in vash --- lib/consolidate.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/consolidate.js b/lib/consolidate.js index 795c2b2..82fa437 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -1336,7 +1336,10 @@ exports.vash.render = function(str, options, fn) { } var tmpl = cache(options) || cache(options, engine.compile(str, options)); - fn(null, tmpl(options).replace(/\n$/, '')); + tmpl(options, function sealLayout(err, ctx) { + ctx.finishLayout(); + fn(null, ctx.toString().replace(/\n$/, '')); + }); } catch (err) { fn(err); } From e223a27d6b83e91bfae1c9f5497e45549eecd1b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=BE=99?= Date: Sun, 12 Jun 2016 20:11:44 +0800 Subject: [PATCH 17/32] add velocity surport --- lib/consolidate.js | 22 ++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/consolidate.js b/lib/consolidate.js index 795c2b2..ce02e20 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -169,6 +169,28 @@ function fromStringRenderer(name) { }; } +/** + * velocity support. + */ + +exports.velocityjs = fromStringRenderer('velocityjs'); + +/** + * velocity string support. + */ + +exports.velocityjs.render = function(str, options, fn){ + return promisify(fn, function(fn) { + var engine = requires.velocityjs || (requires.velocityjs = require('velocityjs')); + try { + options.locals = options; + fn(null, engine.render(str, options).trimLeft()); + } catch (err) { + fn(err); + } + }); +}; + /** * Liquid support. */ diff --git a/package.json b/package.json index eac8362..cf8ee86 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,8 @@ "underscore": "^1.3.3", "vash": "^0.8.7", "walrus": "^0.10.1", - "whiskers": "^0.3.3" + "whiskers": "^0.3.3", + "velocityjs": "^0.8.2" }, "main": "index", "repository": { From b235ec1f53b1831f8de4f571e85ac8efea57f28f Mon Sep 17 00:00:00 2001 From: Adam Hull Date: Sun, 7 Apr 2013 23:38:12 -0700 Subject: [PATCH 18/32] Refs #103 - Support Teacup --- lib/consolidate.js | 49 ++++++++++++++++++++++++++++---- package.json | 2 ++ test/consolidate.js | 3 +- test/fixtures/teacup/user.teacup | 4 +++ 4 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 test/fixtures/teacup/user.teacup diff --git a/lib/consolidate.js b/lib/consolidate.js index 795c2b2..4f57665 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -1191,20 +1191,20 @@ function reactBaseTmpl(data, options){ * The main render parser for React bsaed templates */ function reactRenderer(type){ - + if (require.extensions) { - + // Ensure JSX is transformed on require if (!require.extensions['.jsx']) { require.extensions['.jsx'] = requireReact; } - + // Supporting .react extension as well as test cases // Using .react extension is not recommended. if (!require.extensions['.react']) { require.extensions['.react'] = requireReact; } - + } // Return rendering fx @@ -1367,7 +1367,44 @@ exports.slm.render = function(str, options, fn) { }; /** - * expose the instance of the engine + * Teacup support. */ +exports.teacup = function(path, options, fn) { + return promisify(fn, function(fn) { + var engine = requires.teacup || (requires.teacup = require('teacup/lib/express')); + require.extensions['.teacup'] = require.extensions['.coffee']; + if (path[0] != '/') { + path = join(process.cwd(), path); + } + if (!options.cache) { + var originalFn = fn; + fn = function() { + delete require.cache[path]; + originalFn.apply(this, arguments); + }; + } + engine.renderFile(path, options, fn); + }); +}; -exports.requires = requires; +/** + * Teacup string support. + */ +exports.teacup.render = function(str, options, fn){ + var coffee = require('coffee-script'); + var vm = require('vm'); + var sandbox = { + module: {exports: {}}, + require: require + }; + return promisify(fn, function(fn) { + vm.runInNewContext(coffee.compile(str), sandbox); + var tmpl = sandbox.module.exports; + fn(null, tmpl(options)); + }); +} + +/** + * expose the instance of the engine + */ + exports.requires = requires; diff --git a/package.json b/package.json index eac8362..007f38e 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "devDependencies": { "arc-templates": "^0.5.1", "atpl": ">=0.7.6", + "coffee-script": "^1.11.1", "dot": "^1.0.1", "dust": "^0.3.0", "dustjs-helpers": "^1.1.1", @@ -42,6 +43,7 @@ "should": "*", "slm": "^0.5.0", "swig": "^1.4.1", + "teacup": "^2.0.0", "templayed": ">=0.2.3", "tinyliquid": "^0.2.22", "toffee": "^0.1.12", diff --git a/test/consolidate.js b/test/consolidate.js index 340bb5c..0b594a7 100644 --- a/test/consolidate.js +++ b/test/consolidate.js @@ -49,4 +49,5 @@ require('./shared').test('slm'); require('./shared').test('arc-templates'); require('./shared/filters').test('arc-templates'); require('./shared/includes').test('arc-templates'); -require('./shared/partials').test('arc-templates'); \ No newline at end of file +require('./shared/partials').test('arc-templates'); +require('./shared').test('teacup'); diff --git a/test/fixtures/teacup/user.teacup b/test/fixtures/teacup/user.teacup new file mode 100644 index 0000000..4328466 --- /dev/null +++ b/test/fixtures/teacup/user.teacup @@ -0,0 +1,4 @@ +{renderable, p} = require 'teacup' + +module.exports = renderable ({user}) -> + p user.name From 253b661c550f400967ae66fa2762a58768ed1236 Mon Sep 17 00:00:00 2001 From: Adam Hull Date: Sun, 7 Apr 2013 23:44:13 -0700 Subject: [PATCH 19/32] Add Teacup to the README --- Readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Readme.md b/Readme.md index b04f9d5..46e3e42 100644 --- a/Readme.md +++ b/Readme.md @@ -36,6 +36,7 @@ - [react](https://github.com/facebook/react) - [slm](https://github.com/slm-lang/slm) - [swig](https://github.com/paularmstrong/swig) [(website)](http://paularmstrong.github.com/swig/) + - [teacup](https://github.com/goodeggs/teacup) - [templayed](http://archan937.github.com/templayed.js/) - [twig](https://github.com/justjohn/twig.js) - [liquid](https://github.com/leizongmin/tinyliquid) [(website)](http://liquidmarkup.org/) From 646244753d2f7474935b9475d89b4fba3b0a9a8a Mon Sep 17 00:00:00 2001 From: eikaramba Date: Thu, 29 Dec 2016 04:02:19 +0100 Subject: [PATCH 20/32] Change Marko Implementation to support v4 Marko changed its implementation and thus "The render callback will no longer receive a string in Marko v4. Use `renderToString(data, callback)` instead" See https://github.com/marko-js/marko/pull/450. This change is compatible with the current stable public version. --- lib/consolidate.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/consolidate.js b/lib/consolidate.js index 8a06431..7efb6f8 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -1452,7 +1452,7 @@ exports.marko = function(path, options, fn){ try { var tmpl = cache(options) || cache(options, engine.load(path, options)); - tmpl.render(options, fn) + tmpl.renderToString(options, fn) } catch (err) { fn(err); } @@ -1470,7 +1470,7 @@ exports.marko.render = function(str, options, fn) { try { var tmpl = cache(options) || cache(options, engine.load('string.marko', str, options)); - tmpl.render(options, fn) + tmpl.renderToString(options, fn) } catch (err) { fn(err); } From 6a298b45e57ff6b95168059427eacbb7bc7e2665 Mon Sep 17 00:00:00 2001 From: eikaramba Date: Fri, 30 Dec 2016 01:38:54 +0100 Subject: [PATCH 21/32] Use filename as a unique identifier Otherwise subsequent calls will always only return the template, that was loaded first. This is because Marco is using cached Templates by default. --- lib/consolidate.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/consolidate.js b/lib/consolidate.js index 7efb6f8..9e9c2dd 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -1467,9 +1467,10 @@ exports.marko.render = function(str, options, fn) { return promisify(fn, function (fn) { var engine = requires.marko || (requires.marko = require('marko')); options.writeToDisk = !!options.cache; + options.filename = options.filename || 'string.marko'; try { - var tmpl = cache(options) || cache(options, engine.load('string.marko', str, options)); + var tmpl = cache(options) || cache(options, engine.load(options.filename, str, options)); tmpl.renderToString(options, fn) } catch (err) { fn(err); From 93a61f30824a779ef2d6e9da1adbe4f16c77b6be Mon Sep 17 00:00:00 2001 From: danlevan Date: Sun, 8 Jan 2017 01:02:18 -0500 Subject: [PATCH 22/32] Pass options to bracket compile --- lib/consolidate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/consolidate.js b/lib/consolidate.js index 8a06431..d3af406 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -1051,7 +1051,7 @@ 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)); + var tmpl = cache(options) || cache(options, engine.default.compile(str, options)); fn(null, tmpl(options)); } catch (err) { fn(err); From 084ccaa8205c81a31d2e803b89ecc8bdbc8ceae9 Mon Sep 17 00:00:00 2001 From: eikaramba Date: Sun, 8 Jan 2017 13:47:51 +0100 Subject: [PATCH 23/32] update bracket-template to fix build errors --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 97989a9..4e325d5 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "atpl": ">=0.7.6", "babel-core": "^6.7.6", "babel-preset-react": "^6.5.0", - "bracket-template": "^1.0.3", + "bracket-template": "^1.1.4", "dot": "^1.0.1", "dust": "^0.3.0", "dustjs-helpers": "^1.1.1", From 98565cc8e693edb6d946402325e7366246d34c24 Mon Sep 17 00:00:00 2001 From: Diego Sisto Date: Mon, 24 Apr 2017 17:50:28 -0300 Subject: [PATCH 24/32] delete require cache to read file changes from disk --- lib/consolidate.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/consolidate.js b/lib/consolidate.js index 8a06431..55ec751 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -1312,7 +1312,13 @@ function reactRenderer(type){ if (!cache(options)){ // Parsing - Code = (type === 'path') ? require(resolve(str)) : requireReactString(str); + if (type === 'path') { + var path = resolve(str) + delete require.cache[path] + Code = require(path) + } else { + Code = requireReactString(str) + } Factory = cache(options, react.createFactory(Code)); } else { From 03219a23c1820e7c1bb66695da58eebae1e37b85 Mon Sep 17 00:00:00 2001 From: Chirag Patel Date: Sun, 30 Apr 2017 16:17:13 -0700 Subject: [PATCH 25/32] Passing in template name to dust compile. This will ensure when context.getTemplateName is called in a base template the appropriate name is available --- lib/consolidate.js | 7 +++- test/consolidate.js | 1 + test/fixtures/dust/user_template_name.dust | 2 ++ test/shared/dust.js | 38 ++++++++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/dust/user_template_name.dust create mode 100644 test/shared/dust.js diff --git a/lib/consolidate.js b/lib/consolidate.js index 8a06431..90dbd79 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -383,7 +383,12 @@ exports.dust.render = function(str, options, fn){ }; try { - var tmpl = cache(options) || cache(options, engine.compileFn(str)); + var templateName; + if (options.filename) { + templateName = options.filename.replace(new RegExp('^' + views + '/'), '').replace(new RegExp('\\.' + ext), ''); + } + + var tmpl = cache(options) || cache(options, engine.compileFn(str, templateName)); tmpl(options, fn); } catch (err) { fn(err); diff --git a/test/consolidate.js b/test/consolidate.js index fbcc584..0cc6300 100644 --- a/test/consolidate.js +++ b/test/consolidate.js @@ -19,6 +19,7 @@ require('./shared').test('hogan'); require('./shared/partials').test('hogan'); require('./shared').test('dust'); require('./shared/partials').test('dust'); +require('./shared/dust').test('dust'); require('./shared').test('handlebars'); require('./shared/partials').test('handlebars'); require('./shared/helpers').test('handlebars'); diff --git a/test/fixtures/dust/user_template_name.dust b/test/fixtures/dust/user_template_name.dust new file mode 100644 index 0000000..a738f22 --- /dev/null +++ b/test/fixtures/dust/user_template_name.dust @@ -0,0 +1,2 @@ +

      {user.name}

      +{@templateName/} diff --git a/test/shared/dust.js b/test/shared/dust.js new file mode 100644 index 0000000..bd2503a --- /dev/null +++ b/test/shared/dust.js @@ -0,0 +1,38 @@ +/*eslint-env node, mocha */ +var cons = require('../../'); +var fs = require('fs'); + +// var should = require('should'); + +exports.test = function(name) { + var user = { name: 'Tobi' }; + + describe(name, function(){ + // Use case: return upper case string. + it('should support fetching template name from the context', function(done) { + var viewsDir = 'test/fixtures/' + name; + var templatePath = viewsDir + '/user_template_name.' + name; + var str = fs.readFileSync(templatePath).toString(); + + var locals = { + user: user, + views: viewsDir, + filename: templatePath + }; + + if (name === 'dust') { + var dust = require('dustjs-helpers'); + dust.helpers.templateName = function(chunk, context, bodies, params) { + return chunk.write(context.getTemplateName()); + }; + cons.requires.dust = dust; + } + + cons[name].render(str, locals, function(err, html){ + if (err) return done(err); + html.should.eql('

      Tobi

      user_template_name'); + return done(); + }); + }); + }); +}; From d660db5ae00cade2f94e98c8f015a1223de754c7 Mon Sep 17 00:00:00 2001 From: Dave Capper Date: Wed, 5 Jul 2017 09:59:10 +1000 Subject: [PATCH 26/32] Provide support for absolute path partials --- lib/consolidate.js | 15 ++++++++++++++- test/shared/partials.js | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/lib/consolidate.js b/lib/consolidate.js index 8a06431..cbe80ff 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -22,6 +22,7 @@ var join = path.join; var resolve = path.resolve; var extname = path.extname; var dirname = path.dirname; +var isAbsolute = path.isAbsolute; var readCache = {}; @@ -118,7 +119,19 @@ function readPartials(path, options, fn) { function next(index) { if (index === keys.length) return fn(null); var key = keys[index]; - var file = join(dirname(path), partials[key] + extname(path)); + var partialPath = partials[key]; + + var file; + if (isAbsolute(partialPath)) { + if (extname(partialPath) !== '') { + file = partialPath; + } else { + file = join(partialPath + extname(path)); + } + } else { + file = join(dirname(path), partialPath + extname(path)); + } + read(file, options, function(err, str){ if (err) return fn(err); options.partials[key] = str; diff --git a/test/shared/partials.js b/test/shared/partials.js index febd9aa..5982b6c 100644 --- a/test/shared/partials.js +++ b/test/shared/partials.js @@ -23,6 +23,24 @@ exports.test = function(name) { done(); }); }); + it('should support absolute path partial', function(done){ + var path = 'test/fixtures/' + name + '/partials.' + name; + var locals = {user: user, partials: {partial: __dirname + '/../../test/fixtures/' + name + '/user' }}; + cons[name](path, locals, function(err, html){ + if (err) return done(err); + html.should.equal('

      Tobi

      '); + done(); + }); + }); + it('should support relative path partial', function(done){ + var path = 'test/fixtures/' + name + '/partials.' + name; + var locals = {user: user, partials: {partial: '../' + name + '/user' }}; + cons[name](path, locals, function(err, html){ + if (err) return done(err); + html.should.equal('

      Tobi

      '); + done(); + }); + }); } else { it('should support rendering a partial', function(done){ From 7c3a5ea7973f0e6df60debe3d3f9c002e1319d0d Mon Sep 17 00:00:00 2001 From: doowb Date: Sun, 17 Sep 2017 12:08:53 -0400 Subject: [PATCH 27/32] update gitignore --- .gitignore | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index fdcfe6e..1712e0a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,30 @@ -.DS_Store -node_modules +# always ignore files +*.DS_Store +*.sublime-* .idea *.sock + +# test related, or directories generated by tests +test/actual +actual +coverage +.nyc* + +# npm +node_modules +npm-debug.log + +# yarn +yarn.lock +yarn-error.log + +# misc +_gh_pages +_draft +_drafts +bower_components +vendor +temp +tmp +TODO.md +package-lock.json From b8545420c765a78346c27310c99adb9687e22e05 Mon Sep 17 00:00:00 2001 From: doowb Date: Sun, 17 Sep 2017 21:51:36 -0400 Subject: [PATCH 28/32] update plates support with recent changes --- lib/consolidate.js | 18 ++++++++++-------- test/shared/index.js | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/consolidate.js b/lib/consolidate.js index c50f46f..feef950 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -1272,14 +1272,16 @@ exports.plates = fromStringRenderer('plates'); */ 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); - } + return promisify(fn, function (fn) { + var engine = requires.plates || (requires.plates = require('plates')); + var map = options.map || undefined; + try { + var tmpl = engine.bind(str, options, map); + fn(null, tmpl); + } catch (err) { + fn(err); + } + }); } diff --git a/test/shared/index.js b/test/shared/index.js index 1972a31..0d510fa 100644 --- a/test/shared/index.js +++ b/test/shared/index.js @@ -86,7 +86,7 @@ exports.test = function(name) { var result = cons[name](path, locals); result.then(function (html) { - html.should.equal('

      Tobi

      '); + html.should.match(/Tobi/); done(); }) .catch(function (err) { @@ -100,7 +100,7 @@ exports.test = function(name) { var result = cons[name].render(str, locals); result.then(function (html) { - html.should.equal('

      Tobi

      '); + html.should.match(/Tobi/); done(); }) .catch(function (err) { From e76af8b6db70e1e48a602bb4de8864163bb0c6d0 Mon Sep 17 00:00:00 2001 From: doowb Date: Mon, 18 Sep 2017 16:14:58 -0400 Subject: [PATCH 29/32] ensure both liquid engines are tested --- test/consolidate.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/consolidate.js b/test/consolidate.js index 335b316..5df0c2b 100644 --- a/test/consolidate.js +++ b/test/consolidate.js @@ -1,10 +1,21 @@ +var cons = require('../'); /*eslint-env node*/ /*eslint quotes: [2, "single"] */ require('./shared').test('jade'); require('./shared').test('pug'); + +// testing tinyliquid +cons.requires.liquid = require('tinyliquid'); require('./shared').test('liquid'); require('./shared/filters').test('liquid'); require('./shared/includes').test('liquid'); + +// testing liquid-node +cons.requires.liquid = require('liquid-node'); +require('./shared').test('liquid'); +require('./shared/filters').test('liquid'); +require('./shared/includes').test('liquid'); + require('./shared').test('ejs'); require('./shared').test('swig'); require('./shared').test('jazz'); From fa24a0a3a0f7c59f0eb672a9b2eca175029b5326 Mon Sep 17 00:00:00 2001 From: doowb Date: Mon, 18 Sep 2017 16:25:01 -0400 Subject: [PATCH 30/32] history --- History.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/History.md b/History.md index 8f04d50..dba4269 100644 --- a/History.md +++ b/History.md @@ -3,8 +3,10 @@ * add plates support * add teacup support + * add liquid-node support * allow absolute and relative partial paths * extend dot options + * support layouts in vash 0.14.0 / 2016-01-24 =================== From 87a894b611e493c79c5304b61ce3645ac64a2fc5 Mon Sep 17 00:00:00 2001 From: doowb Date: Mon, 18 Sep 2017 16:33:00 -0400 Subject: [PATCH 31/32] add velocityjs tests --- History.md | 1 + package.json | 2 +- test/consolidate.js | 1 + test/fixtures/velocityjs/user.velocityjs | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/velocityjs/user.velocityjs diff --git a/History.md b/History.md index dba4269..90c5fe6 100644 --- a/History.md +++ b/History.md @@ -4,6 +4,7 @@ * add plates support * add teacup support * add liquid-node support + * add velocityjs support * allow absolute and relative partial paths * extend dot options * support layouts in vash diff --git a/package.json b/package.json index 1603e72..f61f8f7 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "underscore": "^1.3.3", "vash": "^0.12.2", "walrus": "^0.10.1", - "whiskers": "^0.4.0" + "whiskers": "^0.4.0", "velocityjs": "^0.8.2" }, "keywords": [ diff --git a/test/consolidate.js b/test/consolidate.js index 5df0c2b..faaff8b 100644 --- a/test/consolidate.js +++ b/test/consolidate.js @@ -65,3 +65,4 @@ require('./shared/partials').test('arc-templates'); require('./shared').test('marko'); require('./shared').test('bracket'); require('./shared').test('teacup'); +require('./shared').test('velocityjs'); diff --git a/test/fixtures/velocityjs/user.velocityjs b/test/fixtures/velocityjs/user.velocityjs new file mode 100644 index 0000000..334ea79 --- /dev/null +++ b/test/fixtures/velocityjs/user.velocityjs @@ -0,0 +1 @@ +

      $user.name

      From b56b42a7c5b7e402d6e3b296752a2fe2fe7ad447 Mon Sep 17 00:00:00 2001 From: doowb Date: Mon, 18 Sep 2017 16:48:44 -0400 Subject: [PATCH 32/32] fix marko warning in test fixture --- test/fixtures/marko/user.marko | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/marko/user.marko b/test/fixtures/marko/user.marko index 233b0b6..c9d7ba4 100644 --- a/test/fixtures/marko/user.marko +++ b/test/fixtures/marko/user.marko @@ -1 +1 @@ -p - ${data.user.name} +p -- ${data.user.name}