@@ -10,17 +10,17 @@ P.foo = "bar"
1010
1111Paragraph with [ a link] ( http://foo.example.com/ ) .
1212
13- Paragraph with [ a link] ( {{url"/relative-link"}} ) .
13+ Paragraph with [ a link] ({{ url"/relative-link" }}).
1414
15- Paragraph with [ a link] ( {{/relative-link}} ) .
15+ Paragraph with [ a link] ({{ /relative-link }}).
1616
17- Paragraph with [ a link] ( {{urlAbs"/absolute-link"}} ) .
17+ Paragraph with [ a link] ({{ urlAbs"/absolute-link" }}).
1818
19- An image: ![ the alt] ( {{/images/head.png}} )
19+ An image: ![ the alt] ({{ /images/head.png }})
2020
21- An image < <img src =" {{/images/head.png}} " > > inside markdown.
21+ An image < <img src =" {{ /images/head.png }} " > > inside markdown.
2222
23- An image < {{'<img src =" '..url'/images/head.png'..' " >'}} > inside markdown.
23+ An image < {{ '<img src =" '..url'/images/head.png'..' " >' }} > inside markdown.
2424
2525{{-- Line comment. {{"nope"}}
2626}}
@@ -32,7 +32,7 @@ An image < {{'<img src="'..url'/images/head.png'..'">'}} > inside markdown.
3232local localVar = function()end
3333-- localVar = globalVar -- Error: Cannot access non-existing globals!
3434}}
35- {{localVar}}
35+ {{ localVar }}
3636
3737{{
3838-- function()end -- Error: Invalid expression!
@@ -55,7 +55,7 @@ for i = 1, 3 do
5555end
5656}}
5757
58- foo < {{P.foo}} == "baz" > 0? <hr >
58+ foo < {{ P.foo }} == "baz" > 0? <hr >
5959
6060Two variations of control structures:
6161
@@ -67,6 +67,10 @@ for i = 1, 3 do
6767end
6868}}
6969
70+ {{if(1+2==3)}}
71+ No spaces.
72+ {{end}}
73+
7074{{ if 1+2 == 3 }}
7175Extra spaces.
7276{{ end }}
@@ -112,93 +116,93 @@ Markdown parsing, solution: [Snake!](<https://en.wikipedia.org/wiki/Snake_(video
112116
113117## Value Expressions
114118
115- String: {{"Water"}}
119+ String: {{ "Water" }}
116120
117- Operations: {{1+2* 3}}
121+ Operations: {{ 1+2* 3 }}
118122
119- Operations: {{"a-".."-b" -- Inline comment.
123+ Operations: {{ "a-".."-b" -- Inline comment.
120124}}
121125
122- Operations: {{1 + --[[ Inline comment. ]] 2}}
126+ Operations: {{ 1 + --[[ Inline comment. ]] 2 }}
123127
124- Value from function: {{date"%Y-%m-%d"}}
128+ Value from function: {{ date"%Y-%m-%d" }}
125129
126- No value from function: {{print("Just a print to console.")}}
130+ No value from function: {{ print("Just a print to console.") }}
127131
128- Field: {{page.title}}
132+ Field: {{ page.title }}
129133
130- Table: {{site}}
134+ Table: {{ site }}
131135
132- Param: {{P.foo}}
136+ Param: {{ P.foo }}
133137
134- Text: {{"foo <img >"}}
138+ Text: {{ "foo <img >" }}
135139
136- Html: {{"<img >"}}
140+ Html: {{ "<img >" }}
137141
138- echo: {{echo('<img src =" /images/head.png " >')}}
142+ echo: {{ echo('<img src =" /images/head.png " >') }}
139143
140- echoRaw: {{echoRaw('<img src =" /images/head.png " >')}}
144+ echoRaw: {{ echoRaw('<img src =" /images/head.png " >') }}
141145
142146
143147
144148## Control Structures
145149
146- {{local depth = 0}}
147- {{do }}
148- {{local depth = 1}}
149- {{do }}
150- {{local depth = 2}}
151- Inner do...end at {{depth}}.
152- {{end}}
153- Outer do...end at {{depth}}.
154- {{end}}
155- Outside do...end at {{depth}}.
156-
157- {{local favoriteFruit = "banana"}}
158- {{if favoriteFruit == "apple"}}
150+ {{ local depth = 0 }}
151+ {{ do }}
152+ {{ local depth = 1 }}
153+ {{ do }}
154+ {{ local depth = 2 }}
155+ Inner do...end at {{ depth }}.
156+ {{ end }}
157+ Outer do...end at {{ depth }}.
158+ {{ end }}
159+ Outside do...end at {{ depth }}.
160+
161+ {{ local favoriteFruit = "banana" }}
162+ {{ if favoriteFruit == "apple" }}
159163Favorite fruit is apple!
160- {{elseif favoriteFruit == "banana"}}
164+ {{ elseif favoriteFruit == "banana" }}
161165Favorite fruit is banana!
162- {{else}}
166+ {{ else }}
163167Favorite fruit is neither apple nor banana. :(
164- {{end}}
168+ {{ end }}
165169
166- {{for i = 1, 3}}
167- - For {{i }}
168- {{end}}
170+ {{ for i = 1, 3 }}
171+ - For {{ i }}
172+ {{ end }}
169173
170- {{for 3}}
171- - Short form {{i }}
172- {{end}}
174+ {{ for 3 }}
175+ - Short form {{ i }}
176+ {{ end }}
173177
174- {{for < 3}}
175- - Backwards {{i }}
176- {{end}}
178+ {{ for < 3 }}
179+ - Backwards {{ i }}
180+ {{ end }}
177181
178- {{local n = 3}}
179- {{while n > 0}}
180- - Countdown #{{n }}
181- {{n = n-1}}
182- {{end}}
182+ {{ local n = 3 }}
183+ {{ while n > 0 }}
184+ - Countdown #{{ n }}
185+ {{ n = n-1 }}
186+ {{ end }}
183187
184- {{repeat}}
185- {{n = n+1}}
186- - Count #{{n }}
187- {{until n >= 3}}
188+ {{ repeat }}
189+ {{ n = n+1 }}
190+ - Count #{{ n }}
191+ {{ until n >= 3 }}
188192
189193
190194
191195## Data
192196
193197Dogs:
194- {{fori dog in data.dogs}}
195- - {{i }}: {{dog.name}} (age {{dog.age}})
196- {{end}}
198+ {{ fori dog in data.dogs }}
199+ - {{ i }}: {{ dog.name }} (age {{ dog.age }})
200+ {{ end }}
197201
198202Cats, in reverse:
199- {{fori < data.cats.cats}}
200- - {{i }}: {{it.name}} (age {{it.age}})
201- {{end}}
203+ {{ fori < data.cats.cats }}
204+ - {{ i }}: {{ it.name }} (age {{ it.age }})
205+ {{ end }}
202206
203207{{ io.write("JSON: ") ; printObject(data.random) }}
204208{{ io.write("XML: ") ; print(data.barf: getFirstElement ()) }}
@@ -207,11 +211,11 @@ Cats, in reverse:
207211
208212## Scripts
209213
210- ipsum: {{ipsum()}}
214+ ipsum: {{ ipsum() }}
211215
212- echoOgres: {{echoOgres()}}
216+ echoOgres: {{ scripts. echoOgres() -- [[ echoOgres() and scripts.echoOgres() refer to the same script. ]] }}
213217
214- fullscreenImage: {{fullscreenImage"/images/head.png"}}
218+ fullscreenImage: {{ fullscreenImage"/images/head.png" }}
215219
216220
217221
0 commit comments