summaryrefslogtreecommitdiff
path: root/src/library/deco.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-02-18 15:02:02 +0100
committerLaurenz <laurmaedje@gmail.com>2022-02-18 16:57:53 +0100
commite01970b20a058ab1b4ebea916f229c9b706c84e4 (patch)
tree5c5efc75abd6e607bd45a0602603231edf520503 /src/library/deco.rs
parent05ec0f993b4a1b8481e494ee16285d23f000872f (diff)
Basic show rules
Diffstat (limited to 'src/library/deco.rs')
-rw-r--r--src/library/deco.rs22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/library/deco.rs b/src/library/deco.rs
index 79026288..aac79d05 100644
--- a/src/library/deco.rs
+++ b/src/library/deco.rs
@@ -32,15 +32,19 @@ impl<const L: DecoLine> DecoNode<L> {
}
impl<const L: DecoLine> Show for DecoNode<L> {
- fn show(&self, _: &mut Vm, styles: StyleChain) -> TypResult<Template> {
- Ok(self.0.clone().styled(TextNode::LINES, vec![Decoration {
- line: L,
- stroke: styles.get(Self::STROKE),
- thickness: styles.get(Self::THICKNESS),
- offset: styles.get(Self::OFFSET),
- extent: styles.get(Self::EXTENT),
- evade: styles.get(Self::EVADE),
- }]))
+ fn show(&self, vm: &mut Vm, styles: StyleChain) -> TypResult<Template> {
+ Ok(styles
+ .show(self, vm, [Value::Template(self.0.clone())])?
+ .unwrap_or_else(|| {
+ self.0.clone().styled(TextNode::LINES, vec![Decoration {
+ line: L,
+ stroke: styles.get(Self::STROKE),
+ thickness: styles.get(Self::THICKNESS),
+ offset: styles.get(Self::OFFSET),
+ extent: styles.get(Self::EXTENT),
+ evade: styles.get(Self::EVADE),
+ }])
+ }))
}
}