mirror of
https://github.com/typst/typst
synced 2025-05-16 18:15:29 +08:00
Minor edits in the scripting documentation
This commit is contained in:
parent
db7ba6fe69
commit
e4286fbe9b
@ -157,6 +157,8 @@ resulting from the else's body.
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that the opening brace or bracket of the body must be on the same
|
||||||
|
line as the `#if` (unlike in many other languages).
|
||||||
Each branch can have a code or content block as its body.
|
Each branch can have a code or content block as its body.
|
||||||
|
|
||||||
- `{if condition {..}}`
|
- `{if condition {..}}`
|
||||||
@ -187,6 +189,8 @@ together into one larger array.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that the opening brace or bracket of the body must be on the same
|
||||||
|
line as the `#for` or `#whilde` (unlike in many other languages).
|
||||||
For loops can iterate over a variety of collections:
|
For loops can iterate over a variety of collections:
|
||||||
|
|
||||||
- `{for value in array {..}}` \
|
- `{for value in array {..}}` \
|
||||||
@ -245,6 +249,10 @@ The value in question can be either:
|
|||||||
[element function]($function/#element-functions) that were given when the
|
[element function]($function/#element-functions) that were given when the
|
||||||
element was constructed.
|
element was constructed.
|
||||||
|
|
||||||
|
**Important:** Many fields of element functions are only visible and accessible
|
||||||
|
in a concrete context that disambiguates their meaning. Consult the chapter
|
||||||
|
on [Context] for more information.
|
||||||
|
|
||||||
```example
|
```example
|
||||||
#let it = [= Heading]
|
#let it = [= Heading]
|
||||||
#it.body \
|
#it.body \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user