From 2ffbabe7c93385bd3b755567dc51a3a4e417ae9e Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Tue, 18 Mar 2025 18:40:59 +0100 Subject: [PATCH] Reformat --- crates/typst-pdf/src/convert.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/typst-pdf/src/convert.rs b/crates/typst-pdf/src/convert.rs index 8fabc5b2e..603c1d917 100644 --- a/crates/typst-pdf/src/convert.rs +++ b/crates/typst-pdf/src/convert.rs @@ -53,12 +53,13 @@ pub fn convert( let mut document = Document::new_with(settings); let page_index_converter = PageIndexConverter::new(typst_document, options); - let named_destinations = collect_named_destinations(typst_document, &page_index_converter); + let named_destinations = + collect_named_destinations(typst_document, &page_index_converter); let mut gc = GlobalContext::new( typst_document, options, named_destinations, - page_index_converter + page_index_converter, ); convert_pages(&mut gc, &mut document)?; @@ -93,7 +94,9 @@ fn convert_pages(gc: &mut GlobalContext, document: &mut Document) -> SourceResul // the real (not logical) page numbers. Here, the final PDF page number // will differ, but we can at least use labels to indicate what was // the corresponding real page number in the Typst document. - gc.page_index_converter.has_skipped_pages().then(|| PageLabel::arabic(i + 1)) + gc.page_index_converter + .has_skipped_pages() + .then(|| PageLabel::arabic(i + 1)) }) { settings = settings.with_page_label(label); @@ -222,7 +225,7 @@ pub(crate) struct GlobalContext<'a> { pub(crate) loc_to_names: HashMap, /// The languages used throughout the document. pub(crate) languages: BTreeMap, - pub(crate) page_index_converter: PageIndexConverter + pub(crate) page_index_converter: PageIndexConverter, } impl<'a> GlobalContext<'a> { @@ -230,7 +233,7 @@ impl<'a> GlobalContext<'a> { document: &'a PagedDocument, options: &'a PdfOptions, loc_to_names: HashMap, - page_index_converter: PageIndexConverter + page_index_converter: PageIndexConverter, ) -> GlobalContext<'a> { Self { fonts_forward: HashMap::new(), @@ -241,7 +244,7 @@ impl<'a> GlobalContext<'a> { image_to_spans: HashMap::new(), image_spans: HashSet::new(), languages: BTreeMap::new(), - page_index_converter + page_index_converter, } } } @@ -552,7 +555,7 @@ fn finish( fn collect_named_destinations( document: &PagedDocument, - pic: &PageIndexConverter + pic: &PageIndexConverter, ) -> HashMap { let mut locs_to_names = HashMap::new();