diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-09-13 15:42:28 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-09-13 15:42:35 +0200 |
| commit | 88404e924b20cdacf6c3c2ab79c432e2a65c8f5f (patch) | |
| tree | a31ef00f76a90b49943b5e72ac0a43f6b5eae5bb /docs/reference | |
| parent | ff2650373c97bcd94d7ffac916f5ee631ee42aed (diff) | |
Mention import renaming in the docs
Diffstat (limited to 'docs/reference')
| -rw-r--r-- | docs/reference/scripting.md | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/docs/reference/scripting.md b/docs/reference/scripting.md index 29448c72..3ac2b1db 100644 --- a/docs/reference/scripting.md +++ b/docs/reference/scripting.md @@ -291,13 +291,15 @@ ways: - **Import:** `{import "bar.typ"}` \ Evaluates the file at the path `bar.typ` and inserts the resulting [module]($module) into the current scope as `bar` (filename without - extension). + extension). You can use the `as` keyword to rename the imported module: + `{import "bar.typ" as baz}` - **Import items:** `{import "bar.typ": a, b}` \ Evaluates the file at the path `bar.typ`, extracts the values of the variables `a` and `b` (that need to be defined in `bar.typ`, e.g. through `{let}` - bindings) and defines them in the current file. Replacing `a, b` with `*` loads - all variables defined in a module. + bindings) and defines them in the current file. Replacing `a, b` with `*` + loads all variables defined in a module. You can use the `as` keyword to + rename the individual items: `{import "bar.typ": a as one, b as two}` Instead of a path, you can also use a [module value]($module), as shown in the following example: |
