From 432f878bb656c4fbf94fedea05a0ef769ea8bfdc Mon Sep 17 00:00:00 2001 From: Jun Yang Date: Sat, 7 Apr 2018 19:45:57 +0800 Subject: [PATCH] fix: support comma-separated arguments for static partials, fixes #62 --- tags/include.js | 2 +- test/tags/include.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tags/include.js b/tags/include.js index e0d4a3814..0ed9790e0 100644 --- a/tags/include.js +++ b/tags/include.js @@ -1,7 +1,7 @@ const Liquid = require('..') const lexical = Liquid.lexical const withRE = new RegExp(`with\\s+(${lexical.value.source})`) -const staticFileRE = /\S+/ +const staticFileRE = /[^\s,]+/ const assert = require('../src/util/assert.js') module.exports = function (liquid) { diff --git a/test/tags/include.js b/test/tags/include.js index 824698cf9..fea6334e9 100644 --- a/test/tags/include.js +++ b/test/tags/include.js @@ -129,5 +129,15 @@ describe('tags/include', function () { return expect(staticLiquid.renderFile('parent.html')).to .eventually.equal('XchildY') }) + + it('should support comma separated arguments', function () { + mock({ + '/parent.html': 'X{% include child.html, color:"red" %}Y', + '/child.html': 'child with {{color}}' + }) + var staticLiquid = new Liquid({dynamicPartials: false, root: '/'}) + return expect(staticLiquid.renderFile('parent.html')).to + .eventually.equal('Xchild with redY') + }) }) })