summaryrefslogtreecommitdiff
path: root/src/library/sized.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-11-23 22:04:08 +0100
committerLaurenz <laurmaedje@gmail.com>2021-11-23 22:04:08 +0100
commit8a88f71cb11565c1a78bd57f02a8df17cb2bf7a0 (patch)
tree8802c1ff48e2be118e3872d25bd2f2c1f7a21b4a /src/library/sized.rs
parentc77c5a0f0ae6560a03a85e847006c29de9c7ae62 (diff)
Transformations
Diffstat (limited to 'src/library/sized.rs')
-rw-r--r--src/library/sized.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/library/sized.rs b/src/library/sized.rs
index 8d69afac..d137c51e 100644
--- a/src/library/sized.rs
+++ b/src/library/sized.rs
@@ -2,19 +2,21 @@ use super::prelude::*;
/// `box`: Size content and place it into a paragraph.
pub fn box_(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> {
- let sizing = Spec::new(args.named("width")?, args.named("height")?);
+ let width = args.named("width")?;
+ let height = args.named("height")?;
let body: Template = args.find().unwrap_or_default();
Ok(Value::Template(Template::from_inline(move |style| {
- body.pack(style).sized(sizing)
+ body.pack(style).sized(Spec::new(width, height))
})))
}
/// `block`: Size content and place it into the flow.
pub fn block(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> {
- let sizing = Spec::new(args.named("width")?, args.named("height")?);
+ let width = args.named("width")?;
+ let height = args.named("height")?;
let body: Template = args.find().unwrap_or_default();
Ok(Value::Template(Template::from_block(move |style| {
- body.pack(style).sized(sizing)
+ body.pack(style).sized(Spec::new(width, height))
})))
}