diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-17 22:08:44 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-17 22:08:44 +0100 |
| commit | 8cdfc7faafc1d8df60d44e5db9d1c9e26345675b (patch) | |
| tree | 1c499081c972c2fd280a0fc6a820c07caf79c283 /src | |
| parent | 271b0f953b35ab2c0281b5f728798204accc412f (diff) | |
Rename box to rect and color to fill ✏
Diffstat (limited to 'src')
| -rw-r--r-- | src/library/mod.rs | 2 | ||||
| -rw-r--r-- | src/library/shapes.rs | 18 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/library/mod.rs b/src/library/mod.rs index b33ec711..7e968994 100644 --- a/src/library/mod.rs +++ b/src/library/mod.rs @@ -44,13 +44,13 @@ pub fn new() -> Scope { // Functions. set!(func: "align", align); - set!(func: "box", box_); set!(func: "font", font); set!(func: "h", h); set!(func: "image", image); set!(func: "pad", pad); set!(func: "page", page); set!(func: "pagebreak", pagebreak); + set!(func: "rect", rect); set!(func: "repr", repr); set!(func: "rgb", rgb); set!(func: "type", type_); diff --git a/src/library/shapes.rs b/src/library/shapes.rs index 254a2285..41be3b2b 100644 --- a/src/library/shapes.rs +++ b/src/library/shapes.rs @@ -1,16 +1,16 @@ use super::*; -/// `box`: Create a rectangular box. +/// `rect`: Create a rectangular box. /// /// # Positional arguments /// - Body: optional, of type `template`. /// /// # Named arguments -/// - Width of the box: `width`, of type `linear` relative to parent width. -/// - Height of the box: `height`, of type `linear` relative to parent height. -/// - Main layouting direction: `main-dir`, of type `direction`. -/// - Cross layouting direction: `cross-dir`, of type `direction`. -/// - Background color of the box: `color`, of type `color`. +/// - Width of the box: `width`, of type `linear` relative to parent width. +/// - Height of the box: `height`, of type `linear` relative to parent height. +/// - Main layouting direction: `main-dir`, of type `direction`. +/// - Cross layouting direction: `cross-dir`, of type `direction`. +/// - Fill color of the box: `fill`, of type `color`. /// /// # Relevant types and constants /// - Type `direction` @@ -18,12 +18,12 @@ use super::*; /// - `rtl` (right to left) /// - `ttb` (top to bottom) /// - `btt` (bottom to top) -pub fn box_(ctx: &mut EvalContext, args: &mut ValueArgs) -> Value { +pub fn rect(ctx: &mut EvalContext, args: &mut ValueArgs) -> Value { let width = args.get(ctx, "width"); let height = args.get(ctx, "height"); let main = args.get(ctx, "main-dir"); let cross = args.get(ctx, "cross-dir"); - let color = args.get(ctx, "color"); + let fill = args.get(ctx, "fill"); let body = args.find::<ValueTemplate>(ctx).unwrap_or_default(); Value::template("box", move |ctx| { @@ -33,7 +33,7 @@ pub fn box_(ctx: &mut EvalContext, args: &mut ValueArgs) -> Value { let child = ctx.exec(&body).into(); let fixed = NodeFixed { width, height, child }; - if let Some(color) = color { + if let Some(color) = fill { ctx.push(NodeBackground { fill: Fill::Color(color), child: fixed.into(), |
