diff options
| author | MALO <57839069+MDLC01@users.noreply.github.com> | 2023-05-30 10:13:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-30 10:13:27 +0200 |
| commit | 644bbf99145042266ea8cf2890cef5771bd04be4 (patch) | |
| tree | b19aaeb5d9ad95dee18bf182804ca93d6719f1fd /src/eval | |
| parent | b6b6666efdde33a3727955fb2254ba16a886e1d3 (diff) | |
Add `fields` method to content (#1340)
Diffstat (limited to 'src/eval')
| -rw-r--r-- | src/eval/methods.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/eval/methods.rs b/src/eval/methods.rs index 7de3bc20..f57bf84d 100644 --- a/src/eval/methods.rs +++ b/src/eval/methods.rs @@ -81,6 +81,7 @@ pub fn call( "at" => content .at(&args.expect::<EcoString>("field")?, args.named("default")?) .at(span)?, + "fields" => Value::Dict(content.dict()), "location" => content .location() .ok_or("this method can only be called on content returned by query(..)") @@ -332,7 +333,13 @@ pub fn methods_on(type_name: &str) -> &[(&'static str, bool)] { ("starts-with", true), ("trim", true), ], - "content" => &[("func", false), ("has", true), ("at", true), ("location", false)], + "content" => &[ + ("func", false), + ("has", true), + ("at", true), + ("fields", false), + ("location", false), + ], "array" => &[ ("all", true), ("any", true), |
