diff options
| author | Leedehai <18319900+Leedehai@users.noreply.github.com> | 2024-03-09 03:45:54 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-09 08:45:54 +0000 |
| commit | 4ab1b0fe3d8e1e9e2264de8fb254d2eb9c33723b (patch) | |
| tree | 246b9d88899ca12474fccac128af7ebbc28f64c0 | |
| parent | aace521b56a078fd73f3d76862ee5f5d49235c51 (diff) | |
Consolidate what internal methods Counter's user-visible methods call (#3561)
| -rw-r--r-- | crates/typst/src/introspection/counter.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/typst/src/introspection/counter.rs b/crates/typst/src/introspection/counter.rs index 3bf553a5..c3ed2bc7 100644 --- a/crates/typst/src/introspection/counter.rs +++ b/crates/typst/src/introspection/counter.rs @@ -213,7 +213,7 @@ impl Counter { /// The counter for the given element. pub fn of(func: Element) -> Self { - Self::construct(CounterKey::Selector(Selector::Elem(func, None))) + Self::new(CounterKey::Selector(Selector::Elem(func, None))) } /// Gets the current and final value of the state combined in one state. @@ -405,14 +405,14 @@ impl Counter { /// /// - If it is a string, creates a custom counter that is only affected /// by manual updates, - /// - If this is a `{<label>}`, counts through all elements with that - /// label, - /// - If this is an element function or selector, counts through its - /// elements, - /// - If this is the [`page`] function, counts through pages. + /// - If it is the [`page`] function, counts through pages, + /// - If it is a [selector], counts through elements that matches with the + /// selector. For example, + /// - provide an element function: counts elements of that type, + /// - provide a [`{<label>}`]($label): counts elements with that label. key: CounterKey, ) -> Counter { - Self(key) + Self::new(key) } /// Retrieves the value of the counter at the current location. Always |
