mirror of
https://github.com/typst/typst
synced 2025-07-30 07:47:55 +08:00
Pay only for realization but not downstream
This commit is contained in:
parent
19ab32dd0d
commit
5e41d13dc2
@ -344,6 +344,7 @@ fn visit_show_rules<'a>(
|
|||||||
styles: StyleChain<'a>,
|
styles: StyleChain<'a>,
|
||||||
) -> SourceResult<bool> {
|
) -> SourceResult<bool> {
|
||||||
// Determines whether and how to proceed with show rule application.
|
// Determines whether and how to proceed with show rule application.
|
||||||
|
let keep_tags = content.can::<dyn Locatable>() || content.label().is_some();
|
||||||
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 {
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
@ -400,6 +401,9 @@ fn visit_show_rules<'a>(
|
|||||||
let (start, end) = tags.unzip();
|
let (start, end) = tags.unzip();
|
||||||
if let Some(tag) = start {
|
if let Some(tag) = start {
|
||||||
visit(s, s.store(TagElem::packed(tag)), styles)?;
|
visit(s, s.store(TagElem::packed(tag)), styles)?;
|
||||||
|
if !keep_tags {
|
||||||
|
s.sink.pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let prev_outside = s.outside;
|
let prev_outside = s.outside;
|
||||||
@ -415,6 +419,9 @@ fn visit_show_rules<'a>(
|
|||||||
// Push end tag.
|
// Push end tag.
|
||||||
if let Some(tag) = end {
|
if let Some(tag) = end {
|
||||||
visit(s, s.store(TagElem::packed(tag)), styles)?;
|
visit(s, s.store(TagElem::packed(tag)), styles)?;
|
||||||
|
if !keep_tags {
|
||||||
|
s.sink.pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user