summaryrefslogtreecommitdiff
path: root/src/model/ops.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-01 16:56:35 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-02 09:18:33 +0100
commit37ac5d966ebaf97ac79c507028cd5b742b510b89 (patch)
tree249d43ff0f8d880cb5d00c236993f8ff0c1f10d8 /src/model/ops.rs
parentf547c97072881069417acd3b79b08fb7ecf40ba2 (diff)
More dynamic content representation
Diffstat (limited to 'src/model/ops.rs')
-rw-r--r--src/model/ops.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/model/ops.rs b/src/model/ops.rs
index c7d6ac78..7a8c6950 100644
--- a/src/model/ops.rs
+++ b/src/model/ops.rs
@@ -2,9 +2,10 @@
use std::cmp::Ordering;
-use super::{RawAlign, RawStroke, Regex, Smart, Value};
+use super::{Node, RawAlign, RawStroke, Regex, Smart, Value};
use crate::diag::StrResult;
use crate::geom::{Axes, Axis, Length, Numeric, Rel};
+use crate::library::text::TextNode;
use Value::*;
/// Bail with a type mismatch error.
@@ -20,8 +21,8 @@ pub fn join(lhs: Value, rhs: Value) -> StrResult<Value> {
(a, None) => a,
(None, b) => b,
(Str(a), Str(b)) => Str(a + b),
- (Str(a), Content(b)) => Content(super::Content::Text(a.into()) + b),
- (Content(a), Str(b)) => Content(a + super::Content::Text(b.into())),
+ (Str(a), Content(b)) => Content(TextNode(a.into()).pack() + b),
+ (Content(a), Str(b)) => Content(a + TextNode(b.into()).pack()),
(Content(a), Content(b)) => Content(a + b),
(Array(a), Array(b)) => Array(a + b),
(Dict(a), Dict(b)) => Dict(a + b),
@@ -86,8 +87,8 @@ pub fn add(lhs: Value, rhs: Value) -> StrResult<Value> {
(Str(a), Str(b)) => Str(a + b),
(Content(a), Content(b)) => Content(a + b),
- (Content(a), Str(b)) => Content(a + super::Content::Text(b.into())),
- (Str(a), Content(b)) => Content(super::Content::Text(a.into()) + b),
+ (Content(a), Str(b)) => Content(a + TextNode(b.into()).pack()),
+ (Str(a), Content(b)) => Content(TextNode(a.into()).pack() + b),
(Array(a), Array(b)) => Array(a + b),
(Dict(a), Dict(b)) => Dict(a + b),