summaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-12-05 12:25:37 +0100
committerLaurenz <laurmaedje@gmail.com>2022-12-05 12:25:37 +0100
commitc2e458a133772a94009733040b39d58e781af977 (patch)
tree9404ef8f4982a068f046cb772166fdb8af7c3a0b /src/model
parent1d324235bd80fe8d1fb21b1e73ae9e3dfe918078 (diff)
Symbol notation
Diffstat (limited to 'src/model')
-rw-r--r--src/model/eval.rs9
-rw-r--r--src/model/library.rs2
2 files changed, 11 insertions, 0 deletions
diff --git a/src/model/eval.rs b/src/model/eval.rs
index 43cdbbcc..1d942dd0 100644
--- a/src/model/eval.rs
+++ b/src/model/eval.rs
@@ -265,6 +265,7 @@ impl Eval for ast::MarkupNode {
Self::Text(v) => v.eval(vm)?,
Self::Escape(v) => (vm.items.text)(v.get().into()),
Self::Shorthand(v) => v.eval(vm)?,
+ Self::Symbol(v) => v.eval(vm)?,
Self::SmartQuote(v) => v.eval(vm)?,
Self::Strong(v) => v.eval(vm)?,
Self::Emph(v) => v.eval(vm)?,
@@ -306,6 +307,14 @@ impl Eval for ast::Shorthand {
}
}
+impl Eval for ast::Symbol {
+ type Output = Content;
+
+ fn eval(&self, vm: &mut Vm) -> SourceResult<Self::Output> {
+ Ok((vm.items.symbol)(self.get().clone()))
+ }
+}
+
impl Eval for ast::SmartQuote {
type Output = Content;
diff --git a/src/model/library.rs b/src/model/library.rs
index c890fef1..63bd5839 100644
--- a/src/model/library.rs
+++ b/src/model/library.rs
@@ -41,6 +41,8 @@ pub struct LangItems {
pub text_id: NodeId,
/// Get the string if this is a text node.
pub text_str: fn(&Content) -> Option<&str>,
+ /// Symbol notation: `:arrow:l:`.
+ pub symbol: fn(notation: EcoString) -> Content,
/// A smart quote: `'` or `"`.
pub smart_quote: fn(double: bool) -> Content,
/// A paragraph break.