diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-06-26 13:06:37 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-06-26 13:06:37 +0200 |
| commit | 285c2f617b74e182be69decea46bbd0afdb0f604 (patch) | |
| tree | 41bdb5d19bc80c165df6e55e829051f0812f7c3d /src/library/pad.rs | |
| parent | 63cf36149635156013f0324b660bf4d362beb87f (diff) | |
Cleanse library
- Remove doc-comments for Typst functions from library
- Reduce number of library source files
Diffstat (limited to 'src/library/pad.rs')
| -rw-r--r-- | src/library/pad.rs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/library/pad.rs b/src/library/pad.rs deleted file mode 100644 index 4b68a434..00000000 --- a/src/library/pad.rs +++ /dev/null @@ -1,37 +0,0 @@ -use super::*; -use crate::layout::PadNode; - -/// `pad`: Pad content at the sides. -/// -/// # Positional parameters -/// - Padding for all sides: `padding`, of type `linear` relative to sides. -/// - Body: of type `template`. -/// -/// # Named parameters -/// - Left padding: `left`, of type `linear` relative to parent width. -/// - Right padding: `right`, of type `linear` relative to parent width. -/// - Top padding: `top`, of type `linear` relative to parent height. -/// - Bottom padding: `bottom`, of type `linear` relative to parent height. -/// -/// # Return value -/// A template that pads its region and sets the body into it. -pub fn pad(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { - let all = args.eat(ctx); - let left = args.named(ctx, "left"); - let top = args.named(ctx, "top"); - let right = args.named(ctx, "right"); - let bottom = args.named(ctx, "bottom"); - let body = args.expect::<TemplateValue>(ctx, "body").unwrap_or_default(); - - let padding = Sides::new( - left.or(all).unwrap_or_default(), - top.or(all).unwrap_or_default(), - right.or(all).unwrap_or_default(), - bottom.or(all).unwrap_or_default(), - ); - - Value::template("pad", move |ctx| { - let child = ctx.exec_template_stack(&body).into(); - ctx.push_into_stack(PadNode { padding, child }); - }) -} |
