mirror of
https://github.com/harttle/liquidjs.git
synced 2026-10-03 09:05:14 -07:00
fix assign tag regex to include linebreaks in value
This commit is contained in:
Vendored
+1
-1
@@ -2225,7 +2225,7 @@ function For (liquid, Liquid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Assign (liquid, Liquid) {
|
function Assign (liquid, Liquid) {
|
||||||
var re = new RegExp('(' + identifier.source + ')\\s*=(.*)');
|
var re = new RegExp('(' + identifier.source + ')\\s*=([^]*)');
|
||||||
var AssignScope = Liquid.Types.AssignScope;
|
var AssignScope = Liquid.Types.AssignScope;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -2171,7 +2171,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Assign (liquid, Liquid) {
|
function Assign (liquid, Liquid) {
|
||||||
var re = new RegExp('(' + identifier.source + ')\\s*=(.*)');
|
var re = new RegExp('(' + identifier.source + ')\\s*=([^]*)');
|
||||||
var AssignScope = Liquid.Types.AssignScope;
|
var AssignScope = Liquid.Types.AssignScope;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Generated
+1103
-1127
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -3,7 +3,7 @@ import {identifier} from '../lexical.js'
|
|||||||
import {create} from '../util/underscore.js'
|
import {create} from '../util/underscore.js'
|
||||||
|
|
||||||
export default function (liquid, Liquid) {
|
export default function (liquid, Liquid) {
|
||||||
const re = new RegExp(`(${identifier.source})\\s*=(.*)`)
|
const re = new RegExp(`(${identifier.source})\\s*=([^]*)`)
|
||||||
const {AssignScope} = Liquid.Types
|
const {AssignScope} = Liquid.Types
|
||||||
|
|
||||||
liquid.registerTag('assign', {
|
liquid.registerTag('assign', {
|
||||||
|
|||||||
@@ -41,6 +41,14 @@ describe('tags/assign', function () {
|
|||||||
return expect(liquid.parseAndRender(src))
|
return expect(liquid.parseAndRender(src))
|
||||||
.to.eventually.equal('A')
|
.to.eventually.equal('A')
|
||||||
})
|
})
|
||||||
|
it('should assign as filter across multiple lines as result', function () {
|
||||||
|
const src = `{% assign foo="a b"
|
||||||
|
| capitalize
|
||||||
|
| split: " "
|
||||||
|
| first %}{{foo}}`
|
||||||
|
return expect(liquid.parseAndRender(src))
|
||||||
|
.to.eventually.equal('A')
|
||||||
|
})
|
||||||
it('should assign var-1', function () {
|
it('should assign var-1', function () {
|
||||||
const src = '{% assign var-1 = 5 %}{{ var-1 }}'
|
const src = '{% assign var-1 = 5 %}{{ var-1 }}'
|
||||||
return expect(liquid.parseAndRender(src)).to.eventually.equal('5')
|
return expect(liquid.parseAndRender(src)).to.eventually.equal('5')
|
||||||
|
|||||||
Reference in New Issue
Block a user