From 264a7dedd42e27cd9e604037640cf0594b2ec46b Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 19 Mar 2021 17:57:31 +0100 Subject: =?UTF-8?q?Scheduled=20maintenance=20=F0=9F=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - New naming scheme - TextNode instead of NodeText - CallExpr instead of ExprCall - ... - Less glob imports - Removes Value::Args variant - Removes prelude - Renames Layouted to Fragment - Moves font into env - Moves shaping into layout - Moves frame into separate module --- src/library/pad.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/library/pad.rs') diff --git a/src/library/pad.rs b/src/library/pad.rs index 5d59f2b3..9f05f7ce 100644 --- a/src/library/pad.rs +++ b/src/library/pad.rs @@ -1,4 +1,5 @@ use super::*; +use crate::layout::PadNode; /// `pad`: Pad content at the sides. /// @@ -14,13 +15,13 @@ use super::*; /// /// # Return value /// A template that pads the body at the sides. -pub fn pad(ctx: &mut EvalContext, args: &mut ValueArgs) -> Value { +pub fn pad(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { let all = args.find(ctx); let left = args.get(ctx, "left"); let top = args.get(ctx, "top"); let right = args.get(ctx, "right"); let bottom = args.get(ctx, "bottom"); - let body = args.require::(ctx, "body").unwrap_or_default(); + let body = args.require::(ctx, "body").unwrap_or_default(); let padding = Sides::new( left.or(all).unwrap_or_default(), @@ -31,10 +32,8 @@ pub fn pad(ctx: &mut EvalContext, args: &mut ValueArgs) -> Value { Value::template("pad", move |ctx| { let snapshot = ctx.state.clone(); - let child = ctx.exec(&body).into(); - ctx.push(NodePad { padding, child }); - + ctx.push(PadNode { padding, child }); ctx.state = snapshot; }) } -- cgit v1.2.3