summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-09-30 11:49:02 +0200
committerLaurenz <laurmaedje@gmail.com>2023-09-30 11:49:02 +0200
commitc97fc5eb55931cfaa93577b1aadc71026269c43d (patch)
treed4edd4b2a8b32421464700fce433847f3841a713
parent0ed84797e857a14a4402b17277ecb6e05d722320 (diff)
Fix dead links
-rw-r--r--crates/typst-library/src/lib.rs1
-rw-r--r--crates/typst/src/eval/scope.rs5
-rw-r--r--crates/typst/src/geom/color.rs10
-rw-r--r--docs/changelog.md2
-rw-r--r--docs/guides/guide-for-latex-users.md10
5 files changed, 17 insertions, 11 deletions
diff --git a/crates/typst-library/src/lib.rs b/crates/typst-library/src/lib.rs
index 03e96441..da31409a 100644
--- a/crates/typst-library/src/lib.rs
+++ b/crates/typst-library/src/lib.rs
@@ -44,6 +44,7 @@ fn global(math: Module) -> Module {
/// Defines scoped values that are globally available, too.
fn prelude(global: &mut Scope) {
+ global.reset_category();
global.define("black", Color::BLACK);
global.define("gray", Color::GRAY);
global.define("silver", Color::SILVER);
diff --git a/crates/typst/src/eval/scope.rs b/crates/typst/src/eval/scope.rs
index 35ff202a..85bef53a 100644
--- a/crates/typst/src/eval/scope.rs
+++ b/crates/typst/src/eval/scope.rs
@@ -109,6 +109,11 @@ impl Scope {
self.category = Some(name);
}
+ /// Reset the category.
+ pub fn reset_category(&mut self) {
+ self.category = None;
+ }
+
/// Bind a value to a name.
#[track_caller]
pub fn define(&mut self, name: impl Into<EcoString>, value: impl IntoValue) {
diff --git a/crates/typst/src/geom/color.rs b/crates/typst/src/geom/color.rs
index b99ba83d..93d0a31f 100644
--- a/crates/typst/src/geom/color.rs
+++ b/crates/typst/src/geom/color.rs
@@ -20,10 +20,10 @@ type Luma = palette::luma::Luma<encoding::Srgb, f32>;
/// A color in a specific color space.
///
/// Typst supports:
-/// - sRGB through the [`rgb` function]($rgb)
-/// - Device CMYK through [`cmyk` function]($cmyk)
-/// - D65 Gray through the [`luma` function]($luma)
-/// - Oklab through the [`oklab` function]($oklab)
+/// - sRGB through the [`rgb` function]($color.rgb)
+/// - Device CMYK through [`cmyk` function]($color.cmyk)
+/// - D65 Gray through the [`luma` function]($color.luma)
+/// - Oklab through the [`oklab` function]($color.oklab)
/// - Linear RGB through the [`color.linear-rgb` function]($color.linear-rgb)
/// - HSL through the [`color.hsl` function]($color.hsl)
/// - 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
/// the color component are not gamma corrected. This makes it easier to
/// 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:
/// - red ([`ratio`]($ratio))
diff --git a/docs/changelog.md b/docs/changelog.md
index 15ba4d78..26290875 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -515,7 +515,7 @@ description: |
- Added [`zip`]($array.zip), [`sum`]($array.sum), and
[`product`]($array.product) methods for arrays
- Added `fact`, `perm`, `binom`, `gcd`, `lcm`, `atan2`, `quo`, `trunc`, and
- `fract` [calculation]($category/calculate)
+ `fract` [calculation]($category/foundations/calc) functions
- Improvements
- Text in SVGs now displays properly
diff --git a/docs/guides/guide-for-latex-users.md b/docs/guides/guide-for-latex-users.md
index 1ed839a8..ed3170ff 100644
--- a/docs/guides/guide-for-latex-users.md
+++ b/docs/guides/guide-for-latex-users.md
@@ -143,11 +143,11 @@ And finally a little loop:
```
A function call always involves the name of the function ([`rect`]($rect),
-[`underline`]($underline), [`calc.max`]($calc.max), [`range`]($range)) followed
-by parentheses (as opposed to LaTeX where the square brackets and curly braces
-are optional if the macro requires no arguments). The expected list of arguments
-passed within those parentheses depends on the concrete function and is
-specified in the [reference]($reference).
+[`underline`]($underline), [`calc.max`]($calc.max), [`range`]($array.range))
+followed by parentheses (as opposed to LaTeX where the square brackets and curly
+braces are optional if the macro requires no arguments). The expected list of
+arguments passed within those parentheses depends on the concrete function and
+is specified in the [reference]($reference).
### Arguments
A function can have multiple arguments. Some arguments are positional, i.e., you