From b1b4e52af9e2da8f8ae1fc17a81ed6cbcbb8f525 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 13 Feb 2023 15:14:25 +0100 Subject: Block sizing --- docs/src/html.rs | 10 +++++----- docs/src/lib.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/src/html.rs b/docs/src/html.rs index 550e6ff8..9fbb4fd8 100644 --- a/docs/src/html.rs +++ b/docs/src/html.rs @@ -287,17 +287,17 @@ fn code_block(resolver: &dyn Resolver, lang: &str, text: &str) -> Html { let source = Source::new(SourceId::from_u16(0), Path::new("main.typ"), compile); let world = DocWorld(source); - let mut frame = match typst::compile(&world, &world.0) { - Ok(doc) => doc.pages.into_iter().next().unwrap(), + let mut frames = match typst::compile(&world, &world.0) { + Ok(doc) => doc.pages, Err(err) => panic!("failed to compile {text}: {err:?}"), }; if let Some([x, y, w, h]) = zoom { - frame.translate(Point::new(-x, -y)); - *frame.size_mut() = Size::new(w, h); + frames[0].translate(Point::new(-x, -y)); + *frames[0].size_mut() = Size::new(w, h); } - resolver.example(highlighted, frame) + resolver.example(highlighted, &frames) } /// World for example compilations. diff --git a/docs/src/lib.rs b/docs/src/lib.rs index 620aaaaa..c9e7af25 100644 --- a/docs/src/lib.rs +++ b/docs/src/lib.rs @@ -67,7 +67,7 @@ pub trait Resolver { fn image(&self, filename: &str, data: &[u8]) -> String; /// Produce HTML for an example. - fn example(&self, source: Html, frame: Frame) -> Html; + fn example(&self, source: Html, frames: &[Frame]) -> Html; } /// Details about a documentation page and its children. -- cgit v1.2.3