diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-12-31 09:37:55 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-12-31 09:52:14 +0100 |
| commit | 7c683db3673187260ef2fa84d779ff81cb05aba8 (patch) | |
| tree | 5ecfe3845b528a7d5ec67dfc1c93eb0dee3fa951 /src/model/value.rs | |
| parent | a6d90c1bf1e9fefa0af04206909a40e112d6bb14 (diff) | |
Merge `MarkupNode` and `MathNode` into `Expr`
Diffstat (limited to 'src/model/value.rs')
| -rw-r--r-- | src/model/value.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/model/value.rs b/src/model/value.rs index 1c687d8d..0716985d 100644 --- a/src/model/value.rs +++ b/src/model/value.rs @@ -112,6 +112,15 @@ impl Value { _ => item!(raw)(self.repr().into(), Some("typc".into()), false), } } + + /// Return the display representation of the value in math mode. + pub fn display_in_math(self) -> Content { + match self { + Self::Int(v) => item!(math_atom)(format_eco!("{}", v)), + Self::Float(v) => item!(math_atom)(format_eco!("{}", v)), + _ => self.display(), + } + } } impl Default for Value { |
