diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-04-23 21:55:58 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-04-23 21:55:58 +0200 |
| commit | 04fb8b288aa7c80607da79db7d085a4820b95a9d (patch) | |
| tree | 7ca96d09d511274ebac298c329d5eef53a290d9c /src/library/math | |
| parent | 7a2cc3e7d29d16c5cf9b5a93a688e14da93c8662 (diff) | |
Show rules with type ascribed object
Diffstat (limited to 'src/library/math')
| -rw-r--r-- | src/library/math/mod.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/library/math/mod.rs b/src/library/math/mod.rs index e6548438..587949d7 100644 --- a/src/library/math/mod.rs +++ b/src/library/math/mod.rs @@ -28,11 +28,21 @@ impl MathNode { } impl Show for MathNode { - fn show(&self, ctx: &mut Context, styles: StyleChain) -> TypResult<Content> { - let args = [Value::Str(self.formula.clone()), Value::Bool(self.display)]; - let mut content = styles - .show::<Self, _>(ctx, args)? - .unwrap_or_else(|| Content::Text(self.formula.trim().into())); + fn encode(&self) -> Dict { + dict! { + "formula" => Value::Str(self.formula.clone()), + "display" => Value::Bool(self.display) + } + } + + fn show( + &self, + _: &mut Context, + styles: StyleChain, + realized: Option<Content>, + ) -> TypResult<Content> { + let mut content = + realized.unwrap_or_else(|| Content::Text(self.formula.trim().into())); let mut map = StyleMap::new(); if let Smart::Custom(family) = styles.get(Self::FAMILY) { |
