You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: Cargo.toml
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
[package]
2
2
name = "quickstatic"
3
-
version = "0.1.2"
3
+
version = "0.1.3"
4
4
edition = "2021"
5
5
license = "MIT/Apache-2.0"
6
6
description = "First static site generator build for [Djot](https://djot.net). Optimized for the actual content and not the themes or bells and wistle of the Static site generator"
// Attempt to convert the input to a scalar and then to a string
185
+
let input_str = input.to_value().as_scalar().ok_or_else(|| liquid_core::Error::with_msg("Input is not a scalar value"))?.to_kstr().into_string();
186
+
187
+
// Evaluate the prefix argument and attempt to convert it to a string
188
+
let prefix = self.args.prefix.evaluate(runtime)?.into_owned().as_scalar().ok_or_else(|| liquid_core::Error::with_msg("Prefix is not a scalar value"))?.to_kstr().into_string();
189
+
190
+
// Check if the input string starts with the prefix
191
+
let result = input_str.starts_with(&prefix);
192
+
193
+
// Return the result as a Value
194
+
Ok(Value::scalar(result))
195
+
}
196
+
}
197
+
198
+
199
+
// Equals Filter
200
+
//
201
+
202
+
#[derive(Clone,ParseFilter,FilterReflection)]
203
+
#[filter(
204
+
name = "equals",
205
+
description = "Checks if a string equals a specified value.",
206
+
parameters(EqualsArgs),
207
+
parsed(EqualsFilter)
208
+
)]
209
+
pubstructEquals;
210
+
211
+
#[derive(Debug,FilterParameters)]
212
+
structEqualsArgs{
213
+
#[parameter(description = "The value to compare against", arg_type = "any")]
0 commit comments