From bfaf5447a789cd0dbbb1e418bea62fef9edc2b7d Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 6 May 2022 10:05:11 +0200 Subject: Cast content from string --- src/eval/value.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/eval/value.rs') diff --git a/src/eval/value.rs b/src/eval/value.rs index b5607cfd..dd183926 100644 --- a/src/eval/value.rs +++ b/src/eval/value.rs @@ -464,11 +464,19 @@ primitive! { f64: "float", Float, Int(v) => v as f64 } primitive! { RawLength: "length", Length } primitive! { Angle: "angle", Angle } primitive! { Ratio: "ratio", Ratio } -primitive! { Relative: "relative length", Relative, Length(v) => v.into(), Ratio(v) => v.into() } +primitive! { Relative: "relative length", + Relative, + Length(v) => v.into(), + Ratio(v) => v.into() +} primitive! { Fraction: "fraction", Fraction } primitive! { Color: "color", Color } primitive! { EcoString: "string", Str } -primitive! { Content: "content", Content, None => Content::new() } +primitive! { Content: "content", + Content, + None => Content::new(), + Str(text) => Content::Text(text) +} primitive! { Array: "array", Array } primitive! { Dict: "dictionary", Dict } primitive! { Func: "function", Func } -- cgit v1.2.3