mirror of
https://github.com/typst/typst
synced 2025-07-28 06:47:53 +08:00
Revert "Realize twice"
This reverts commit c4b525e860d6f4147901c369d27e3f0295254b78.
This commit is contained in:
parent
a606f4d796
commit
70b4774535
@ -236,7 +236,6 @@ enum Resolved {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A type that generates unique sublocators.
|
/// A type that generates unique sublocators.
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct SplitLocator<'a> {
|
pub struct SplitLocator<'a> {
|
||||||
/// A local hash that incorporates all layers since the last memoization
|
/// A local hash that incorporates all layers since the last memoization
|
||||||
/// boundary.
|
/// boundary.
|
||||||
|
@ -24,8 +24,8 @@ use typst_library::layout::{
|
|||||||
};
|
};
|
||||||
use typst_library::math::{EquationElem, Mathy};
|
use typst_library::math::{EquationElem, Mathy};
|
||||||
use typst_library::model::{
|
use typst_library::model::{
|
||||||
CiteElem, CiteGroup, DocumentElem, DocumentInfo, EnumElem, ListElem, ListItemLike,
|
CiteElem, CiteGroup, DocumentElem, EnumElem, ListElem, ListItemLike, ListLike,
|
||||||
ListLike, ParElem, ParbreakElem, TermsElem,
|
ParElem, ParbreakElem, TermsElem,
|
||||||
};
|
};
|
||||||
use typst_library::routines::{Arenas, FragmentKind, Pair, RealizationKind};
|
use typst_library::routines::{Arenas, FragmentKind, Pair, RealizationKind};
|
||||||
use typst_library::text::{LinebreakElem, SmartQuoteElem, SpaceElem, TextElem};
|
use typst_library::text::{LinebreakElem, SmartQuoteElem, SpaceElem, TextElem};
|
||||||
@ -41,42 +41,6 @@ pub fn realize<'a>(
|
|||||||
arenas: &'a Arenas,
|
arenas: &'a Arenas,
|
||||||
content: &'a Content,
|
content: &'a Content,
|
||||||
styles: StyleChain<'a>,
|
styles: StyleChain<'a>,
|
||||||
) -> SourceResult<Vec<Pair<'a>>> {
|
|
||||||
let mut doc_info = DocumentInfo::default();
|
|
||||||
let mut frag_kind = FragmentKind::Block;
|
|
||||||
let _ = std::hint::black_box(realize_inner(
|
|
||||||
match kind {
|
|
||||||
RealizationKind::LayoutDocument { .. } => {
|
|
||||||
RealizationKind::LayoutDocument { info: &mut doc_info }
|
|
||||||
}
|
|
||||||
RealizationKind::LayoutFragment { .. } => {
|
|
||||||
RealizationKind::LayoutFragment { kind: &mut frag_kind }
|
|
||||||
}
|
|
||||||
RealizationKind::LayoutPar => RealizationKind::LayoutPar,
|
|
||||||
RealizationKind::HtmlDocument { is_inline, .. } => {
|
|
||||||
RealizationKind::HtmlDocument { info: &mut doc_info, is_inline }
|
|
||||||
}
|
|
||||||
RealizationKind::HtmlFragment { is_inline, .. } => {
|
|
||||||
RealizationKind::HtmlFragment { kind: &mut frag_kind, is_inline }
|
|
||||||
}
|
|
||||||
RealizationKind::Math => RealizationKind::Math,
|
|
||||||
},
|
|
||||||
engine,
|
|
||||||
&mut locator.clone(),
|
|
||||||
arenas,
|
|
||||||
content,
|
|
||||||
styles,
|
|
||||||
));
|
|
||||||
realize_inner(kind, engine, locator, arenas, content, styles)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn realize_inner<'a>(
|
|
||||||
kind: RealizationKind,
|
|
||||||
engine: &mut Engine,
|
|
||||||
locator: &mut SplitLocator,
|
|
||||||
arenas: &'a Arenas,
|
|
||||||
content: &'a Content,
|
|
||||||
styles: StyleChain<'a>,
|
|
||||||
) -> SourceResult<Vec<Pair<'a>>> {
|
) -> SourceResult<Vec<Pair<'a>>> {
|
||||||
let mut s = State {
|
let mut s = State {
|
||||||
engine,
|
engine,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user