diff --git a/docs/tour/globs.md b/docs/tour/globs.md index 7e98b68..958e8ed 100644 --- a/docs/tour/globs.md +++ b/docs/tour/globs.md @@ -10,6 +10,8 @@ import GlobsRecursive from '@site/static/d2/globs-recursive.d2'; import GlobsRecursive2 from '@site/static/d2/globs-recursive-2.d2'; import GlobsFilter from '@site/static/d2/globs-filter.d2'; import GlobsFilter2 from '@site/static/d2/globs-filter-2.d2'; +import GlobsFilterGlobValue from '@site/static/d2/globs-filter-glob-value.d2'; +import GlobsInverseFilter from '@site/static/d2/globs-inverse-filter.d2'; import GlobsNested from '@site/static/d2/globs-nested.d2'; # Globs @@ -125,6 +127,8 @@ Use `&` to filter what globs target.
+### Filters on array values + If the filtered attribute has an array value, the filter will match if it matches any element of the array. @@ -134,9 +138,26 @@ element of the array.
-:::info -We are working on adding more filters, as well as the "not-filter", `!&`. -::: +### Globs as filter values + +Globs can also appear in the value of a filter. `*` by itself as a value for a filter +means the key must be specified. + + + {GlobsFilterGlobValue} + + +
+ +## Inverse filters + +Use `!&` to inverse-filter what globs target. + + + {GlobsInverseFilter} + + +
## Nested globs diff --git a/static/d2/globs-filter-glob-value.d2 b/static/d2/globs-filter-glob-value.d2 new file mode 100644 index 0000000..bedf906 --- /dev/null +++ b/static/d2/globs-filter-glob-value.d2 @@ -0,0 +1,7 @@ +*: { + &link: *; + style.fill: red +} + +x.link: https://google.com +y diff --git a/static/d2/globs-inverse-filter.d2 b/static/d2/globs-inverse-filter.d2 new file mode 100644 index 0000000..eecb37d --- /dev/null +++ b/static/d2/globs-inverse-filter.d2 @@ -0,0 +1,9 @@ +bravo team.shape: person +charlie team.shape: person +command center.shape: cloud +hq.shape: rectangle + +*: { + !&shape: person + style.multiple: true +} diff --git a/static/img/generated/globs-filter-glob-value.svg2 b/static/img/generated/globs-filter-glob-value.svg2 new file mode 100644 index 0000000..c867a60 --- /dev/null +++ b/static/img/generated/globs-filter-glob-value.svg2 @@ -0,0 +1,183 @@ +xy + + + + + + + + + + + + + + + + diff --git a/static/img/generated/globs-inverse-filter.svg2 b/static/img/generated/globs-inverse-filter.svg2 new file mode 100644 index 0000000..b5da6bb --- /dev/null +++ b/static/img/generated/globs-inverse-filter.svg2 @@ -0,0 +1,170 @@ +bravo teamcharlie teamcommand centerhq + + + + + +