summaryrefslogtreecommitdiff
path: root/src/model/show.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-05-03 15:58:15 +0200
committerLaurenz <laurmaedje@gmail.com>2022-05-03 15:58:15 +0200
commitd59109e8fffa1d0b03234329e12f5d3e578804e8 (patch)
treefe7453da6f2ae327993e5ca6436ddc6a448a2c41 /src/model/show.rs
parentf77f1f61bf05ae506689be3c40252c5807276280 (diff)
Support recursive show rules
Diffstat (limited to 'src/model/show.rs')
-rw-r--r--src/model/show.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/model/show.rs b/src/model/show.rs
index 16374deb..af87d930 100644
--- a/src/model/show.rs
+++ b/src/model/show.rs
@@ -2,7 +2,7 @@ use std::fmt::{self, Debug, Formatter, Write};
use std::hash::Hash;
use std::sync::Arc;
-use super::{Content, NodeId, StyleChain};
+use super::{Content, NodeId, Selector, StyleChain};
use crate::diag::TypResult;
use crate::eval::Dict;
use crate::util::Prehashed;
@@ -10,6 +10,9 @@ use crate::Context;
/// A node that can be realized given some styles.
pub trait Show: 'static {
+ /// Unguard nested content against recursive show rules.
+ fn unguard(&self, sel: Selector) -> ShowNode;
+
/// Encode this node into a dictionary.
fn encode(&self) -> Dict;
@@ -63,6 +66,10 @@ impl ShowNode {
}
impl Show for ShowNode {
+ fn unguard(&self, sel: Selector) -> ShowNode {
+ self.0.unguard(sel)
+ }
+
fn encode(&self) -> Dict {
self.0.encode()
}