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)
|
||||
}
|
||||
|
||||
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
|
||||
/// element was handled.
|
||||
fn visit_show_rules<'a>(
|
||||
@ -361,12 +346,7 @@ fn visit_show_rules<'a>(
|
||||
// Determines whether and how to proceed with show rule application.
|
||||
let Some(Verdict { prepared, mut map, step }) = verdict(s.engine, content, styles)
|
||||
else {
|
||||
if !content.is_prepared() && locatable(content) {
|
||||
visit_with_tags_minimal(s, content, styles)?;
|
||||
return Ok(true);
|
||||
} else {
|
||||
return Ok(false);
|
||||
}
|
||||
};
|
||||
|
||||
// Create a fresh copy that we can mutate.
|
||||
@ -526,7 +506,7 @@ fn verdict<'a>(
|
||||
elem.label().is_none()
|
||||
&& elem.location().is_none()
|
||||
&& !elem.can::<dyn ShowSet>()
|
||||
&& !elem.can::<dyn Locatable>()
|
||||
&& !locatable(elem)
|
||||
&& !elem.can::<dyn Synthesize>()
|
||||
})
|
||||
{
|
||||
@ -555,9 +535,7 @@ fn prepare(
|
||||
// The element could already have a location even if it is not prepared
|
||||
// when it stems from a query.
|
||||
let key = typst_utils::hash128(&elem);
|
||||
if elem.location().is_none()
|
||||
&& (elem.can::<dyn Locatable>() || elem.label().is_some())
|
||||
{
|
||||
if elem.location().is_none() && (locatable(elem) || elem.label().is_some()) {
|
||||
let loc = locator.next_location(engine.introspector, key);
|
||||
elem.set_location(loc);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user