Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 20 additions & 20 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ default-members = ["crates/typst-cli"]
resolver = "2"

[workspace.package]
version = "0.14.1"
version = "0.14.2"
rust-version = "1.89" # also change in ci.yml
authors = ["The Typst Project Developers"]
edition = "2024"
Expand All @@ -16,24 +16,24 @@ keywords = ["typst"]
readme = "README.md"

[workspace.dependencies]
typst = { path = "crates/typst", version = "0.14.1" }
typst-cli = { path = "crates/typst-cli", version = "0.14.1" }
typst-eval = { path = "crates/typst-eval", version = "0.14.1" }
typst-html = { path = "crates/typst-html", version = "0.14.1" }
typst-ide = { path = "crates/typst-ide", version = "0.14.1" }
typst-kit = { path = "crates/typst-kit", version = "0.14.1" }
typst-layout = { path = "crates/typst-layout", version = "0.14.1" }
typst-library = { path = "crates/typst-library", version = "0.14.1" }
typst-macros = { path = "crates/typst-macros", version = "0.14.1" }
typst-pdf = { path = "crates/typst-pdf", version = "0.14.1" }
typst-realize = { path = "crates/typst-realize", version = "0.14.1" }
typst-render = { path = "crates/typst-render", version = "0.14.1" }
typst-svg = { path = "crates/typst-svg", version = "0.14.1" }
typst-syntax = { path = "crates/typst-syntax", version = "0.14.1" }
typst-timing = { path = "crates/typst-timing", version = "0.14.1" }
typst-utils = { path = "crates/typst-utils", version = "0.14.1" }
typst-assets = "0.14.1"
typst-dev-assets = { git = "https://github.com/typst/typst-dev-assets", tag = "v0.14.1" }
typst = { path = "crates/typst", version = "0.14.2" }
typst-cli = { path = "crates/typst-cli", version = "0.14.2" }
typst-eval = { path = "crates/typst-eval", version = "0.14.2" }
typst-html = { path = "crates/typst-html", version = "0.14.2" }
typst-ide = { path = "crates/typst-ide", version = "0.14.2" }
typst-kit = { path = "crates/typst-kit", version = "0.14.2" }
typst-layout = { path = "crates/typst-layout", version = "0.14.2" }
typst-library = { path = "crates/typst-library", version = "0.14.2" }
typst-macros = { path = "crates/typst-macros", version = "0.14.2" }
typst-pdf = { path = "crates/typst-pdf", version = "0.14.2" }
typst-realize = { path = "crates/typst-realize", version = "0.14.2" }
typst-render = { path = "crates/typst-render", version = "0.14.2" }
typst-svg = { path = "crates/typst-svg", version = "0.14.2" }
typst-syntax = { path = "crates/typst-syntax", version = "0.14.2" }
typst-timing = { path = "crates/typst-timing", version = "0.14.2" }
typst-utils = { path = "crates/typst-utils", version = "0.14.2" }
typst-assets = "0.14.2"
typst-dev-assets = { git = "https://github.com/typst/typst-dev-assets", tag = "v0.14.2" }
arrayvec = "0.7.4"
az = "1.2"
base64 = "0.22"
Expand Down Expand Up @@ -141,7 +141,7 @@ ureq = { version = "2", default-features = false, features = ["native-tls", "gzi
usvg = { version = "0.45", default-features = false, features = ["text"] }
utf8_iter = "1.0.4"
walkdir = "2"
wasmi = { version = "0.51.2", default-features = false, features = ["simd"] }
wasmi = { version = "0.51.5", default-features = false, features = ["simd"] }
web-sys = "0.3"
xmlparser = "0.13.5"
xmlwriter = "0.1.0"
Expand Down
22 changes: 18 additions & 4 deletions crates/typst-library/src/foundations/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ use serde::{Deserialize, Serialize};
use smallvec::SmallVec;
use typst_syntax::{Span, Spanned};

use crate::diag::{At, HintedStrResult, SourceDiagnostic, SourceResult, StrResult, bail};
use crate::diag::{
At, HintedStrResult, HintedString, SourceDiagnostic, SourceResult, StrResult, bail,
};
use crate::engine::Engine;
use crate::foundations::{
Args, Bytes, CastInfo, Context, Dict, FromValue, Func, IntoValue, Reflect, Repr, Str,
Expand Down Expand Up @@ -836,8 +838,9 @@ impl Array {
/// Return a sorted version of this array, optionally by a given key
/// function. The sorting algorithm used is stable.
///
/// Returns an error if two values could not be compared or if the key
/// or comparison function (if given) yields an error.
/// Returns an error if a pair of values selected for comparison could not
/// be compared, or if the key or comparison function (if given) yield an
/// error.
///
/// To sort according to multiple criteria at once, e.g. in case of equality
/// between some criteria, the key function can return an array. The results
Expand Down Expand Up @@ -975,7 +978,18 @@ impl Array {
match (key_of(a.clone()), key_of(b.clone())) {
(Ok(a), Ok(b)) => ops::compare(&a, &b).unwrap_or_else(|err| {
if result.is_ok() {
result = Err(err).at(span);
result =
Err(HintedString::from(err).with_hint(match key {
None => {
"consider choosing a `key` \
or defining the comparison with `by`"
}
Some(_) => {
"consider defining the comparison with `by` \
or choosing a different `key`"
}
}))
.at(span);
}
Ordering::Equal
}),
Expand Down
20 changes: 12 additions & 8 deletions crates/typst-library/src/foundations/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ pub use crate::__format_str as format_str;
/// #"\"hello\n world\"!" \
/// #"1 2 3".split() \
/// #"1,2;3".split(regex("[,;]")) \
/// #(regex("\d+") in "ten euros") \
/// #(regex("\d+") in "10 euros")
/// #(regex("\\d+") in "ten euros") \
/// #(regex("\\d+") in "10 euros")
/// ```
///
/// # Escape sequences { #escapes }
Expand Down Expand Up @@ -932,7 +932,7 @@ fn string_is_empty() -> EcoString {
/// #"a,b;c".split(regex("[,;]"))
///
/// // Works with show rules.
/// #show regex("\d+"): set text(red)
/// #show regex("\\d+"): set text(red)
///
/// The numbers 1 to 10.
/// ```
Expand All @@ -954,14 +954,18 @@ impl Regex {
pub fn construct(
/// The regular expression as a string.
///
/// Most regex escape sequences just work because they are not valid Typst
/// escape sequences. To produce regex escape sequences that are also valid in
/// Typst (e.g. `[\\]`), you need to escape twice. Thus, to match a verbatim
/// backslash, you would need to write `{regex("\\\\")}`.
/// Both Typst strings and regular expressions use backslashes for
/// escaping. To produce a regex escape sequence that is also valid in
/// Typst, you need to escape the backslash itself (e.g., writing
/// `{regex("\\\\")}` for the regex `\\`). Regex escape sequences that
/// are not valid Typst escape sequences (e.g., `\d` and `\b`) can be
/// entered into strings directly, but it's good practice to still
/// escape them to avoid ambiguity (i.e., `{regex("\\b\\d")}`). See the
/// [list of valid string escape sequences]($str/#escapes).
///
/// If you need many escape sequences, you can also create a raw element
/// and extract its text to use it for your regular expressions:
/// ```{regex(`\d+\.\d+\.\d+`.text)}```.
/// ``{regex(`\d+\.\d+\.\d+`.text)}``.
regex: Spanned<Str>,
) -> SourceResult<Regex> {
Self::new(&regex.v).at(regex.span)
Expand Down
2 changes: 1 addition & 1 deletion crates/typst-library/src/loading/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::loading::{DataSource, Load, Readable};
/// ```example
/// An example for a HTML file: \
/// #let text = read("example.html")
/// #raw(text, lang: "html")
/// #raw(text, block: true, lang: "html")
///
/// Raw bytes:
/// #read("tiger.jpg", encoding: none)
Expand Down
Loading
Loading