summaryrefslogtreecommitdiff
path: root/src/library/insert.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-01-02 19:37:10 +0100
committerLaurenz <laurmaedje@gmail.com>2021-01-02 19:37:10 +0100
commit1c40dc42e7bc7b799b77f06d25414aca59a044ba (patch)
treeea8bdedaebf59f5bc601346b0108236c7264a29d /src/library/insert.rs
parent8cad78481cd52680317032c3bb84cacda5666489 (diff)
Dynamic values, Types, Arrays, and Dictionaries 🚀
- 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
Diffstat (limited to 'src/library/insert.rs')
-rw-r--r--src/library/insert.rs14
1 files changed, 7 insertions, 7 deletions
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<String>>(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::<Spanned<String>>(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();