From cefca7a7d849bc4136fe314fe59a49b70219dbd7 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 20 Aug 2024 15:12:12 +0000 Subject: [PATCH] Fix typos (#4784) --- crates/typst-pdf/src/gradient.rs | 2 +- crates/typst-syntax/src/ast.rs | 2 +- crates/typst-syntax/src/node.rs | 2 +- crates/typst-utils/src/hash.rs | 4 ++-- crates/typst/src/introspection/locator.rs | 2 +- crates/typst/src/layout/grid/mod.rs | 2 +- crates/typst/src/layout/inline/line.rs | 2 +- crates/typst/src/layout/inline/linebreak.rs | 24 ++++++++++----------- crates/typst/src/model/par.rs | 2 +- crates/typst/src/model/table.rs | 6 +++--- crates/typst/src/text/shift.rs | 2 +- tests/src/logger.rs | 2 +- tests/suite/layout/measure.typ | 2 +- tests/suite/model/ref.typ | 2 +- tools/test-helper/src/extension.ts | 2 +- 15 files changed, 29 insertions(+), 29 deletions(-) diff --git a/crates/typst-pdf/src/gradient.rs b/crates/typst-pdf/src/gradient.rs index 5f85f9ca9..81dc27483 100644 --- a/crates/typst-pdf/src/gradient.rs +++ b/crates/typst-pdf/src/gradient.rs @@ -223,7 +223,7 @@ fn shading_function( function } -/// Writes an expontential function that expresses a single segment (between two +/// Writes an exponential function that expresses a single segment (between two /// stops) of a gradient. fn single_gradient( chunk: &mut PdfChunk, diff --git a/crates/typst-syntax/src/ast.rs b/crates/typst-syntax/src/ast.rs index 3d3a85ad4..5fbd11429 100644 --- a/crates/typst-syntax/src/ast.rs +++ b/crates/typst-syntax/src/ast.rs @@ -1443,7 +1443,7 @@ pub enum BinOp { NotIn, /// The add-assign operator: `+=`. AddAssign, - /// The subtract-assign oeprator: `-=`. + /// The subtract-assign operator: `-=`. SubAssign, /// The multiply-assign operator: `*=`. MulAssign, diff --git a/crates/typst-syntax/src/node.rs b/crates/typst-syntax/src/node.rs index bc378e667..a3487e45b 100644 --- a/crates/typst-syntax/src/node.rs +++ b/crates/typst-syntax/src/node.rs @@ -824,7 +824,7 @@ pub enum Side { After, } -/// Access to leafs. +/// Access to leaves. impl<'a> LinkedNode<'a> { /// Get the rightmost non-trivia leaf before this node. pub fn prev_leaf(&self) -> Option { diff --git a/crates/typst-utils/src/hash.rs b/crates/typst-utils/src/hash.rs index dabae24c2..3dbadbe20 100644 --- a/crates/typst-utils/src/hash.rs +++ b/crates/typst-utils/src/hash.rs @@ -16,8 +16,8 @@ use siphasher::sip128::{Hasher128, SipHasher13}; /// Note that for a value `v` of type `T`, `hash(v)` is not necessarily equal to /// `hash(LazyHash::new(v))`. Writing the precomputed hash into a hasher's /// state produces different output than writing the value's parts directly. -/// However, that seldomly matters as you are typically either dealing with -/// values of type `T` or with values of type `LazyHash`, not a mix of both. +/// However, that seldom matters as you are typically either dealing with values +/// of type `T` or with values of type `LazyHash`, not a mix of both. /// /// # Equality /// Because Typst uses high-quality 128 bit hashes in all places, the risk of a diff --git a/crates/typst/src/introspection/locator.rs b/crates/typst/src/introspection/locator.rs index 4df94a2c4..e6a707e91 100644 --- a/crates/typst/src/introspection/locator.rs +++ b/crates/typst/src/introspection/locator.rs @@ -95,7 +95,7 @@ use crate::introspection::{Introspector, Location}; /// that layer upfront and then start forking out. The final remaining /// question is how we can compactly encode this information: For this, as /// always, we use hashing! We incorporate the ID information from each layer -/// into a single hash and thanks to the collision resistence of 128-bit +/// into a single hash and thanks to the collision resistance of 128-bit /// SipHash, we get almost guaranteed unique locations. We don't even store /// the full layer information at all, but rather hash _hierarchically:_ Let /// `k_x` be our local per-layer ID for layer `x` and `h_x` be the full diff --git a/crates/typst/src/layout/grid/mod.rs b/crates/typst/src/layout/grid/mod.rs index 08257a5ca..d47983058 100644 --- a/crates/typst/src/layout/grid/mod.rs +++ b/crates/typst/src/layout/grid/mod.rs @@ -45,7 +45,7 @@ use crate::visualize::{Paint, Stroke}; /// intended for presentational and layout purposes, while the /// [`{table}`]($table) element is intended for, in broad terms, presenting /// multiple related data points. In the future, Typst will annotate its output -/// such that screenreaders will annouce content in `table` as tabular while a +/// such that screenreaders will announce content in `table` as tabular while a /// grid's content will be announced no different than multiple content blocks /// in the document flow. Set and show rules on one of these elements do not /// affect the other. diff --git a/crates/typst/src/layout/inline/line.rs b/crates/typst/src/layout/inline/line.rs index bf1662ce3..d9218e82a 100644 --- a/crates/typst/src/layout/inline/line.rs +++ b/crates/typst/src/layout/inline/line.rs @@ -256,7 +256,7 @@ where } } -/// Collects / reshapes all items for the given `subrange` with continous +/// Collects / reshapes all items for the given `subrange` with continuous /// direction. fn collect_range<'a>( engine: &Engine, diff --git a/crates/typst/src/layout/inline/linebreak.rs b/crates/typst/src/layout/inline/linebreak.rs index defb5f81c..7df65609a 100644 --- a/crates/typst/src/layout/inline/linebreak.rs +++ b/crates/typst/src/layout/inline/linebreak.rs @@ -348,7 +348,7 @@ fn linebreak_optimized_bounded<'a>( /// Runs the normal Knuth-Plass algorithm, but instead of building proper lines /// (which is costly) to determine costs, it determines approximate costs using -/// cummulative arrays. +/// cumulative arrays. /// /// This results in a likely good paragraph layouts, for which we then compute /// the exact cost. This cost is an upper bound for proper optimized @@ -360,7 +360,7 @@ fn linebreak_optimized_approximate( width: Abs, metrics: &CostMetrics, ) -> Cost { - // Determine the cummulative estimation metrics. + // Determine the cumulative estimation metrics. let estimates = Estimates::compute(p); /// An entry in the dynamic programming table for paragraph optimization. @@ -872,10 +872,10 @@ impl CostMetrics { /// Allows to get a quick estimate of a metric for a line between two byte /// positions. struct Estimates { - widths: CummulativeVec, - stretchability: CummulativeVec, - shrinkability: CummulativeVec, - justifiables: CummulativeVec, + widths: CumulativeVec, + stretchability: CumulativeVec, + shrinkability: CumulativeVec, + justifiables: CumulativeVec, } impl Estimates { @@ -883,10 +883,10 @@ impl Estimates { fn compute(p: &Preparation) -> Self { let cap = p.text.len(); - let mut widths = CummulativeVec::with_capacity(cap); - let mut stretchability = CummulativeVec::with_capacity(cap); - let mut shrinkability = CummulativeVec::with_capacity(cap); - let mut justifiables = CummulativeVec::with_capacity(cap); + let mut widths = CumulativeVec::with_capacity(cap); + let mut stretchability = CumulativeVec::with_capacity(cap); + let mut shrinkability = CumulativeVec::with_capacity(cap); + let mut justifiables = CumulativeVec::with_capacity(cap); for (range, item) in p.items.iter() { if let Item::Text(shaped) = item { @@ -919,12 +919,12 @@ impl Estimates { } /// An accumulative array of a metric. -struct CummulativeVec { +struct CumulativeVec { total: T, summed: Vec, } -impl CummulativeVec +impl CumulativeVec where T: Default + Copy + Add + Sub, { diff --git a/crates/typst/src/model/par.rs b/crates/typst/src/model/par.rs index dc41297ab..25e563325 100644 --- a/crates/typst/src/model/par.rs +++ b/crates/typst/src/model/par.rs @@ -123,7 +123,7 @@ pub struct ParElem { #[resolve] pub hanging_indent: Length, - /// Indicates wheter an overflowing line should be shrunk. + /// Indicates whether an overflowing line should be shrunk. /// /// This property is set to `false` on raw blocks, because shrinking a line /// could visually break the indentation. diff --git a/crates/typst/src/model/table.rs b/crates/typst/src/model/table.rs index da7b60827..02c2f0d40 100644 --- a/crates/typst/src/model/table.rs +++ b/crates/typst/src/model/table.rs @@ -39,9 +39,9 @@ use crate::visualize::{Paint, Stroke}; /// your presentation by arranging unrelated content in a grid. In the former /// case, a table is the right choice, while in the latter case, a grid is more /// appropriate. Furthermore, Typst will annotate its output in the future such -/// that screenreaders will annouce content in `table` as tabular while a grid's -/// content will be announced no different than multiple content blocks in the -/// document flow. +/// that screenreaders will announce content in `table` as tabular while a +/// grid's content will be announced no different than multiple content blocks +/// in the document flow. /// /// Note that, to override a particular cell's properties or apply show rules on /// table cells, you can use the [`table.cell`]($table.cell) element. See its diff --git a/crates/typst/src/text/shift.rs b/crates/typst/src/text/shift.rs index 2dbfd2b6d..0029a3035 100644 --- a/crates/typst/src/text/shift.rs +++ b/crates/typst/src/text/shift.rs @@ -128,7 +128,7 @@ impl Show for Packed { } /// Find and transform the text contained in `content` to the given script kind -/// if and only if it only consists of `Text`, `Space`, and `Empty` leafs. +/// if and only if it only consists of `Text`, `Space`, and `Empty` leaves. fn search_text(content: &Content, sub: bool) -> Option { if content.is::() { Some(' '.into()) diff --git a/tests/src/logger.rs b/tests/src/logger.rs index 1acf7c143..b6b44848c 100644 --- a/tests/src/logger.rs +++ b/tests/src/logger.rs @@ -89,7 +89,7 @@ impl<'a> Logger<'a> { let Self { selected, passed, failed, skipped, .. } = *self; eprintln!("{passed} passed, {failed} failed, {skipped} skipped"); - assert_eq!(selected, passed + failed, "not all tests were executed succesfully"); + assert_eq!(selected, passed + failed, "not all tests were executed successfully"); if self.mismatched_image { eprintln!(" pass the --update flag to update the reference images"); diff --git a/tests/suite/layout/measure.typ b/tests/suite/layout/measure.typ index 71a6b32a4..5429c611e 100644 --- a/tests/suite/layout/measure.typ +++ b/tests/suite/layout/measure.typ @@ -24,7 +24,7 @@ --- measure-counter-width --- // Measure a counter. Tests that the introspector-assisted location assignment // is able to take `here()` from the context into account to find the closest -// matching element instaed of any single one. Crucially, we need to reuse +// matching element instead of any single one. Crucially, we need to reuse // the same `context c.display()` to get the same span, hence `it`. #let f(it) = context [ Is #measure(it).width wide: #it \ diff --git a/tests/suite/model/ref.typ b/tests/suite/model/ref.typ index d0881202c..cc6d6bf11 100644 --- a/tests/suite/model/ref.typ +++ b/tests/suite/model/ref.typ @@ -47,7 +47,7 @@ $ A = 1 $ #set ref(supplement: none) @fig1, @fig2, @eq1, @eq2 ---- ref-ambigious --- +--- ref-ambiguous --- // Test ambiguous reference. = Introduction diff --git a/tools/test-helper/src/extension.ts b/tools/test-helper/src/extension.ts index 15d4197a1..8d8a155fb 100644 --- a/tools/test-helper/src/extension.ts +++ b/tools/test-helper/src/extension.ts @@ -24,7 +24,7 @@ class TestHelper { // The current zoom scale. scale = 1.0; - // The extention's status bar item. + // The extension's status bar item. statusItem: vscode.StatusBarItem; // The active message of the status item.