From 54068621274cb9d436c7c5629d88edc24bdc7fd5 Mon Sep 17 00:00:00 2001 From: nicco Date: Wed, 21 Feb 2018 12:29:05 +0100 Subject: [PATCH] Correct for statement splitter --- src/actions.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/actions.ts b/src/actions.ts index a47cab2..f09ef52 100644 --- a/src/actions.ts +++ b/src/actions.ts @@ -133,9 +133,12 @@ export const loop: ActionFunction = (html, options, re) => { throw new Error(error.parse.default) // Extract variable name from the if statemtent - const statement = current.found[0].slice(re.begin.length + re.if.length, -re.ending.length).trim().split(re.for_in) - current.variable = statement[0].trim() - current.arr = statement[1].trim() + const statement = current.found[0] + .slice(re.begin.length + re.if.length, -re.ending.length).trim() + .split(new RegExp(` +${re.for_in} +`, 'g')) + + current.variable = statement[0] + current.arr = statement[1] let next do {