diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-19 17:57:31 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-19 17:57:31 +0100 |
| commit | 264a7dedd42e27cd9e604037640cf0594b2ec46b (patch) | |
| tree | d26feea399d54bb86bd44878f40293983bf5251d /src/library/pad.rs | |
| parent | ca3df70e2a5069832d7d2135967674c34a155442 (diff) | |
Scheduled maintenance 🔨
- 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
Diffstat (limited to 'src/library/pad.rs')
| -rw-r--r-- | src/library/pad.rs | 9 |
1 files changed, 4 insertions, 5 deletions
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::<ValueTemplate>(ctx, "body").unwrap_or_default(); + let body = args.require::<TemplateValue>(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; }) } |
