Skip to content

Commit

Permalink
Quick fix for else if statements and changing the way regex is used
Browse files Browse the repository at this point in the history
  • Loading branch information
Umakant Patil committed Dec 11, 2013
1 parent c5430cc commit 4057bd7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions smart.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@
parse(content.slice(0,findElse.index),subTreeIf);

content = content.slice(findElse.index+findElse[0].length);
var findElseIf = findElse[1].match(/^else[\s*]if(.*)/);
var findElseIf = findElse[1].match(/^else\s*if(.*)/);
if (findElseIf)
{
buildInFunctions['if'].parse(parseParams(findElseIf[1]), subTreeElse, content.replace(/^\n/,''));
Expand Down Expand Up @@ -1020,7 +1020,7 @@
if (parseText.parseEmbeddedVars)
{
var re = /([$][\w@]+)|`([^`]*)`/;
for (var found=text.match(re); found; found=text.match(re))
for (var found=re.exec(text); found; found=re.exec(text))
{
tree.push({type: 'text', data: text.slice(0,found.index)});
tree.push( parseExpression(found[1] ? found[1] : found[2]).tree );
Expand Down

0 comments on commit 4057bd7

Please sign in to comment.