-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecurse.html
45 lines (42 loc) · 1.21 KB
/
recurse.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
layout: default
order: 400
title: Liquid Variable Recursion Test
---
<p>
The Jekyll docs do not discuss how recursive variable definitions are handled.
The following shows that recursive definitions are not supported.
Includes can be recursive, however, so devious methods might be possible - not investigated.
</p>
{% assign a = '42' %}
{% assign x = '{{a}}' %}
<pre>{{x}} # No lookup occured</pre>
{% capture x -%}{{x}}{%- endcapture %}
<pre>{{x}} # No lookup occured</pre>
{% capture x %}{{x}}{% endcapture %}
<pre>{{x}} # No lookup occured</pre>
{% capture w -%}{{x}}{%- endcapture %}
<pre>{{w}}</pre>
<p>
This tests the implementation.
Note that <code>{{{{x}}}</code> yields
<code>Error: Liquid syntax error (line 40): Unexpected character { in
"{{{{x}}"</code>
</p>
<p>
If the result below is 42, then recursion is supported.
</p>
{% assign x = '{{' %}
{% assign y = 'a' %}
{% assign z = '}}' %}
{% capture b %}{{x}}{{y}}{{z}}{% endcapture %}
<pre>{{b}}</pre>
{% assign c = b %}
<pre>{{c}}</pre>
{% assign a = '42' %}
{% assign x = '{{a}}' %}
<p>
If the result below is 42, then recursion is supported.
</p>
<pre>{{x}}</pre>
<pre></pre>