Skip to content

Commit

Permalink
Fixed regular expressions so they don't have to match the whole string.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmcelhaney committed May 28, 2010
1 parent 1fc8e7a commit 515a28f
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions CFStache.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
<cfset var tagName = ""/>
<cfset var type = "" />
<cfset var inner = "" />
<cfset var re = ".*?(\{\{(##)(\w+)}}(.*?)\{\{/\3\}\}).*" />
<cfset var re = "\{\{(##)(\w+)}}(.*?)\{\{/\2\}\}" />
<cfset matches = ReFindNoCaseValues(template, re) />
<cfset variables.context = arguments.context />
<cfloop condition = "arraylen(matches) eq 5" >
<cfset tag = matches[2]/>
<cfset type = matches[3] />
<cfset tagName = matches[4] />
<cfset inner = matches[5] />
<cfloop condition = "arraylen(matches) eq 4" >
<cfset tag = matches[1]/>
<cfset type = matches[2] />
<cfset tagName = matches[3] />
<cfset inner = matches[4] />
<cfset template = replace(template, tag, "")/>
<cfset matches = ReFindNoCaseValues(template, re) />

Expand All @@ -39,14 +39,14 @@
<cfargument name="context" />
<cfset var tag = ""/>
<cfset var tagName = ""/>
<cfset var re = ".*?(\{\{(!)?(\w+)\}\}).*" />
<cfset var re = "\{\{(!)?(\w+)\}\}" />
<cfset var matches = ReFindNoCaseValues(template, re) />

<cfset variables.context = arguments.context />
<cfloop condition = "arraylen(matches) eq 4" >
<cfset tag = matches[2]/>
<cfset type = matches[3] />
<cfset tagName = matches[4] />
<cfloop condition = "arraylen(matches) eq 3" >
<cfset tag = matches[1]/>
<cfset type = matches[2] />
<cfset tagName = matches[3] />
<cfset template = replace(template, tag, renderTag(type, tagName))/>
<cfset matches = ReFindNoCaseValues(template, re) />
</cfloop>
Expand Down

0 comments on commit 515a28f

Please sign in to comment.