Fix dead links

This commit is contained in:
Laurenz 2023-09-30 11:49:02 +02:00
parent 0ed84797e8
commit c97fc5eb55
5 changed files with 17 additions and 11 deletions

View File

@ -44,6 +44,7 @@ fn global(math: Module) -> Module {
/// Defines scoped values that are globally available, too. /// Defines scoped values that are globally available, too.
fn prelude(global: &mut Scope) { fn prelude(global: &mut Scope) {
global.reset_category();
global.define("black", Color::BLACK); global.define("black", Color::BLACK);
global.define("gray", Color::GRAY); global.define("gray", Color::GRAY);
global.define("silver", Color::SILVER); global.define("silver", Color::SILVER);

View File

@ -109,6 +109,11 @@ impl Scope {
self.category = Some(name); self.category = Some(name);
} }
/// Reset the category.
pub fn reset_category(&mut self) {
self.category = None;
}
/// Bind a value to a name. /// Bind a value to a name.
#[track_caller] #[track_caller]
pub fn define(&mut self, name: impl Into<EcoString>, value: impl IntoValue) { pub fn define(&mut self, name: impl Into<EcoString>, value: impl IntoValue) {

View File

@ -20,10 +20,10 @@ type Luma = palette::luma::Luma<encoding::Srgb, f32>;
/// A color in a specific color space. /// A color in a specific color space.
/// ///
/// Typst supports: /// Typst supports:
/// - sRGB through the [`rgb` function]($rgb) /// - sRGB through the [`rgb` function]($color.rgb)
/// - Device CMYK through [`cmyk` function]($cmyk) /// - Device CMYK through [`cmyk` function]($color.cmyk)
/// - D65 Gray through the [`luma` function]($luma) /// - D65 Gray through the [`luma` function]($color.luma)
/// - Oklab through the [`oklab` function]($oklab) /// - Oklab through the [`oklab` function]($color.oklab)
/// - Linear RGB through the [`color.linear-rgb` function]($color.linear-rgb) /// - Linear RGB through the [`color.linear-rgb` function]($color.linear-rgb)
/// - HSL through the [`color.hsl` function]($color.hsl) /// - HSL through the [`color.hsl` function]($color.hsl)
/// - HSV through the [`color.hsv` function]($color.hsv) /// - HSV through the [`color.hsv` function]($color.hsv)
@ -181,7 +181,7 @@ impl Color {
/// This color space is similar to Srgb<f32>, but with the distinction that /// This color space is similar to Srgb<f32>, but with the distinction that
/// the color component are not gamma corrected. This makes it easier to /// the color component are not gamma corrected. This makes it easier to
/// perform color operations such as blending and interpolation. Although, /// perform color operations such as blending and interpolation. Although,
/// you should prefer to use the [`oklab` function]($oklab) for these. /// you should prefer to use the [`oklab` function]($color.oklab) for these.
/// ///
/// A linear RGB(A) color is represented internally by an array of four components: /// A linear RGB(A) color is represented internally by an array of four components:
/// - red ([`ratio`]($ratio)) /// - red ([`ratio`]($ratio))

View File

@ -515,7 +515,7 @@ description: |
- Added [`zip`]($array.zip), [`sum`]($array.sum), and - Added [`zip`]($array.zip), [`sum`]($array.sum), and
[`product`]($array.product) methods for arrays [`product`]($array.product) methods for arrays
- Added `fact`, `perm`, `binom`, `gcd`, `lcm`, `atan2`, `quo`, `trunc`, and - Added `fact`, `perm`, `binom`, `gcd`, `lcm`, `atan2`, `quo`, `trunc`, and
`fract` [calculation]($category/calculate) `fract` [calculation]($category/foundations/calc) functions
- Improvements - Improvements
- Text in SVGs now displays properly - Text in SVGs now displays properly

View File

@ -143,11 +143,11 @@ And finally a little loop:
``` ```
A function call always involves the name of the function ([`rect`]($rect), A function call always involves the name of the function ([`rect`]($rect),
[`underline`]($underline), [`calc.max`]($calc.max), [`range`]($range)) followed [`underline`]($underline), [`calc.max`]($calc.max), [`range`]($array.range))
by parentheses (as opposed to LaTeX where the square brackets and curly braces followed by parentheses (as opposed to LaTeX where the square brackets and curly
are optional if the macro requires no arguments). The expected list of arguments braces are optional if the macro requires no arguments). The expected list of
passed within those parentheses depends on the concrete function and is arguments passed within those parentheses depends on the concrete function and
specified in the [reference]($reference). is specified in the [reference]($reference).
### Arguments ### Arguments
A function can have multiple arguments. Some arguments are positional, i.e., you A function can have multiple arguments. Some arguments are positional, i.e., you