From 784018124d13a4cfb050b8bf1fecd283cdc309db Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 26 Jun 2021 15:35:37 +0200 Subject: Remove unused template name field --- src/library/elements.rs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'src/library/elements.rs') diff --git a/src/library/elements.rs b/src/library/elements.rs index b1b5c1f9..5271788f 100644 --- a/src/library/elements.rs +++ b/src/library/elements.rs @@ -25,7 +25,7 @@ pub fn image(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { } } - Value::template("image", move |ctx| { + Value::template(move |ctx| { if let Some(node) = node { ctx.push_into_par(node); } @@ -37,8 +37,8 @@ pub fn rect(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { let width = args.named(ctx, "width"); let height = args.named(ctx, "height"); let fill = args.named(ctx, "fill"); - let body = args.eat::(ctx).unwrap_or_default(); - rect_impl("rect", width, height, None, fill, body) + let body = args.eat(ctx).unwrap_or_default(); + rect_impl(width, height, None, fill, body) } /// `square`: A square with optional content. @@ -47,19 +47,18 @@ pub fn square(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { let width = length.or_else(|| args.named(ctx, "width")); let height = width.is_none().then(|| args.named(ctx, "height")).flatten(); let fill = args.named(ctx, "fill"); - let body = args.eat::(ctx).unwrap_or_default(); - rect_impl("square", width, height, Some(N64::from(1.0)), fill, body) + let body = args.eat(ctx).unwrap_or_default(); + rect_impl(width, height, Some(N64::from(1.0)), fill, body) } fn rect_impl( - name: &str, width: Option, height: Option, aspect: Option, fill: Option, body: TemplateValue, ) -> Value { - Value::template(name, move |ctx| { + Value::template(move |ctx| { let mut stack = ctx.exec_template_stack(&body); stack.aspect = aspect; @@ -82,8 +81,8 @@ pub fn ellipse(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { let width = args.named(ctx, "width"); let height = args.named(ctx, "height"); let fill = args.named(ctx, "fill"); - let body = args.eat::(ctx).unwrap_or_default(); - ellipse_impl("ellipse", width, height, None, fill, body) + let body = args.eat(ctx).unwrap_or_default(); + ellipse_impl(width, height, None, fill, body) } /// `circle`: A circle with optional content. @@ -92,19 +91,18 @@ pub fn circle(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { let width = radius.or_else(|| args.named(ctx, "width")); let height = width.is_none().then(|| args.named(ctx, "height")).flatten(); let fill = args.named(ctx, "fill"); - let body = args.eat::(ctx).unwrap_or_default(); - ellipse_impl("circle", width, height, Some(N64::from(1.0)), fill, body) + let body = args.eat(ctx).unwrap_or_default(); + ellipse_impl(width, height, Some(N64::from(1.0)), fill, body) } fn ellipse_impl( - name: &str, width: Option, height: Option, aspect: Option, fill: Option, body: TemplateValue, ) -> Value { - Value::template(name, move |ctx| { + Value::template(move |ctx| { // This padding ratio ensures that the rectangular padded region fits // perfectly into the ellipse. const PAD: f64 = 0.5 - SQRT_2 / 4.0; -- cgit v1.2.3