mirror of
https://github.com/typst/typst
synced 2025-08-21 10:18:35 +08:00
Compare commits
7 Commits
3e7a39e968
...
664d33a681
Author | SHA1 | Date | |
---|---|---|---|
|
664d33a681 | ||
|
e023db5f1d | ||
|
6164ade9ce | ||
|
fd08c4bb3f | ||
|
4329a15a1c | ||
|
83e249dd33 | ||
|
61dee554ba |
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -40,7 +40,7 @@ jobs:
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt update
|
||||
sudo apt install -y gcc-multilib libssl-dev:i386 pkg-config:i386
|
||||
- uses: dtolnay/rust-toolchain@1.85.0
|
||||
- uses: dtolnay/rust-toolchain@1.87.0
|
||||
with:
|
||||
targets: ${{ matrix.bits == 32 && 'i686-unknown-linux-gnu' || '' }}
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
@ -73,7 +73,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@1.85.0
|
||||
- uses: dtolnay/rust-toolchain@1.87.0
|
||||
with:
|
||||
components: clippy, rustfmt
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -44,7 +44,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@1.85.0
|
||||
- uses: dtolnay/rust-toolchain@1.87.0
|
||||
with:
|
||||
target: ${{ matrix.target }}
|
||||
|
||||
|
@ -25,15 +25,13 @@ impl Eval for ast::FuncCall<'_> {
|
||||
fn eval(self, vm: &mut Vm) -> SourceResult<Self::Output> {
|
||||
let span = self.span();
|
||||
let callee = self.callee();
|
||||
let in_math = in_math(callee);
|
||||
let callee_span = callee.span();
|
||||
let args = self.args();
|
||||
let trailing_comma = args.trailing_comma();
|
||||
|
||||
vm.engine.route.check_call_depth().at(span)?;
|
||||
|
||||
// Try to evaluate as a call to an associated function or field.
|
||||
let (callee, args) = if let ast::Expr::FieldAccess(access) = callee {
|
||||
let (callee_value, args_value) = if let ast::Expr::FieldAccess(access) = callee {
|
||||
let target = access.target();
|
||||
let field = access.field();
|
||||
match eval_field_call(target, field, args, span, vm)? {
|
||||
@ -50,9 +48,15 @@ impl Eval for ast::FuncCall<'_> {
|
||||
(callee.eval(vm)?, args.eval(vm)?.spanned(span))
|
||||
};
|
||||
|
||||
let func_result = callee.clone().cast::<Func>();
|
||||
if in_math && func_result.is_err() {
|
||||
return wrap_args_in_math(callee, callee_span, args, trailing_comma);
|
||||
let func_result = callee_value.clone().cast::<Func>();
|
||||
|
||||
if func_result.is_err() && in_math(callee) {
|
||||
return wrap_args_in_math(
|
||||
callee_value,
|
||||
callee_span,
|
||||
args_value,
|
||||
args.trailing_comma(),
|
||||
);
|
||||
}
|
||||
|
||||
let func = func_result
|
||||
@ -61,8 +65,11 @@ impl Eval for ast::FuncCall<'_> {
|
||||
|
||||
let point = || Tracepoint::Call(func.name().map(Into::into));
|
||||
let f = || {
|
||||
func.call(&mut vm.engine, vm.context, args)
|
||||
.trace(vm.world(), point, span)
|
||||
func.call(&mut vm.engine, vm.context, args_value).trace(
|
||||
vm.world(),
|
||||
point,
|
||||
span,
|
||||
)
|
||||
};
|
||||
|
||||
// Stacker is broken on WASM.
|
||||
|
@ -128,8 +128,7 @@ impl Downloader {
|
||||
}
|
||||
|
||||
// Configure native TLS.
|
||||
let connector =
|
||||
tls.build().map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;
|
||||
let connector = tls.build().map_err(io::Error::other)?;
|
||||
builder = builder.tls_connector(Arc::new(connector));
|
||||
|
||||
builder.build().get(url).call()
|
||||
|
@ -708,12 +708,13 @@ pub fn fract(
|
||||
}
|
||||
}
|
||||
|
||||
/// Rounds a number to the nearest integer away from zero.
|
||||
/// Rounds a number to the nearest integer.
|
||||
///
|
||||
/// Optionally, a number of decimal places can be specified.
|
||||
/// Half-integers are rounded away from zero.
|
||||
///
|
||||
/// If the number of digits is negative, its absolute value will indicate the
|
||||
/// amount of significant integer digits to remove before the decimal point.
|
||||
/// Optionally, a number of decimal places can be specified. If negative, its
|
||||
/// absolute value will indicate the amount of significant integer digits to
|
||||
/// remove before the decimal point.
|
||||
///
|
||||
/// Note that this function will return the same type as the operand. That is,
|
||||
/// applying `round` to a [`float`] will return a `float`, and to a [`decimal`],
|
||||
|
@ -41,7 +41,7 @@ use crate::layout::{BlockElem, Size};
|
||||
/// receives the page's dimensions minus its margins. This is mostly useful in
|
||||
/// combination with [measurement]($measure).
|
||||
///
|
||||
/// To retrieve the _remaining_ size of the page rather than its full size, you
|
||||
/// To retrieve the _remaining_ height of the page rather than its full size,
|
||||
/// you can wrap your `layout` call in a `{block(height: 1fr)}`. This works
|
||||
/// because the block automatically grows to fill the remaining space (see the
|
||||
/// [fraction] documentation for more details).
|
||||
|
@ -125,6 +125,9 @@ pub struct FigureElem {
|
||||
///
|
||||
/// ```example
|
||||
/// #set page(height: 200pt)
|
||||
/// #show figure: set place(
|
||||
/// clearance: 1em,
|
||||
/// )
|
||||
///
|
||||
/// = Introduction
|
||||
/// #figure(
|
||||
|
@ -261,9 +261,9 @@ pub enum NumberingKind {
|
||||
LowerRoman,
|
||||
/// Uppercase Roman numerals (I, II, III, etc.).
|
||||
UpperRoman,
|
||||
/// Lowercase Greek numerals (Α, Β, Γ, etc.).
|
||||
/// Lowercase Greek letters (α, β, γ, etc.).
|
||||
LowerGreek,
|
||||
/// Uppercase Greek numerals (α, β, γ, etc.).
|
||||
/// Uppercase Greek letters (Α, Β, Γ, etc.).
|
||||
UpperGreek,
|
||||
/// Paragraph/note-like symbols: *, †, ‡, §, ¶, and ‖. Further items use
|
||||
/// repeated symbols.
|
||||
|
@ -373,6 +373,7 @@ pub struct Decoration {
|
||||
|
||||
/// A kind of decorative line.
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DecoLine {
|
||||
Underline {
|
||||
stroke: Stroke<Abs>,
|
||||
|
@ -185,6 +185,7 @@ struct Cast {
|
||||
}
|
||||
|
||||
/// A pattern in a cast, e.g.`"ascender"` or `v: i64`.
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
enum Pattern {
|
||||
Str(syn::LitStr),
|
||||
Ty(syn::Pat, syn::Type),
|
||||
|
@ -27,7 +27,6 @@
|
||||
//! [module]: crate::foundations::Module
|
||||
//! [content]: crate::foundations::Content
|
||||
//! [laid out]: typst_layout::layout_document
|
||||
//! [document]: crate::model::Document
|
||||
//! [frame]: crate::layout::Frame
|
||||
|
||||
pub extern crate comemo;
|
||||
|
@ -12,6 +12,7 @@ Let's start with a broad overview of the directories in this repository:
|
||||
- `crates/typst-cli`: Typst's command line interface. This is a relatively small
|
||||
layer on top of the compiler and the exporters.
|
||||
- `crates/typst-eval`: The interpreter for the Typst language.
|
||||
- `crates/typst-html`: The HTML exporter.
|
||||
- `crates/typst-ide`: Exposes IDE functionality.
|
||||
- `crates/typst-kit`: Contains various default implementation of
|
||||
functionality used in `typst-cli`.
|
||||
|
6
flake.lock
generated
6
flake.lock
generated
@ -112,13 +112,13 @@
|
||||
"rust-manifest": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"narHash": "sha256-irgHsBXecwlFSdmP9MfGP06Cbpca2QALJdbN4cymcko=",
|
||||
"narHash": "sha256-BwfxWd/E8gpnXoKsucFXhMbevMlVgw3l0becLkIcWCU=",
|
||||
"type": "file",
|
||||
"url": "https://static.rust-lang.org/dist/channel-rust-1.85.0.toml"
|
||||
"url": "https://static.rust-lang.org/dist/channel-rust-1.87.0.toml"
|
||||
},
|
||||
"original": {
|
||||
"type": "file",
|
||||
"url": "https://static.rust-lang.org/dist/channel-rust-1.85.0.toml"
|
||||
"url": "https://static.rust-lang.org/dist/channel-rust-1.87.0.toml"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user