mirror of
https://github.com/typst/typst
synced 2025-07-28 14:57:54 +08:00
Revert "Minimal tag work"
This reverts commit 88c234eb447769772a0c67d6a84d5a6659ecdefd.
This commit is contained in:
parent
88c234eb44
commit
19ab32dd0d
@ -336,21 +336,6 @@ fn visit_kind_rules<'a>(
|
|||||||
Ok(false)
|
Ok(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_with_tags_minimal<'a>(
|
|
||||||
s: &mut State<'a, '_, '_, '_>,
|
|
||||||
content: &'a Content,
|
|
||||||
styles: StyleChain<'a>,
|
|
||||||
) -> SourceResult<()> {
|
|
||||||
let mut elem = content.clone();
|
|
||||||
let key = typst_utils::hash128(&elem);
|
|
||||||
let loc = s.locator.next_location(s.engine.introspector, key);
|
|
||||||
elem.set_location(loc);
|
|
||||||
visit(s, s.store(TagElem::packed(Tag::Start(elem.clone()))), styles)?;
|
|
||||||
elem.mark_prepared();
|
|
||||||
visit(s, s.store(TagElem::packed(Tag::End(loc, key))), styles)?;
|
|
||||||
visit(s, s.store(elem), styles)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Tries to apply show rules to or prepare content. Returns `true` if the
|
/// Tries to apply show rules to or prepare content. Returns `true` if the
|
||||||
/// element was handled.
|
/// element was handled.
|
||||||
fn visit_show_rules<'a>(
|
fn visit_show_rules<'a>(
|
||||||
@ -361,12 +346,7 @@ fn visit_show_rules<'a>(
|
|||||||
// Determines whether and how to proceed with show rule application.
|
// Determines whether and how to proceed with show rule application.
|
||||||
let Some(Verdict { prepared, mut map, step }) = verdict(s.engine, content, styles)
|
let Some(Verdict { prepared, mut map, step }) = verdict(s.engine, content, styles)
|
||||||
else {
|
else {
|
||||||
if !content.is_prepared() && locatable(content) {
|
return Ok(false);
|
||||||
visit_with_tags_minimal(s, content, styles)?;
|
|
||||||
return Ok(true);
|
|
||||||
} else {
|
|
||||||
return Ok(false);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create a fresh copy that we can mutate.
|
// Create a fresh copy that we can mutate.
|
||||||
@ -526,7 +506,7 @@ fn verdict<'a>(
|
|||||||
elem.label().is_none()
|
elem.label().is_none()
|
||||||
&& elem.location().is_none()
|
&& elem.location().is_none()
|
||||||
&& !elem.can::<dyn ShowSet>()
|
&& !elem.can::<dyn ShowSet>()
|
||||||
&& !elem.can::<dyn Locatable>()
|
&& !locatable(elem)
|
||||||
&& !elem.can::<dyn Synthesize>()
|
&& !elem.can::<dyn Synthesize>()
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
@ -555,9 +535,7 @@ fn prepare(
|
|||||||
// The element could already have a location even if it is not prepared
|
// The element could already have a location even if it is not prepared
|
||||||
// when it stems from a query.
|
// when it stems from a query.
|
||||||
let key = typst_utils::hash128(&elem);
|
let key = typst_utils::hash128(&elem);
|
||||||
if elem.location().is_none()
|
if elem.location().is_none() && (locatable(elem) || elem.label().is_some()) {
|
||||||
&& (elem.can::<dyn Locatable>() || elem.label().is_some())
|
|
||||||
{
|
|
||||||
let loc = locator.next_location(engine.introspector, key);
|
let loc = locator.next_location(engine.introspector, key);
|
||||||
elem.set_location(loc);
|
elem.set_location(loc);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user