summaryrefslogtreecommitdiff
path: root/crates/typst-eval/src/math.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/typst-eval/src/math.rs')
-rw-r--r--crates/typst-eval/src/math.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/crates/typst-eval/src/math.rs b/crates/typst-eval/src/math.rs
index 51dc0a3d..f93f147e 100644
--- a/crates/typst-eval/src/math.rs
+++ b/crates/typst-eval/src/math.rs
@@ -5,7 +5,7 @@ use typst_library::math::{
AlignPointElem, AttachElem, FracElem, LrElem, PrimesElem, RootElem,
};
use typst_library::text::TextElem;
-use typst_syntax::ast::{self, AstNode};
+use typst_syntax::ast::{self, AstNode, MathTextKind};
use crate::{Eval, Vm};
@@ -20,6 +20,18 @@ impl Eval for ast::Math<'_> {
}
}
+impl Eval for ast::MathText<'_> {
+ type Output = Content;
+
+ fn eval(self, _: &mut Vm) -> SourceResult<Self::Output> {
+ match self.get() {
+ // TODO: change to `SymbolElem` when added
+ MathTextKind::Character(c) => Ok(Value::Symbol(Symbol::single(c)).display()),
+ MathTextKind::Number(text) => Ok(TextElem::packed(text.clone())),
+ }
+ }
+}
+
impl Eval for ast::MathIdent<'_> {
type Output = Value;