This repository was archived by the owner on Oct 6, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +63
-2
lines changed
Expand file tree Collapse file tree 3 files changed +63
-2
lines changed Original file line number Diff line number Diff line change 1+ < cfcomponent extends = " LiquidBlock" hint = "
2+ temporarily disable tag processing to avoid syntax conflicts.
3+
4+ example:
5+ {% raw %}{% comment %} test {% endcomment %}{% endraw %}
6+
7+ will render:
8+ {% comment %} test {% endcomment %}
9+ " >
10+
11+ < cffunction name = " parse" >
12+ < cfargument name = " tokens" type = " array" required = " true" >
13+ < cfset var loc = {}>
14+ < cfset loc .tag_regexp = createObject (" component" , " LiquidRegexp" ).init (' ^#application .LiquidConfig .LIQUID_TAG_START #\s*(\w+)\s*(.*)?#application .LiquidConfig .LIQUID_TAG_END #$' )>
15+
16+ < cfif ! IsArray (arguments .tokens )>
17+ < cfreturn >
18+ < / cfif >
19+
20+ < cfloop condition = " #ArrayLen (arguments .tokens ) #" >
21+
22+ < cfset loc .temp = array_shift (arguments .tokens )>
23+ < cfset arguments .tokens = loc .temp .arr >
24+ < cfset loc .token = loc .temp .value >
25+ < cfset loc .tag_regexp .match (loc .token )>
26+
27+ < cfif loc .tag_regexp .match (loc .token )>
28+
29+ <!--- if we found the proper block delimitor just end parsing here and let the outer block proceed --->
30+ < cfif loc .tag_regexp .matches [2 ] eq this .block_delimiter ()>
31+ < cfreturn this .end_tag ()>
32+ < / cfif >
33+
34+ < / cfif >
35+
36+ < cfset arrayAppend (this ._nodelist , loc .token )>
37+
38+ < / cfloop >
39+
40+ < cfset this .assert_missing_delimitation ()>
41+ < / cffunction >
42+
43+ < / cfcomponent >
Original file line number Diff line number Diff line change 1414
1515<cfelse >
1616
17- <cfset test = createObject (" component" , " cfml-liquid.tests.tests.StandardFilterTest " ) >
18- <cfset test .runTest (" test" , " test_remove_first " ) >
17+ <cfset test = createObject (" component" , " cfml-liquid.tests.tests.RawTest " ) >
18+ <cfset test .runTest (" test" , " test_output_in_raw " ) >
1919
2020</cfif >
2121
Original file line number Diff line number Diff line change 1+ < cfcomponent output = " false" extends = " cfml-liquid.tests.Test" >
2+
3+ < cffunction name = " setup" >
4+ < cfset loc .template = application .liquid .template ()>
5+ < / cffunction >
6+
7+ < cffunction name = " test_tag_in_raw" >
8+ < cfset loc .e = " {% comment %} test {% endcomment %}" >
9+ < cfset loc .t = " {% raw %}{% comment %} test {% endcomment %}{% endraw %}" >
10+ < cfset assert_template_result (loc .e , loc .t , loc .template )>
11+ < / cffunction >
12+
13+ < cffunction name = " test_output_in_raw" >
14+ < cfset loc .e = " {{ test }}" >
15+ < cfset loc .t = " {% raw %}{{ test }}{% endraw %}" >
16+ < / cffunction >
17+
18+ < / cfcomponent >
You can’t perform that action at this time.
0 commit comments