Don't display empty counters and state

Fixes #338.
This commit is contained in:
Laurenz 2023-04-01 19:04:06 +02:00
parent 0c33a64481
commit 2d6a79ba32
2 changed files with 8 additions and 0 deletions

View File

@ -583,6 +583,10 @@ struct DisplayElem {
impl Show for DisplayElem { impl Show for DisplayElem {
fn show(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Content> { fn show(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Content> {
if !vt.introspector.init() {
return Ok(Content::empty());
}
let location = self.0.location().unwrap(); let location = self.0.location().unwrap();
let counter = self.counter(); let counter = self.counter();
let numbering = self let numbering = self

View File

@ -393,6 +393,10 @@ struct DisplayElem {
impl Show for DisplayElem { impl Show for DisplayElem {
fn show(&self, vt: &mut Vt, _: StyleChain) -> SourceResult<Content> { fn show(&self, vt: &mut Vt, _: StyleChain) -> SourceResult<Content> {
if !vt.introspector.init() {
return Ok(Content::empty());
}
let location = self.0.location().unwrap(); let location = self.0.location().unwrap();
let value = self.state().at(vt, location)?; let value = self.state().at(vt, location)?;
Ok(match self.func() { Ok(match self.func() {