summaryrefslogtreecommitdiff
path: root/library/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-04-01 19:04:06 +0200
committerLaurenz <laurmaedje@gmail.com>2023-04-01 19:04:06 +0200
commit2d6a79ba32f6c075ea84cc1b6496b91a1e993058 (patch)
treedf819e25c14b864e750d1e2543da49d102cd8817 /library/src
parent0c33a64481a3b5e4392ce33cb2a127c71406439b (diff)
Don't display empty counters and state
Fixes #338.
Diffstat (limited to 'library/src')
-rw-r--r--library/src/meta/counter.rs4
-rw-r--r--library/src/meta/state.rs4
2 files changed, 8 insertions, 0 deletions
diff --git a/library/src/meta/counter.rs b/library/src/meta/counter.rs
index fb656c76..1d8e642d 100644
--- a/library/src/meta/counter.rs
+++ b/library/src/meta/counter.rs
@@ -583,6 +583,10 @@ struct DisplayElem {
impl Show for DisplayElem {
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 counter = self.counter();
let numbering = self
diff --git a/library/src/meta/state.rs b/library/src/meta/state.rs
index 11073594..3e6d65b2 100644
--- a/library/src/meta/state.rs
+++ b/library/src/meta/state.rs
@@ -393,6 +393,10 @@ struct DisplayElem {
impl Show for DisplayElem {
fn show(&self, vt: &mut Vt, _: StyleChain) -> SourceResult<Content> {
+ if !vt.introspector.init() {
+ return Ok(Content::empty());
+ }
+
let location = self.0.location().unwrap();
let value = self.state().at(vt, location)?;
Ok(match self.func() {