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