mirror of
https://github.com/typst/typst
synced 2025-08-13 14:47:54 +08:00
Compare commits
6 Commits
d5037b7031
...
24cad5af7a
Author | SHA1 | Date | |
---|---|---|---|
|
24cad5af7a | ||
|
7897e86bcc | ||
|
8e0e0f1a3b | ||
|
10b56e7ec5 | ||
|
ca87507b47 | ||
|
2da2ffd799 |
17
Cargo.lock
generated
17
Cargo.lock
generated
@ -748,9 +748,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flate2"
|
name = "flate2"
|
||||||
version = "1.1.0"
|
version = "1.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "11faaf5a5236997af9848be0bef4db95824b1d534ebc64d0f0c6cf3e67bd38dc"
|
checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"libz-rs-sys",
|
"libz-rs-sys",
|
||||||
@ -1469,9 +1469,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libz-rs-sys"
|
name = "libz-rs-sys"
|
||||||
version = "0.4.2"
|
version = "0.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "902bc563b5d65ad9bba616b490842ef0651066a1a1dc3ce1087113ffcb873c8d"
|
checksum = "172a788537a2221661b480fee8dc5f96c580eb34fa88764d3205dc356c7e4221"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"zlib-rs",
|
"zlib-rs",
|
||||||
]
|
]
|
||||||
@ -3932,13 +3932,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zip"
|
name = "zip"
|
||||||
version = "2.5.0"
|
version = "4.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "27c03817464f64e23f6f37574b4fdc8cf65925b5bfd2b0f2aedf959791941f88"
|
checksum = "9aed4ac33e8eb078c89e6cbb1d5c4c7703ec6d299fc3e7c3695af8f8b423468b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arbitrary",
|
"arbitrary",
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"crossbeam-utils",
|
|
||||||
"flate2",
|
"flate2",
|
||||||
"indexmap 2.7.1",
|
"indexmap 2.7.1",
|
||||||
"memchr",
|
"memchr",
|
||||||
@ -3947,9 +3946,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zlib-rs"
|
name = "zlib-rs"
|
||||||
version = "0.4.2"
|
version = "0.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8b20717f0917c908dc63de2e44e97f1e6b126ca58d0e391cee86d504eb8fbd05"
|
checksum = "626bd9fa9734751fc50d6060752170984d7053f5a39061f524cda68023d4db8a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zopfli"
|
name = "zopfli"
|
||||||
|
@ -143,7 +143,7 @@ xmlparser = "0.13.5"
|
|||||||
xmlwriter = "0.1.0"
|
xmlwriter = "0.1.0"
|
||||||
xz2 = { version = "0.1", features = ["static"] }
|
xz2 = { version = "0.1", features = ["static"] }
|
||||||
yaml-front-matter = "0.1"
|
yaml-front-matter = "0.1"
|
||||||
zip = { version = "2.5", default-features = false, features = ["deflate"] }
|
zip = { version = "4.3", default-features = false, features = ["deflate"] }
|
||||||
|
|
||||||
[profile.dev.package."*"]
|
[profile.dev.package."*"]
|
||||||
opt-level = 2
|
opt-level = 2
|
||||||
|
@ -797,7 +797,9 @@ impl Color {
|
|||||||
components
|
components
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the constructor function for this color's space:
|
/// Returns the constructor function for this color's space.
|
||||||
|
///
|
||||||
|
/// Returns one of:
|
||||||
/// - [`luma`]($color.luma)
|
/// - [`luma`]($color.luma)
|
||||||
/// - [`oklab`]($color.oklab)
|
/// - [`oklab`]($color.oklab)
|
||||||
/// - [`oklch`]($color.oklch)
|
/// - [`oklch`]($color.oklch)
|
||||||
|
@ -374,9 +374,11 @@ fn visit_show_rules<'a>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply a built-in show rule.
|
// Apply a built-in show rule.
|
||||||
ShowStep::Builtin(rule) => rule
|
ShowStep::Builtin(rule) => {
|
||||||
.apply(&output, s.engine, chained)
|
let _scope = typst_timing::TimingScope::new(output.elem().name());
|
||||||
.map(|content| content.spanned(output.span())),
|
rule.apply(&output, s.engine, chained)
|
||||||
|
.map(|content| content.spanned(output.span()))
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Errors in show rules don't terminate compilation immediately. We just
|
// Errors in show rules don't terminate compilation immediately. We just
|
||||||
|
@ -242,7 +242,7 @@ fn category_page(resolver: &dyn Resolver, category: Category) -> PageModel {
|
|||||||
items.push(CategoryItem {
|
items.push(CategoryItem {
|
||||||
name: group.name.clone(),
|
name: group.name.clone(),
|
||||||
route: subpage.route.clone(),
|
route: subpage.route.clone(),
|
||||||
oneliner: oneliner(docs).into(),
|
oneliner: oneliner(docs),
|
||||||
code: true,
|
code: true,
|
||||||
});
|
});
|
||||||
children.push(subpage);
|
children.push(subpage);
|
||||||
@ -296,7 +296,7 @@ fn category_page(resolver: &dyn Resolver, category: Category) -> PageModel {
|
|||||||
items.push(CategoryItem {
|
items.push(CategoryItem {
|
||||||
name: name.into(),
|
name: name.into(),
|
||||||
route: subpage.route.clone(),
|
route: subpage.route.clone(),
|
||||||
oneliner: oneliner(func.docs().unwrap_or_default()).into(),
|
oneliner: oneliner(func.docs().unwrap_or_default()),
|
||||||
code: true,
|
code: true,
|
||||||
});
|
});
|
||||||
children.push(subpage);
|
children.push(subpage);
|
||||||
@ -306,7 +306,7 @@ fn category_page(resolver: &dyn Resolver, category: Category) -> PageModel {
|
|||||||
items.push(CategoryItem {
|
items.push(CategoryItem {
|
||||||
name: ty.short_name().into(),
|
name: ty.short_name().into(),
|
||||||
route: subpage.route.clone(),
|
route: subpage.route.clone(),
|
||||||
oneliner: oneliner(ty.docs()).into(),
|
oneliner: oneliner(ty.docs()),
|
||||||
code: true,
|
code: true,
|
||||||
});
|
});
|
||||||
children.push(subpage);
|
children.push(subpage);
|
||||||
@ -637,7 +637,7 @@ fn group_page(
|
|||||||
let item = CategoryItem {
|
let item = CategoryItem {
|
||||||
name: group.name.clone(),
|
name: group.name.clone(),
|
||||||
route: model.route.clone(),
|
route: model.route.clone(),
|
||||||
oneliner: oneliner(&group.details).into(),
|
oneliner: oneliner(&group.details),
|
||||||
code: false,
|
code: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -772,8 +772,24 @@ pub fn urlify(title: &str) -> EcoString {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Extract the first line of documentation.
|
/// Extract the first line of documentation.
|
||||||
fn oneliner(docs: &str) -> &str {
|
fn oneliner(docs: &str) -> EcoString {
|
||||||
docs.lines().next().unwrap_or_default()
|
let paragraph = docs.split("\n\n").next().unwrap_or_default();
|
||||||
|
let mut depth = 0;
|
||||||
|
let mut period = false;
|
||||||
|
let mut end = paragraph.len();
|
||||||
|
for (i, c) in paragraph.char_indices() {
|
||||||
|
match c {
|
||||||
|
'(' | '[' | '{' => depth += 1,
|
||||||
|
')' | ']' | '}' => depth -= 1,
|
||||||
|
'.' if depth == 0 => period = true,
|
||||||
|
c if period && c.is_whitespace() && !docs[..i].ends_with("e.g.") => {
|
||||||
|
end = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_ => period = false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EcoString::from(&docs[..end]).replace("\r\n", " ").replace("\n", " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The order of types in the documentation.
|
/// The order of types in the documentation.
|
||||||
|
@ -86,7 +86,7 @@ pub struct FuncModel {
|
|||||||
pub name: EcoString,
|
pub name: EcoString,
|
||||||
pub title: &'static str,
|
pub title: &'static str,
|
||||||
pub keywords: &'static [&'static str],
|
pub keywords: &'static [&'static str],
|
||||||
pub oneliner: &'static str,
|
pub oneliner: EcoString,
|
||||||
pub element: bool,
|
pub element: bool,
|
||||||
pub contextual: bool,
|
pub contextual: bool,
|
||||||
pub deprecation: Option<&'static str>,
|
pub deprecation: Option<&'static str>,
|
||||||
@ -139,7 +139,7 @@ pub struct TypeModel {
|
|||||||
pub name: &'static str,
|
pub name: &'static str,
|
||||||
pub title: &'static str,
|
pub title: &'static str,
|
||||||
pub keywords: &'static [&'static str],
|
pub keywords: &'static [&'static str],
|
||||||
pub oneliner: &'static str,
|
pub oneliner: EcoString,
|
||||||
pub details: Html,
|
pub details: Html,
|
||||||
pub constructor: Option<FuncModel>,
|
pub constructor: Option<FuncModel>,
|
||||||
pub scope: Vec<FuncModel>,
|
pub scope: Vec<FuncModel>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user