-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
grouping: Handle none as empty array (#491)
Allows passing `none` or `ctx => {}` to grouping functions (`group`, `on-layer`, ...). This is very useful when having conditional draw commands insides a group. Example: ``` group(ctx => { if .. { // If this does not get evaluated, cetz currently fails because the group returned `none`. // Current workaround is writing () at the end of such groups to auto-join an empty array. } }) ``` This PR is an improved implementation of the one rejected from #479.
- Loading branch information
1 parent
b36ffd0
commit 5bc5fc3
Showing
6 changed files
with
56 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#import "/src/lib.typ": * | ||
#import "/tests/helper.typ": * | ||
|
||
#test-case({ | ||
import draw: * | ||
|
||
group(none) | ||
group(ctx => none) | ||
}) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters