diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-03-17 18:43:20 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-03-17 18:43:20 +0100 |
| commit | 59903270dc5a21c65df8a4d88068662287918b4c (patch) | |
| tree | 0ad087fcaa3ad84efe24cf316549655ea9162430 /src/eval/methods.rs | |
| parent | af7fe4d76083c597ec2198a73383b9e3899d75ea (diff) | |
Methods for page and location on queried content
Diffstat (limited to 'src/eval/methods.rs')
| -rw-r--r-- | src/eval/methods.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/eval/methods.rs b/src/eval/methods.rs index 036f7ba2..eef825ff 100644 --- a/src/eval/methods.rs +++ b/src/eval/methods.rs @@ -73,6 +73,8 @@ pub fn call( "func" => Value::Func(content.id().into()), "has" => Value::Bool(content.has(&args.expect::<EcoString>("field")?)), "at" => content.at(&args.expect::<EcoString>("field")?).at(span)?.clone(), + "page" => content.page(&vm.vt).at(span)?.into(), + "location" => content.location(&vm.vt).at(span)?.into(), _ => return missing(), }, @@ -249,7 +251,13 @@ pub fn methods_on(type_name: &str) -> &[(&'static str, bool)] { ("starts-with", true), ("trim", true), ], - "content" => &[("func", false), ("has", true), ("at", true)], + "content" => &[ + ("func", false), + ("has", true), + ("at", true), + ("page", false), + ("location", false), + ], "array" => &[ ("all", true), ("any", true), |
