Skip to content

Commit 5c056b7

Browse files
authored
Merge upstream v0.13.1 (#111)
2 parents 40ee2c1 + b64a8be commit 5c056b7

File tree

38 files changed

+11482
-10144
lines changed

38 files changed

+11482
-10144
lines changed

Cargo.lock

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ default-members = ["crates/typst-cli"]
44
resolver = "2"
55

66
[workspace.package]
7-
version = "0.13.0"
7+
version = "0.13.1"
88
rust-version = "1.80" # also change in ci.yml
99
authors = ["The Typst Project Developers"]
1010
edition = "2021"
@@ -16,24 +16,24 @@ keywords = ["typst"]
1616
readme = "README.md"
1717

1818
[workspace.dependencies]
19-
typst = { path = "crates/typst", version = "0.13.0" }
20-
typst-cli = { path = "crates/typst-cli", version = "0.13.0" }
21-
typst-eval = { path = "crates/typst-eval", version = "0.13.0" }
22-
typst-html = { path = "crates/typst-html", version = "0.13.0" }
23-
typst-ide = { path = "crates/typst-ide", version = "0.13.0" }
24-
typst-kit = { path = "crates/typst-kit", version = "0.13.0" }
25-
typst-layout = { path = "crates/typst-layout", version = "0.13.0" }
26-
typst-library = { path = "crates/typst-library", version = "0.13.0" }
27-
typst-macros = { path = "crates/typst-macros", version = "0.13.0" }
28-
typst-pdf = { path = "crates/typst-pdf", version = "0.13.0" }
29-
typst-realize = { path = "crates/typst-realize", version = "0.13.0" }
30-
typst-render = { path = "crates/typst-render", version = "0.13.0" }
31-
typst-svg = { path = "crates/typst-svg", version = "0.13.0" }
32-
typst-syntax = { path = "crates/typst-syntax", version = "0.13.0" }
33-
typst-timing = { path = "crates/typst-timing", version = "0.13.0" }
34-
typst-utils = { path = "crates/typst-utils", version = "0.13.0" }
35-
typst-assets = "0.13.0"
36-
typst-dev-assets = { git = "https://github.com/typst/typst-dev-assets", tag = "v0.13.0" }
19+
typst = { path = "crates/typst", version = "0.13.1" }
20+
typst-cli = { path = "crates/typst-cli", version = "0.13.1" }
21+
typst-eval = { path = "crates/typst-eval", version = "0.13.1" }
22+
typst-html = { path = "crates/typst-html", version = "0.13.1" }
23+
typst-ide = { path = "crates/typst-ide", version = "0.13.1" }
24+
typst-kit = { path = "crates/typst-kit", version = "0.13.1" }
25+
typst-layout = { path = "crates/typst-layout", version = "0.13.1" }
26+
typst-library = { path = "crates/typst-library", version = "0.13.1" }
27+
typst-macros = { path = "crates/typst-macros", version = "0.13.1" }
28+
typst-pdf = { path = "crates/typst-pdf", version = "0.13.1" }
29+
typst-realize = { path = "crates/typst-realize", version = "0.13.1" }
30+
typst-render = { path = "crates/typst-render", version = "0.13.1" }
31+
typst-svg = { path = "crates/typst-svg", version = "0.13.1" }
32+
typst-syntax = { path = "crates/typst-syntax", version = "0.13.1" }
33+
typst-timing = { path = "crates/typst-timing", version = "0.13.1" }
34+
typst-utils = { path = "crates/typst-utils", version = "0.13.1" }
35+
typst-assets = "0.13.1"
36+
typst-dev-assets = { git = "https://github.com/typst/typst-dev-assets", tag = "v0.13.1" }
3737
arrayvec = "0.7.4"
3838
az = "1.2"
3939
base64 = "0.22"

README.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
This is an unofficial Japanese translation of the documentation for the typesetting system [Typst](https://typst.app/docs). It has been created with the permission of [Typst GmbH](https://typst.app/legal/).
77

8-
The repository was forked from the [Chinese version](https://github.com/typst-doc-cn/typst-doc-cn.github.io) and is translated into Japanese based on the official documentation of [Typst v0.12.0](https://typst.app/docs/changelog/#v0.12.0) as of October 2024.
8+
The repository was forked from the [Chinese version](https://github.com/typst-doc-cn/typst-doc-cn.github.io) and is translated into Japanese based on the official documentation of [Typst v0.13.1](https://typst.app/docs/changelog/#v0.13.1) as of October 2024.
99

1010
The actual working web version can be viewed at the following URL.
1111
> https://typst-jp.github.io/docs/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
組版システム [Typst](https://typst.app/docs) の非公式な日本語ドキュメントです。[Typst GmbH](https://typst.app/legal/) の許諾を得て作成されています。
1010

11-
このリポジトリは[中国語版](https://github.com/typst-doc-cn/typst-doc-cn.github.io)からフォークして作成され、2024年10月時点での最新版である [Typst v0.12.0](https://typst.app/docs/changelog/#v0.12.0) の公式ドキュメントを元に日本語訳を行います。
11+
このリポジトリは[中国語版](https://github.com/typst-doc-cn/typst-doc-cn.github.io)からフォークして作成され、2024年10月時点での最新版である [Typst v0.13.1](https://typst.app/docs/changelog/#v0.13.1) の公式ドキュメントを元に日本語訳を行います。
1212

1313
実際に作動している Web 版は、以下の URL から閲覧できます。
1414
> https://typst-jp.github.io/docs/

crates/typst-cli/src/watch.rs

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ impl Watcher {
204204
let event = event
205205
.map_err(|err| eco_format!("failed to watch dependencies ({err})"))?;
206206

207+
if !is_relevant_event_kind(&event.kind) {
208+
continue;
209+
}
210+
207211
// Workaround for notify-rs' implicit unwatch on remove/rename
208212
// (triggered by some editors when saving files) with the
209213
// inotify backend. By keeping track of the potentially
@@ -224,7 +228,17 @@ impl Watcher {
224228
}
225229
}
226230

227-
relevant |= self.is_event_relevant(&event);
231+
// Don't recompile because the output file changed.
232+
// FIXME: This doesn't work properly for multifile image export.
233+
if event
234+
.paths
235+
.iter()
236+
.all(|path| is_same_file(path, &self.output).unwrap_or(false))
237+
{
238+
continue;
239+
}
240+
241+
relevant = true;
228242
}
229243

230244
// If we found a relevant event or if any of the missing files now
@@ -234,32 +248,23 @@ impl Watcher {
234248
}
235249
}
236250
}
251+
}
237252

238-
/// Whether a watch event is relevant for compilation.
239-
fn is_event_relevant(&self, event: &notify::Event) -> bool {
240-
// Never recompile because the output file changed.
241-
if event
242-
.paths
243-
.iter()
244-
.all(|path| is_same_file(path, &self.output).unwrap_or(false))
245-
{
246-
return false;
247-
}
248-
249-
match &event.kind {
250-
notify::EventKind::Any => true,
251-
notify::EventKind::Access(_) => false,
252-
notify::EventKind::Create(_) => true,
253-
notify::EventKind::Modify(kind) => match kind {
254-
notify::event::ModifyKind::Any => true,
255-
notify::event::ModifyKind::Data(_) => true,
256-
notify::event::ModifyKind::Metadata(_) => false,
257-
notify::event::ModifyKind::Name(_) => true,
258-
notify::event::ModifyKind::Other => false,
259-
},
260-
notify::EventKind::Remove(_) => true,
261-
notify::EventKind::Other => false,
262-
}
253+
/// Whether a kind of watch event is relevant for compilation.
254+
fn is_relevant_event_kind(kind: &notify::EventKind) -> bool {
255+
match kind {
256+
notify::EventKind::Any => true,
257+
notify::EventKind::Access(_) => false,
258+
notify::EventKind::Create(_) => true,
259+
notify::EventKind::Modify(kind) => match kind {
260+
notify::event::ModifyKind::Any => true,
261+
notify::event::ModifyKind::Data(_) => true,
262+
notify::event::ModifyKind::Metadata(_) => false,
263+
notify::event::ModifyKind::Name(_) => true,
264+
notify::event::ModifyKind::Other => false,
265+
},
266+
notify::EventKind::Remove(_) => true,
267+
notify::EventKind::Other => false,
263268
}
264269
}
265270

crates/typst-html/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ fn html_document_impl(
8383
)?;
8484

8585
let output = handle_list(&mut engine, &mut locator, children.iter().copied())?;
86+
let introspector = Introspector::html(&output);
8687
let root = root_element(output, &info)?;
87-
let introspector = Introspector::html(&root);
8888

8989
Ok(HtmlDocument { info, root, introspector })
9090
}
@@ -307,18 +307,18 @@ fn head_element(info: &DocumentInfo) -> HtmlElement {
307307

308308
/// Determine which kind of output the user generated.
309309
fn classify_output(mut output: Vec<HtmlNode>) -> SourceResult<OutputKind> {
310-
let len = output.len();
310+
let count = output.iter().filter(|node| !matches!(node, HtmlNode::Tag(_))).count();
311311
for node in &mut output {
312312
let HtmlNode::Element(elem) = node else { continue };
313313
let tag = elem.tag;
314314
let mut take = || std::mem::replace(elem, HtmlElement::new(tag::html));
315-
match (tag, len) {
315+
match (tag, count) {
316316
(tag::html, 1) => return Ok(OutputKind::Html(take())),
317317
(tag::body, 1) => return Ok(OutputKind::Body(take())),
318318
(tag::html | tag::body, _) => bail!(
319319
elem.span,
320320
"`{}` element must be the only element in the document",
321-
elem.tag
321+
elem.tag,
322322
),
323323
_ => {}
324324
}

crates/typst-layout/src/shapes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ impl<'a> CurveBuilder<'a> {
284284
self.last_point = point;
285285
self.last_control_from = point;
286286
self.is_started = true;
287+
self.is_empty = true;
287288
}
288289

289290
/// Add a line segment.

crates/typst-library/src/foundations/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ impl Array {
769769
///
770770
/// ```example
771771
/// #let array = (1, 2, 3, 4, 5, 6, 7, 8)
772-
/// #array.chunks(3)
772+
/// #array.chunks(3) \
773773
/// #array.chunks(3, exact: true)
774774
/// ```
775775
#[func]

crates/typst-library/src/foundations/func.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,10 @@ impl PartialEq for Func {
437437
}
438438
}
439439

440-
impl PartialEq<&NativeFuncData> for Func {
441-
fn eq(&self, other: &&NativeFuncData) -> bool {
440+
impl PartialEq<&'static NativeFuncData> for Func {
441+
fn eq(&self, other: &&'static NativeFuncData) -> bool {
442442
match &self.repr {
443-
Repr::Native(native) => native.function == other.function,
443+
Repr::Native(native) => *native == Static(*other),
444444
_ => false,
445445
}
446446
}

0 commit comments

Comments
 (0)