summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-12-02 13:37:33 +0100
committerLaurenz <laurmaedje@gmail.com>2024-12-04 10:12:07 +0100
commitf8f2ba6a5f8c8ca7dbb85cf17b73332a0c301c60 (patch)
treeb3bc754509fb3ab4c74493848fe96f116b7907ed /crates
parent76c24ee6e35715cd14bb892d7b6b8d775c680bf7 (diff)
Rename `Document` to `PagedDocument`
Diffstat (limited to 'crates')
-rw-r--r--crates/typst-cli/src/compile.rs9
-rw-r--r--crates/typst-cli/src/query.rs4
-rw-r--r--crates/typst-ide/src/analyze.rs7
-rw-r--r--crates/typst-ide/src/complete.rs13
-rw-r--r--crates/typst-ide/src/definition.rs4
-rw-r--r--crates/typst-ide/src/jump.rs8
-rw-r--r--crates/typst-ide/src/tooltip.rs7
-rw-r--r--crates/typst-layout/src/pages/mod.rs12
-rw-r--r--crates/typst-library/src/layout/page.rs25
-rw-r--r--crates/typst-library/src/model/document.rs24
-rw-r--r--crates/typst-library/src/routines.rs7
-rw-r--r--crates/typst-pdf/src/lib.rs17
-rw-r--r--crates/typst-render/src/lib.rs6
-rw-r--r--crates/typst-svg/src/lib.rs6
-rw-r--r--crates/typst/src/lib.rs8
15 files changed, 78 insertions, 79 deletions
diff --git a/crates/typst-cli/src/compile.rs b/crates/typst-cli/src/compile.rs
index 74d818a5..c6d37ffe 100644
--- a/crates/typst-cli/src/compile.rs
+++ b/crates/typst-cli/src/compile.rs
@@ -12,8 +12,7 @@ use typst::diag::{
bail, At, Severity, SourceDiagnostic, SourceResult, StrResult, Warned,
};
use typst::foundations::{Datetime, Smart};
-use typst::layout::{Frame, Page, PageRanges};
-use typst::model::Document;
+use typst::layout::{Frame, Page, PageRanges, PagedDocument};
use typst::syntax::{FileId, Source, Span};
use typst::WorldExt;
use typst_pdf::{PdfOptions, PdfStandards};
@@ -171,7 +170,7 @@ pub fn compile_once(
/// Export into the target format.
fn export(
world: &mut SystemWorld,
- document: &Document,
+ document: &PagedDocument,
command: &CompileCommand,
watching: bool,
) -> SourceResult<()> {
@@ -189,7 +188,7 @@ fn export(
}
/// Export to a PDF.
-fn export_pdf(document: &Document, command: &CompileCommand) -> SourceResult<()> {
+fn export_pdf(document: &PagedDocument, command: &CompileCommand) -> SourceResult<()> {
let options = PdfOptions {
ident: Smart::Auto,
timestamp: convert_datetime(
@@ -229,7 +228,7 @@ enum ImageExportFormat {
/// Export to one or multiple images.
fn export_image(
world: &mut SystemWorld,
- document: &Document,
+ document: &PagedDocument,
command: &CompileCommand,
watching: bool,
fmt: ImageExportFormat,
diff --git a/crates/typst-cli/src/query.rs b/crates/typst-cli/src/query.rs
index 90d99a5a..947a6485 100644
--- a/crates/typst-cli/src/query.rs
+++ b/crates/typst-cli/src/query.rs
@@ -3,7 +3,7 @@ use ecow::{eco_format, EcoString};
use serde::Serialize;
use typst::diag::{bail, HintedStrResult, StrResult, Warned};
use typst::foundations::{Content, IntoValue, LocatableSelector, Scope};
-use typst::model::Document;
+use typst::layout::PagedDocument;
use typst::syntax::Span;
use typst::World;
use typst_eval::{eval_string, EvalMode};
@@ -53,7 +53,7 @@ pub fn query(command: &QueryCommand) -> HintedStrResult<()> {
fn retrieve(
world: &dyn World,
command: &QueryCommand,
- document: &Document,
+ document: &PagedDocument,
) -> HintedStrResult<Vec<Content>> {
let selector = eval_string(
&typst::ROUTINES,
diff --git a/crates/typst-ide/src/analyze.rs b/crates/typst-ide/src/analyze.rs
index eaf7248b..0b41fb68 100644
--- a/crates/typst-ide/src/analyze.rs
+++ b/crates/typst-ide/src/analyze.rs
@@ -1,7 +1,8 @@
use comemo::Track;
use ecow::{eco_vec, EcoString, EcoVec};
use typst::foundations::{Label, Styles, Value};
-use typst::model::{BibliographyElem, Document};
+use typst::layout::PagedDocument;
+use typst::model::BibliographyElem;
use typst::syntax::{ast, LinkedNode, SyntaxKind};
use crate::IdeWorld;
@@ -65,7 +66,9 @@ pub fn analyze_import(world: &dyn IdeWorld, source: &LinkedNode) -> Option<Value
/// - All labels and descriptions for them, if available
/// - A split offset: All labels before this offset belong to nodes, all after
/// belong to a bibliography.
-pub fn analyze_labels(document: &Document) -> (Vec<(Label, Option<EcoString>)>, usize) {
+pub fn analyze_labels(
+ document: &PagedDocument,
+) -> (Vec<(Label, Option<EcoString>)>, usize) {
let mut output = vec![];
// Labels in the document.
diff --git a/crates/typst-ide/src/complete.rs b/crates/typst-ide/src/complete.rs
index 510db54c..5c2b500a 100644
--- a/crates/typst-ide/src/complete.rs
+++ b/crates/typst-ide/src/complete.rs
@@ -9,8 +9,7 @@ use typst::foundations::{
fields_on, repr, AutoValue, CastInfo, Func, Label, NoneValue, ParamInfo, Repr,
StyleChain, Styles, Type, Value,
};
-use typst::layout::{Alignment, Dir};
-use typst::model::Document;
+use typst::layout::{Alignment, Dir, PagedDocument};
use typst::syntax::ast::AstNode;
use typst::syntax::{
ast, is_id_continue, is_id_start, is_ident, FileId, LinkedNode, Side, Source,
@@ -38,7 +37,7 @@ use crate::{analyze_expr, analyze_import, analyze_labels, named_items, IdeWorld}
/// when the document is available.
pub fn autocomplete(
world: &dyn IdeWorld,
- document: Option<&Document>,
+ document: Option<&PagedDocument>,
source: &Source,
cursor: usize,
explicit: bool,
@@ -1063,7 +1062,7 @@ fn code_completions(ctx: &mut CompletionContext, hash: bool) {
/// Context for autocompletion.
struct CompletionContext<'a> {
world: &'a (dyn IdeWorld + 'a),
- document: Option<&'a Document>,
+ document: Option<&'a PagedDocument>,
text: &'a str,
before: &'a str,
after: &'a str,
@@ -1079,7 +1078,7 @@ impl<'a> CompletionContext<'a> {
/// Create a new autocompletion context.
fn new(
world: &'a (dyn IdeWorld + 'a),
- document: Option<&'a Document>,
+ document: Option<&'a PagedDocument>,
source: &'a Source,
leaf: &'a LinkedNode<'a>,
cursor: usize,
@@ -1507,7 +1506,7 @@ impl BracketMode {
mod tests {
use std::collections::BTreeSet;
- use typst::model::Document;
+ use typst::layout::PagedDocument;
use typst::syntax::{FileId, Source, VirtualPath};
use typst::World;
@@ -1607,7 +1606,7 @@ mod tests {
fn test_full(
world: &TestWorld,
source: &Source,
- doc: Option<&Document>,
+ doc: Option<&PagedDocument>,
cursor: isize,
) -> Response {
autocomplete(world, doc, source, source.cursor(cursor), true)
diff --git a/crates/typst-ide/src/definition.rs b/crates/typst-ide/src/definition.rs
index 9303aee4..c789430a 100644
--- a/crates/typst-ide/src/definition.rs
+++ b/crates/typst-ide/src/definition.rs
@@ -1,5 +1,5 @@
use typst::foundations::{Label, Selector, Value};
-use typst::model::Document;
+use typst::layout::PagedDocument;
use typst::syntax::{ast, LinkedNode, Side, Source, Span};
use typst::utils::PicoStr;
@@ -25,7 +25,7 @@ pub enum Definition {
/// when the document is available.
pub fn definition(
world: &dyn IdeWorld,
- document: Option<&Document>,
+ document: Option<&PagedDocument>,
source: &Source,
cursor: usize,
side: Side,
diff --git a/crates/typst-ide/src/jump.rs b/crates/typst-ide/src/jump.rs
index 2dd5cf61..ba62b0ab 100644
--- a/crates/typst-ide/src/jump.rs
+++ b/crates/typst-ide/src/jump.rs
@@ -1,7 +1,7 @@
use std::num::NonZeroUsize;
-use typst::layout::{Frame, FrameItem, Point, Position, Size};
-use typst::model::{Destination, Document, Url};
+use typst::layout::{Frame, FrameItem, PagedDocument, Point, Position, Size};
+use typst::model::{Destination, Url};
use typst::syntax::{FileId, LinkedNode, Side, Source, Span, SyntaxKind};
use typst::visualize::Geometry;
use typst::WorldExt;
@@ -30,7 +30,7 @@ impl Jump {
/// Determine where to jump to based on a click in a frame.
pub fn jump_from_click(
world: &dyn IdeWorld,
- document: &Document,
+ document: &PagedDocument,
frame: &Frame,
click: Point,
) -> Option<Jump> {
@@ -110,7 +110,7 @@ pub fn jump_from_click(
/// Find the output location in the document for a cursor position.
pub fn jump_from_cursor(
- document: &Document,
+ document: &PagedDocument,
source: &Source,
cursor: usize,
) -> Vec<Position> {
diff --git a/crates/typst-ide/src/tooltip.rs b/crates/typst-ide/src/tooltip.rs
index 30aca24f..adfbeda5 100644
--- a/crates/typst-ide/src/tooltip.rs
+++ b/crates/typst-ide/src/tooltip.rs
@@ -4,8 +4,7 @@ use ecow::{eco_format, EcoString};
use if_chain::if_chain;
use typst::engine::Sink;
use typst::foundations::{repr, Capturer, CastInfo, Repr, Value};
-use typst::layout::Length;
-use typst::model::Document;
+use typst::layout::{Length, PagedDocument};
use typst::syntax::ast::AstNode;
use typst::syntax::{ast, LinkedNode, Side, Source, SyntaxKind};
use typst::utils::{round_with_precision, Numeric};
@@ -21,7 +20,7 @@ use crate::{analyze_expr, analyze_import, analyze_labels, IdeWorld};
/// document is available.
pub fn tooltip(
world: &dyn IdeWorld,
- document: Option<&Document>,
+ document: Option<&PagedDocument>,
source: &Source,
cursor: usize,
side: Side,
@@ -173,7 +172,7 @@ fn length_tooltip(length: Length) -> Option<Tooltip> {
}
/// Tooltip for a hovered reference or label.
-fn label_tooltip(document: &Document, leaf: &LinkedNode) -> Option<Tooltip> {
+fn label_tooltip(document: &PagedDocument, leaf: &LinkedNode) -> Option<Tooltip> {
let target = match leaf.kind() {
SyntaxKind::RefMarker => leaf.text().trim_start_matches('@'),
SyntaxKind::Label => leaf.text().trim_start_matches('<').trim_end_matches('>'),
diff --git a/crates/typst-layout/src/pages/mod.rs b/crates/typst-layout/src/pages/mod.rs
index b969749a..667e16b3 100644
--- a/crates/typst-layout/src/pages/mod.rs
+++ b/crates/typst-layout/src/pages/mod.rs
@@ -11,8 +11,8 @@ use typst_library::foundations::{Content, StyleChain};
use typst_library::introspection::{
Introspector, Locator, ManualPageCounter, SplitLocator, TagElem,
};
-use typst_library::layout::{FrameItem, Page, Point};
-use typst_library::model::{Document, DocumentInfo};
+use typst_library::layout::{FrameItem, Page, PagedDocument, Point};
+use typst_library::model::DocumentInfo;
use typst_library::routines::{Arenas, Pair, RealizationKind, Routines};
use typst_library::World;
@@ -26,12 +26,12 @@ use self::run::{layout_blank_page, layout_page_run, LayoutedPage};
/// elements. In contrast to [`layout_fragment`](crate::layout_fragment),
/// this does not take regions since the regions are defined by the page
/// configuration in the content and style chain.
-#[typst_macros::time(name = "document")]
+#[typst_macros::time(name = "layout document")]
pub fn layout_document(
engine: &mut Engine,
content: &Content,
styles: StyleChain,
-) -> SourceResult<Document> {
+) -> SourceResult<PagedDocument> {
layout_document_impl(
engine.routines,
engine.world,
@@ -56,7 +56,7 @@ fn layout_document_impl(
route: Tracked<Route>,
content: &Content,
styles: StyleChain,
-) -> SourceResult<Document> {
+) -> SourceResult<PagedDocument> {
let mut locator = Locator::root().split();
let mut engine = Engine {
routines,
@@ -86,7 +86,7 @@ fn layout_document_impl(
let pages = layout_pages(&mut engine, &mut children, locator, styles)?;
let introspector = Introspector::new(&pages);
- Ok(Document { pages, info, introspector })
+ Ok(PagedDocument { pages, info, introspector })
}
/// Layouts the document's pages.
diff --git a/crates/typst-library/src/layout/page.rs b/crates/typst-library/src/layout/page.rs
index 09aafa7f..68fd8974 100644
--- a/crates/typst-library/src/layout/page.rs
+++ b/crates/typst-library/src/layout/page.rs
@@ -12,11 +12,12 @@ use crate::foundations::{
cast, elem, Args, AutoValue, Cast, Construct, Content, Context, Dict, Fold, Func,
NativeElement, Set, Smart, StyleChain, Value,
};
+use crate::introspection::Introspector;
use crate::layout::{
Abs, Alignment, FlushElem, Frame, HAlignment, Length, OuterVAlignment, Ratio, Rel,
Sides, SpecificAlignment,
};
-use crate::model::Numbering;
+use crate::model::{DocumentInfo, Numbering};
use crate::text::LocalName;
use crate::visualize::{Color, Paint};
@@ -451,6 +452,17 @@ impl PagebreakElem {
}
}
+/// A finished document with metadata and page frames.
+#[derive(Debug, Default, Clone)]
+pub struct PagedDocument {
+ /// The document's finished pages.
+ pub pages: Vec<Page>,
+ /// Details about the document.
+ pub info: DocumentInfo,
+ /// Provides the ability to execute queries on the document.
+ pub introspector: Introspector,
+}
+
/// A finished page.
#[derive(Debug, Clone)]
pub struct Page {
@@ -942,3 +954,14 @@ papers! {
(PRESENTATION_16_9: 297.0, 167.0625, "presentation-16-9")
(PRESENTATION_4_3: 280.0, 210.0, "presentation-4-3")
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_paged_document_is_send_and_sync() {
+ fn ensure_send_and_sync<T: Send + Sync>() {}
+ ensure_send_and_sync::<PagedDocument>();
+ }
+}
diff --git a/crates/typst-library/src/model/document.rs b/crates/typst-library/src/model/document.rs
index b693d785..c333dff3 100644
--- a/crates/typst-library/src/model/document.rs
+++ b/crates/typst-library/src/model/document.rs
@@ -6,8 +6,6 @@ use crate::foundations::{
cast, elem, Args, Array, Construct, Content, Datetime, Fields, Smart, StyleChain,
Styles, Value,
};
-use crate::introspection::Introspector;
-use crate::layout::Page;
/// The root element of a document and its metadata.
///
@@ -86,17 +84,6 @@ cast! {
v: Array => Self(v.into_iter().map(Value::cast).collect::<HintedStrResult<_>>()?),
}
-/// A finished document with metadata and page frames.
-#[derive(Debug, Default, Clone)]
-pub struct Document {
- /// The document's finished pages.
- pub pages: Vec<Page>,
- /// Details about the document.
- pub info: DocumentInfo,
- /// Provides the ability to execute queries on the document.
- pub introspector: Introspector,
-}
-
/// Details about the document.
#[derive(Debug, Default, Clone, PartialEq, Hash)]
pub struct DocumentInfo {
@@ -132,14 +119,3 @@ impl DocumentInfo {
}
}
}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- #[test]
- fn test_document_is_send_and_sync() {
- fn ensure_send_and_sync<T: Send + Sync>() {}
- ensure_send_and_sync::<Document>();
- }
-}
diff --git a/crates/typst-library/src/routines.rs b/crates/typst-library/src/routines.rs
index 6b78b7fb..000b3bba 100644
--- a/crates/typst-library/src/routines.rs
+++ b/crates/typst-library/src/routines.rs
@@ -16,10 +16,11 @@ use crate::foundations::{
use crate::introspection::{Introspector, Locator, SplitLocator};
use crate::layout::{
Abs, BoxElem, ColumnsElem, Fragment, Frame, GridElem, InlineItem, MoveElem, PadElem,
- Region, Regions, Rel, RepeatElem, RotateElem, ScaleElem, Size, SkewElem, StackElem,
+ PagedDocument, Region, Regions, Rel, RepeatElem, RotateElem, ScaleElem, Size,
+ SkewElem, StackElem,
};
use crate::math::EquationElem;
-use crate::model::{Document, DocumentInfo, EnumElem, ListElem, TableElem};
+use crate::model::{DocumentInfo, EnumElem, ListElem, TableElem};
use crate::visualize::{
CircleElem, EllipseElem, ImageElem, LineElem, PathElem, PolygonElem, RectElem,
SquareElem,
@@ -90,7 +91,7 @@ routines! {
engine: &mut Engine,
content: &Content,
styles: StyleChain,
- ) -> SourceResult<Document>
+ ) -> SourceResult<PagedDocument>
/// Lays out content into multiple regions.
fn layout_fragment(
diff --git a/crates/typst-pdf/src/lib.rs b/crates/typst-pdf/src/lib.rs
index efc99b74..f9b4e902 100644
--- a/crates/typst-pdf/src/lib.rs
+++ b/crates/typst-pdf/src/lib.rs
@@ -24,8 +24,7 @@ use pdf_writer::{Chunk, Name, Pdf, Ref, Str, TextStr};
use serde::{Deserialize, Serialize};
use typst_library::diag::{bail, SourceResult, StrResult};
use typst_library::foundations::{Datetime, Smart};
-use typst_library::layout::{Abs, Em, PageRanges, Transform};
-use typst_library::model::Document;
+use typst_library::layout::{Abs, Em, PageRanges, PagedDocument, Transform};
use typst_library::text::Font;
use typst_library::visualize::Image;
use typst_syntax::Span;
@@ -49,7 +48,7 @@ use crate::resources::{
///
/// Returns the raw bytes making up the PDF file.
#[typst_macros::time(name = "pdf")]
-pub fn pdf(document: &Document, options: &PdfOptions) -> SourceResult<Vec<u8>> {
+pub fn pdf(document: &PagedDocument, options: &PdfOptions) -> SourceResult<Vec<u8>> {
PdfBuilder::new(document, options)
.phase(|builder| builder.run(traverse_pages))?
.phase(|builder| {
@@ -176,7 +175,7 @@ struct PdfBuilder<S> {
/// this phase.
struct WithDocument<'a> {
/// The Typst document that is exported.
- document: &'a Document,
+ document: &'a PagedDocument,
/// Settings for PDF export.
options: &'a PdfOptions<'a>,
}
@@ -186,7 +185,7 @@ struct WithDocument<'a> {
///
/// This phase allocates some global references.
struct WithResources<'a> {
- document: &'a Document,
+ document: &'a PagedDocument,
options: &'a PdfOptions<'a>,
/// The content of the pages encoded as PDF content streams.
///
@@ -235,7 +234,7 @@ impl<'a> From<(WithDocument<'a>, (Vec<Option<EncodedPage>>, Resources<()>))>
/// We are now writing objects corresponding to resources, and giving them references,
/// that will be collected in [`References`].
struct WithGlobalRefs<'a> {
- document: &'a Document,
+ document: &'a PagedDocument,
options: &'a PdfOptions<'a>,
pages: Vec<Option<EncodedPage>>,
/// Resources are the same as in previous phases, but each dictionary now has a reference.
@@ -278,7 +277,7 @@ struct References {
/// tree is going to be written, and given a reference. It is also at this point that
/// the page contents is actually written.
struct WithRefs<'a> {
- document: &'a Document,
+ document: &'a PagedDocument,
options: &'a PdfOptions<'a>,
globals: GlobalRefs,
pages: Vec<Option<EncodedPage>>,
@@ -304,7 +303,7 @@ impl<'a> From<(WithGlobalRefs<'a>, References)> for WithRefs<'a> {
///
/// Each sub-resource gets its own isolated resource dictionary.
struct WithEverything<'a> {
- document: &'a Document,
+ document: &'a PagedDocument,
options: &'a PdfOptions<'a>,
globals: GlobalRefs,
pages: Vec<Option<EncodedPage>>,
@@ -336,7 +335,7 @@ impl<'a> From<(WithRefs<'a>, Ref)> for WithEverything<'a> {
impl<'a> PdfBuilder<WithDocument<'a>> {
/// Start building a PDF for a Typst document.
- fn new(document: &'a Document, options: &'a PdfOptions<'a>) -> Self {
+ fn new(document: &'a PagedDocument, options: &'a PdfOptions<'a>) -> Self {
Self {
alloc: Ref::new(1),
pdf: Pdf::new(),
diff --git a/crates/typst-render/src/lib.rs b/crates/typst-render/src/lib.rs
index 8de3852d..8595e790 100644
--- a/crates/typst-render/src/lib.rs
+++ b/crates/typst-render/src/lib.rs
@@ -7,9 +7,9 @@ mod text;
use tiny_skia as sk;
use typst_library::layout::{
- Abs, Axes, Frame, FrameItem, FrameKind, GroupItem, Page, Point, Size, Transform,
+ Abs, Axes, Frame, FrameItem, FrameKind, GroupItem, Page, PagedDocument, Point, Size,
+ Transform,
};
-use typst_library::model::Document;
use typst_library::visualize::{Color, Geometry, Paint};
/// Export a page into a raster image.
@@ -43,7 +43,7 @@ pub fn render(page: &Page, pixel_per_pt: f32) -> sk::Pixmap {
/// Export a document with potentially multiple pages into a single raster image.
pub fn render_merged(
- document: &Document,
+ document: &PagedDocument,
pixel_per_pt: f32,
gap: Abs,
fill: Option<Color>,
diff --git a/crates/typst-svg/src/lib.rs b/crates/typst-svg/src/lib.rs
index fb7d27c2..f9ce4b86 100644
--- a/crates/typst-svg/src/lib.rs
+++ b/crates/typst-svg/src/lib.rs
@@ -11,9 +11,9 @@ use std::fmt::{self, Display, Formatter, Write};
use ecow::EcoString;
use ttf_parser::OutlineBuilder;
use typst_library::layout::{
- Abs, Frame, FrameItem, FrameKind, GroupItem, Page, Point, Ratio, Size, Transform,
+ Abs, Frame, FrameItem, FrameKind, GroupItem, Page, PagedDocument, Point, Ratio, Size,
+ Transform,
};
-use typst_library::model::Document;
use typst_library::visualize::{Geometry, Gradient, Pattern};
use typst_utils::hash128;
use xmlwriter::XmlWriter;
@@ -35,7 +35,7 @@ pub fn svg(page: &Page) -> String {
/// Export a document with potentially multiple pages into a single SVG file.
///
/// The padding will be added around and between the individual frames.
-pub fn svg_merged(document: &Document, padding: Abs) -> String {
+pub fn svg_merged(document: &PagedDocument, padding: Abs) -> String {
let width = 2.0 * padding
+ document
.pages
diff --git a/crates/typst/src/lib.rs b/crates/typst/src/lib.rs
index db1673d2..feb17ba9 100644
--- a/crates/typst/src/lib.rs
+++ b/crates/typst/src/lib.rs
@@ -47,7 +47,7 @@ use typst_library::diag::{warning, FileError, SourceDiagnostic, SourceResult, Wa
use typst_library::engine::{Engine, Route, Sink, Traced};
use typst_library::foundations::{StyleChain, Styles, Value};
use typst_library::introspection::Introspector;
-use typst_library::model::Document;
+use typst_library::layout::PagedDocument;
use typst_library::routines::Routines;
use typst_syntax::{FileId, Span};
use typst_timing::{timed, TimingScope};
@@ -57,7 +57,7 @@ use typst_timing::{timed, TimingScope};
/// - Returns `Ok(document)` if there were no fatal errors.
/// - Returns `Err(errors)` if there were fatal errors.
#[typst_macros::time]
-pub fn compile(world: &dyn World) -> Warned<SourceResult<Document>> {
+pub fn compile(world: &dyn World) -> Warned<SourceResult<PagedDocument>> {
let mut sink = Sink::new();
let output = compile_impl(world.track(), Traced::default().track(), &mut sink)
.map_err(deduplicate);
@@ -80,7 +80,7 @@ fn compile_impl(
world: Tracked<dyn World + '_>,
traced: Tracked<Traced>,
sink: &mut Sink,
-) -> SourceResult<Document> {
+) -> SourceResult<PagedDocument> {
let library = world.library();
let styles = StyleChain::new(&library.styles);
@@ -103,7 +103,7 @@ fn compile_impl(
let mut iter = 0;
let mut subsink;
- let mut document = Document::default();
+ let mut document = PagedDocument::default();
// Relayout until all introspections stabilize.
// If that doesn't happen within five attempts, we give up.