mirror of
https://github.com/typst/typst
synced 2025-08-23 19:24:14 +08:00
Compare commits
6 Commits
c7f55e8718
...
c38227e8e1
Author | SHA1 | Date | |
---|---|---|---|
|
c38227e8e1 | ||
|
36ecbb2c8d | ||
|
51ab5b815c | ||
|
d1deb80bb8 | ||
|
88e451b3dc | ||
|
cc3a68ecb1 |
@ -199,7 +199,7 @@ impl PackageStorage {
|
|||||||
// The place at which the specific package version will live in the end.
|
// The place at which the specific package version will live in the end.
|
||||||
let package_dir = base_dir.join(format!("{}", spec.version));
|
let package_dir = base_dir.join(format!("{}", spec.version));
|
||||||
|
|
||||||
// To prevent multiple Typst instances from interferring, we download
|
// To prevent multiple Typst instances from interfering, we download
|
||||||
// into a temporary directory first and then move this directory to
|
// into a temporary directory first and then move this directory to
|
||||||
// its final destination.
|
// its final destination.
|
||||||
//
|
//
|
||||||
|
@ -94,7 +94,7 @@ impl Array {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Iterate over references to the contained values.
|
/// Iterate over references to the contained values.
|
||||||
pub fn iter(&self) -> std::slice::Iter<Value> {
|
pub fn iter(&self) -> std::slice::Iter<'_, Value> {
|
||||||
self.0.iter()
|
self.0.iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ impl Dict {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Iterate over pairs of references to the contained keys and values.
|
/// Iterate over pairs of references to the contained keys and values.
|
||||||
pub fn iter(&self) -> indexmap::map::Iter<Str, Value> {
|
pub fn iter(&self) -> indexmap::map::Iter<'_, Str, Value> {
|
||||||
self.0.iter()
|
self.0.iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ use crate::foundations::{
|
|||||||
///
|
///
|
||||||
/// You can call a function by writing a comma-separated list of function
|
/// You can call a function by writing a comma-separated list of function
|
||||||
/// _arguments_ enclosed in parentheses directly after the function name.
|
/// _arguments_ enclosed in parentheses directly after the function name.
|
||||||
/// Additionally, you can pass any number of trailing content blocks arguments
|
/// Additionally, you can pass any number of trailing content block arguments
|
||||||
/// to a function _after_ the normal argument list. If the normal argument list
|
/// to a function _after_ the normal argument list. If the normal argument list
|
||||||
/// would become empty, it can be omitted. Typst supports positional and named
|
/// would become empty, it can be omitted. Typst supports positional and named
|
||||||
/// arguments. The former are identified by position and type, while the latter
|
/// arguments. The former are identified by position and type, while the latter
|
||||||
|
@ -497,7 +497,8 @@ mod callbacks {
|
|||||||
|
|
||||||
macro_rules! callback {
|
macro_rules! callback {
|
||||||
($name:ident = ($($param:ident: $param_ty:ty),* $(,)?) -> $ret:ty) => {
|
($name:ident = ($($param:ident: $param_ty:ty),* $(,)?) -> $ret:ty) => {
|
||||||
#[derive(Debug, Clone, PartialEq, Hash)]
|
#[derive(Debug, Clone, Hash)]
|
||||||
|
#[allow(clippy::derived_hash_with_manual_eq)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
captured: Content,
|
captured: Content,
|
||||||
f: fn(&Content, $($param_ty),*) -> $ret,
|
f: fn(&Content, $($param_ty),*) -> $ret,
|
||||||
@ -535,6 +536,19 @@ mod callbacks {
|
|||||||
(self.f)(&self.captured, $($param),*)
|
(self.f)(&self.captured, $($param),*)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PartialEq for $name {
|
||||||
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
// Comparing function pointers is problematic. Since for
|
||||||
|
// each type of content, there is typically just one
|
||||||
|
// callback, we skip it. It barely matters anyway since
|
||||||
|
// getting into a comparison codepath for inline & block
|
||||||
|
// elements containing callback bodies is close to
|
||||||
|
// impossible (as these are generally generated in show
|
||||||
|
// rules).
|
||||||
|
self.captured.eq(&other.captured)
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,12 +47,12 @@ impl Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Iterate over the contained frames.
|
/// Iterate over the contained frames.
|
||||||
pub fn iter(&self) -> std::slice::Iter<Frame> {
|
pub fn iter(&self) -> std::slice::Iter<'_, Frame> {
|
||||||
self.0.iter()
|
self.0.iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Iterate over the contained frames.
|
/// Iterate over the contained frames.
|
||||||
pub fn iter_mut(&mut self) -> std::slice::IterMut<Frame> {
|
pub fn iter_mut(&mut self) -> std::slice::IterMut<'_, Frame> {
|
||||||
self.0.iter_mut()
|
self.0.iter_mut()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -936,7 +936,7 @@ cast! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Resolve a prioritized iterator over the font families.
|
/// Resolve a prioritized iterator over the font families.
|
||||||
pub fn families(styles: StyleChain) -> impl Iterator<Item = &FontFamily> + Clone {
|
pub fn families(styles: StyleChain<'_>) -> impl Iterator<Item = &'_ FontFamily> + Clone {
|
||||||
let fallbacks = singleton!(Vec<FontFamily>, {
|
let fallbacks = singleton!(Vec<FontFamily>, {
|
||||||
[
|
[
|
||||||
"libertinus serif",
|
"libertinus serif",
|
||||||
|
@ -22,8 +22,6 @@ pub(crate) fn build_metadata(gc: &GlobalContext) -> Metadata {
|
|||||||
.keywords(gc.document.info.keywords.iter().map(EcoString::to_string).collect())
|
.keywords(gc.document.info.keywords.iter().map(EcoString::to_string).collect())
|
||||||
.authors(gc.document.info.author.iter().map(EcoString::to_string).collect());
|
.authors(gc.document.info.author.iter().map(EcoString::to_string).collect());
|
||||||
|
|
||||||
let lang = gc.languages.iter().max_by_key(|(_, &count)| count).map(|(&l, _)| l);
|
|
||||||
|
|
||||||
if let Some(lang) = lang {
|
if let Some(lang) = lang {
|
||||||
metadata = metadata.language(lang.as_str().to_string());
|
metadata = metadata.language(lang.as_str().to_string());
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@
|
|||||||
single or double quotes.
|
single or double quotes.
|
||||||
|
|
||||||
The value is always of type [string]($str). More complex data
|
The value is always of type [string]($str). More complex data
|
||||||
may be parsed manually using functions like [`json.decode`]($json.decode).
|
may be parsed manually using functions like [`json`]($json).
|
||||||
|
|
||||||
- name: sym
|
- name: sym
|
||||||
title: General
|
title: General
|
||||||
|
Loading…
x
Reference in New Issue
Block a user