summaryrefslogtreecommitdiff
path: root/crates/typst-docs/src/html.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-01-17 21:50:35 +0100
committerLaurenz <laurmaedje@gmail.com>2024-01-17 21:53:20 +0100
commit6ac71eeaf7b68dab07f75bd1a480810481fa9b73 (patch)
treed452e7323200fe56d61a34b91c8b98826d60978c /crates/typst-docs/src/html.rs
parent50741209a8f4c5e91d35281eb44b7425b3d022b2 (diff)
Add `Page` struct
To get rid of the Meta hack where numbering and things like that are stored in the frame.
Diffstat (limited to 'crates/typst-docs/src/html.rs')
-rw-r--r--crates/typst-docs/src/html.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/typst-docs/src/html.rs b/crates/typst-docs/src/html.rs
index 7481b050..8f6d1366 100644
--- a/crates/typst-docs/src/html.rs
+++ b/crates/typst-docs/src/html.rs
@@ -388,8 +388,8 @@ fn code_block(resolver: &dyn Resolver, lang: &str, text: &str) -> Html {
let world = DocWorld(source);
let mut tracer = Tracer::new();
- let mut frames = match typst::compile(&world, &mut tracer) {
- Ok(doc) => doc.pages,
+ let mut document = match typst::compile(&world, &mut tracer) {
+ Ok(doc) => doc,
Err(err) => {
let msg = &err[0].message;
panic!("while trying to compile:\n{text}:\n\nerror: {msg}");
@@ -397,16 +397,16 @@ fn code_block(resolver: &dyn Resolver, lang: &str, text: &str) -> Html {
};
if let Some([x, y, w, h]) = zoom {
- frames[0].translate(Point::new(-x, -y));
- *frames[0].size_mut() = Size::new(w, h);
+ document.pages[0].frame.translate(Point::new(-x, -y));
+ *document.pages[0].frame.size_mut() = Size::new(w, h);
}
if single {
- frames.truncate(1);
+ document.pages.truncate(1);
}
let hash = typst::util::hash128(text);
- resolver.example(hash, highlighted, &frames)
+ resolver.example(hash, highlighted, &document)
}
/// Extract an attribute value from an HTML element.