Improve clarity regarding location parameter in counter.final() (#1962)

This commit is contained in:
Lukas Löring 2023-08-21 16:53:56 +02:00 committed by GitHub
parent 73999fe823
commit f600515625
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 16 deletions

View File

@ -267,12 +267,13 @@ use crate::prelude::*;
/// array of integers, even if the counter has just one number. /// array of integers, even if the counter has just one number.
/// ///
/// - location: location (positional, required) /// - location: location (positional, required)
/// Can be any location. Why is it required then? Typst has to evaluate parts /// Can be an arbitrary location, as its value is irrelevant for the method's
/// of your code multiple times to determine all counter values. By only /// return value. Why is it required then? Typst has to evaluate parts of your
/// allowing this method within [`locate`]($func/locate) calls, the amount of /// code multiple times to determine all counter values. By only allowing this
/// code that can depend on the method's result is reduced. If you could call /// method within [`locate`]($func/locate) calls, the amount of code that can
/// `final` directly at the top level of a module, the evaluation of the whole /// depend on the method's result is reduced. If you could call `final`
/// module and its exports could depend on the counter's value. /// directly at the top level of a module, the evaluation of the whole module
/// and its exports could depend on the counter's value.
/// ///
/// - returns: array /// - returns: array
/// ///

View File

@ -140,9 +140,10 @@ pub fn query(
/// have an explicit label attached to them. This limitation will be /// have an explicit label attached to them. This limitation will be
/// resolved in the future. /// resolved in the future.
target: LocatableSelector, target: LocatableSelector,
/// Can be any location. Why is it required then? As noted before, Typst has /// Can be an arbitrary location, as its value is irrelevant for the
/// to evaluate parts of your code multiple times to determine the values of /// function's return value. Why is it required then? As noted before, Typst
/// all state. By only allowing this function within /// has to evaluate parts of your code multiple times to determine the
/// values of all state. By only allowing this function within
/// [`locate`]($func/locate) calls, the amount of code that can depend on /// [`locate`]($func/locate) calls, the amount of code that can depend on
/// the query's result is reduced. If you could call it directly at the top /// the query's result is reduced. If you could call it directly at the top
/// level of a module, the evaluation of the whole module and its exports /// level of a module, the evaluation of the whole module and its exports

View File

@ -222,13 +222,14 @@ use crate::prelude::*;
/// Gets the value of the state at the end of the document. /// Gets the value of the state at the end of the document.
/// ///
/// - location: location (positional, required) /// - location: location (positional, required)
/// Can be any location. Why is it required then? As noted before, Typst has /// Can be an arbitrary location, as its value is irrelevant for the method's
/// to evaluate parts of your code multiple times to determine the values of /// return value. Why is it required then? As noted before, Typst has to
/// all state. By only allowing this method within [`locate`]($func/locate) /// evaluate parts of your code multiple times to determine the values of all
/// calls, the amount of code that can depend on the method's result is /// state. By only allowing this method within [`locate`]($func/locate) calls,
/// reduced. If you could call `final` directly at the top level of a module, /// the amount of code that can depend on the method's result is reduced. If
/// the evaluation of the whole module and its exports could depend on the /// you could call `final` directly at the top level of a module, the
/// state's value. /// evaluation of the whole module and its exports could depend on the state's
/// value.
/// ///
/// - returns: any /// - returns: any
/// ///