You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: doc/language.md
+17-16
Original file line number
Diff line number
Diff line change
@@ -104,9 +104,9 @@ A scriban code block may contain:
104
104
{{if !name; name = "default"; end; name }}
105
105
```
106
106
107
-
Inside a code block, except for the EOL after each statement, white spaces characters are not affecting the parsing. There is only one case where whitespace is used to disambiguate between an array indexer and an array initializer.
107
+
In a code block, white space characters have no impact on parsing, with the exception of the end-of-line character following each statement. The only exception is when white space is used to distinguish between an array indexer and an array initializer.
108
108
109
-
Also, if a statement is an expression (but not an assignment expression), the result of the expression will be output to the rendering output of the template:
109
+
Additionally, when a statement is an expression (but not an assignment expression), the result of the expression will be displayed in the template's output:
110
110
111
111
> **input**
112
112
```scriban-html
@@ -138,7 +138,7 @@ You can still use a plain string with an EOL inside a code block `"\n"` or you c
138
138
[:top:](#language)
139
139
### 1.2 Text block
140
140
141
-
Otherwise, any text is considered as a **text block** and simply output as is
141
+
Otherwise, any text is treated as a **text block** and is outputted without modification.
142
142
143
143
```
144
144
Hello this is {{ name }}, welcome to scriban!
@@ -156,13 +156,14 @@ For example the following escape:
156
156
> **input**: `{%{Hello this is {{ name }}}%}`
157
157
> **output**: `Hello this is {{ name }}`
158
158
159
-
Any escape block can be also escaped by increasing the number of `%` in the starting and ending block:
159
+
If you want to escape an escape block, you can increase the number of % in the starting and ending block:
160
160
> **input**: `{%%{This is an escaped block: }%} here}%%}`
161
161
> **output**: `This is an escaped block: }%} here`
162
162
163
163
This allow effectively to nest escape blocks and still be able to escape them.
164
164
165
-
Hence a starting escape block `{%%%%{` will required an ending `}%%%%}`
165
+
This allows for effective nesting of escape blocks and the ability to escape them.
166
+
For example, a starting escape block {%%%%{ will require an ending }%%%%}"
166
167
167
168
[:top:](#language)
168
169
### 1.4 Whitespace control
@@ -436,7 +437,7 @@ b.x
436
437
[:top:](#language)
437
438
### 4.2 The special variable `empty`
438
439
439
-
The `empty` variable represents simply an empty object. It is mainly relevant to be compatible with liquid, by providing a way to compare an object with the `empty` object to check if it is empty or not:
440
+
The empty variable represents an empty object and is primarily used for compatibility with Liquid templates. It provides a way to compare an object with the empty variable to determine if it is empty or not:
440
441
441
442
> **input**
442
443
```scriban-html
@@ -457,7 +458,7 @@ false
457
458
458
459
Scriban supports javascript like objects `{...}`
459
460
460
-
An object can be initialized empty:
461
+
An object can be initialized empty:
461
462
462
463
`{{ myobject = {} }}`
463
464
@@ -480,7 +481,7 @@ An object can be initialized with some members over multiple lines:
480
481
}}
481
482
```
482
483
483
-
Members of an object can be accessed:
484
+
Members of an object can be accessed using dot notation or square bracket notation:
484
485
485
486
`{{ myobject.member1 }}` also equivalent to `{{ myobject["member1"] }}`
486
487
@@ -530,7 +531,7 @@ false
530
531
[:top:](#language)
531
532
## 6 Arrays
532
533
533
-
An array can be initialized empty:
534
+
An array can be initialized empty:
534
535
535
536
`{{ myarray = [] }}`
536
537
@@ -622,7 +623,7 @@ a.size
622
623
[:top:](#language)
623
624
## 7 Functions
624
625
625
-
Scriban allows to define 4 kind of functions:
626
+
Scriban allows for the definition of four different types of functions:
626
627
627
628
- Simple functions
628
629
- Anonymous functions
@@ -631,7 +632,7 @@ Scriban allows to define 4 kind of functions:
631
632
632
633
### 7.1 Simple functions
633
634
634
-
The following declares a function `sub` that uses its first argument and subtract from it the second argument:
635
+
The following declares a function `sub` that takes two arguments, `a` and `b`, and subtracts the value of `b` from `a`:
635
636
636
637
```
637
638
{{func sub
@@ -1164,7 +1165,7 @@ Allows to start the iteration of the loop at the specified zero-based index:
1164
1165
1165
1166
##### The `limit` parameter
1166
1167
1167
-
Allows to limit the iteration of the loop for the specified count
1168
+
Limits the iteration of the loop to a specified count:
1168
1169
1169
1170
> **input**
1170
1171
```scriban-html
@@ -1180,7 +1181,7 @@ Allows to limit the iteration of the loop for the specified count
1180
1181
1181
1182
##### The `reversed` parameter
1182
1183
1183
-
Allows to reverse the iteration on the elements
1184
+
Reverses the iteration of the elements:
1184
1185
1185
1186
> **input**
1186
1187
```scriban-html
@@ -1211,7 +1212,7 @@ Like the `if` statement, the `expression` is evaluated to a boolean.
1211
1212
This function generates HTML rows compatible with an HTML table. Must be wrapped in an opening `<table>` and closing `</table>` HTML tags.
1212
1213
1213
1214
This statement is mainly for compatibility reason with the liquid `tablerow` tag.
1214
-
It has overall the same syntax as a `for` statement (supporting the same parameters).
1215
+
It uses similar syntax to a `for` statement (supporting the same parameters).
1215
1216
1216
1217
```
1217
1218
{{tablerow <variable> in <expression>}}
@@ -1404,7 +1405,7 @@ Note that variables declared outside the `with` block are accessible within.
1404
1405
[:top:](#language)
1405
1406
### 9.11 `include <name> arg1?...argn?`
1406
1407
1407
-
The include is not a statement but actually a function that allows to parse and render the specified template name. In order to use this function, a delegate to an template loader must be setup on the [`TemplateOptions.TemplateLoader`](runtime.md#include-and-itemplateloader) property passed to the `Template.Parse` method.
1408
+
`include` is not a statement but rather a function that allows you to parse and render a specified template. To use this function, a delegate to a template loader must be setup on the [`TemplateOptions.TemplateLoader`](runtime.md#include-and-itemplateloader) property passed to the `Template.Parse` method.
1408
1409
1409
1410
```
1410
1411
include 'myinclude.html'
@@ -1432,7 +1433,7 @@ The return statement is used to early exit from a top-level/include page or a fu
0 commit comments