summaryrefslogtreecommitdiff
path: root/src/model/cast.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-07 12:21:12 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-07 12:46:05 +0100
commitefd1853d069fbd1476e82d015da4d0d04cfaccc0 (patch)
tree842b745c134306539d10c61be9485794fe8dc7dc /src/model/cast.rs
parenteb951c008beea502042db4a3a0e8d1f8b51f6f52 (diff)
Show it!
- New show rule syntax - Set if syntax - Removed wrap syntax
Diffstat (limited to 'src/model/cast.rs')
-rw-r--r--src/model/cast.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/model/cast.rs b/src/model/cast.rs
index cbb2952d..7a466b72 100644
--- a/src/model/cast.rs
+++ b/src/model/cast.rs
@@ -1,7 +1,7 @@
use std::num::NonZeroUsize;
use std::str::FromStr;
-use super::{Pattern, Regex, Value};
+use super::{Content, Pattern, Regex, Transform, Value};
use crate::diag::{with_alternative, StrResult};
use crate::font::{FontStretch, FontStyle, FontWeight};
use crate::frame::{Destination, Lang, Location, Region};
@@ -189,6 +189,15 @@ castable! {
@regex: Regex => Self::Regex(regex.clone()),
}
+castable! {
+ Transform,
+ Expected: "content or function",
+ Value::None => Self::Content(Content::empty()),
+ Value::Str(text) => Self::Content(item!(text)(text.into())),
+ Value::Content(content) => Self::Content(content),
+ Value::Func(func) => Self::Func(func),
+}
+
dynamic! {
Dir: "direction",
}