From 1c40dc42e7bc7b799b77f06d25414aca59a044ba Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 2 Jan 2021 19:37:10 +0100 Subject: =?UTF-8?q?Dynamic=20values,=20Types,=20Arrays,=20and=20Dictionari?= =?UTF-8?q?es=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Identifiers are now evaluated as variables instead of being plain values - Constants like `left` or `bold` are stored as dynamic values containing the respective rust types - We now distinguish between arrays and dictionaries to make things more intuitive (at the cost of a bit more complex parsing) - Spans were removed from collections (arrays, dictionaries), function arguments still have spans for the top-level values to enable good diagnostics --- src/library/insert.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/library/insert.rs') diff --git a/src/library/insert.rs b/src/library/insert.rs index 6f267b7a..587f96dc 100644 --- a/src/library/insert.rs +++ b/src/library/insert.rs @@ -6,14 +6,14 @@ use crate::prelude::*; /// `image`: Insert an image. /// -/// # Positional arguments -/// - Path (`string`): The path to the image file. -/// /// Supports PNG and JPEG files. -pub fn image(mut args: Args, ctx: &mut EvalContext) -> Value { - let path = args.need::<_, Spanned>(ctx, 0, "path"); - let width = args.get::<_, Linear>(ctx, "width"); - let height = args.get::<_, Linear>(ctx, "height"); +/// +/// # Positional arguments +/// - Path to image file: of type `string`. +pub fn image(ctx: &mut EvalContext, args: &mut Args) -> Value { + let path = args.require::>(ctx, "path to image file"); + let width = args.get(ctx, "width"); + let height = args.get(ctx, "height"); if let Some(path) = path { let mut env = ctx.env.borrow_mut(); -- cgit v1.2.3