update: include int option for arg in renderNode
This commit is contained in:
parent
8b36704652
commit
9e1e3c2039
1 changed files with 8 additions and 1 deletions
|
|
@ -163,7 +163,14 @@ pub const Renderer = struct {
|
||||||
for (node.variable.?.filters) |f| {
|
for (node.variable.?.filters) |f| {
|
||||||
const filter_fn = builtin_filters.get(f.name) orelse return error.UnknownFilter;
|
const filter_fn = builtin_filters.get(f.name) orelse return error.UnknownFilter;
|
||||||
|
|
||||||
const arg = if (f.arg) |a| Value{ .string = a } else null;
|
// const arg = if (f.arg) |a| Value{ .string = a } else null;
|
||||||
|
var arg: Value = Value.null;
|
||||||
|
if (f.arg) |a| {
|
||||||
|
arg = Value{ .string = a };
|
||||||
|
const result = try std.fmt.parseInt(i64, a, 10);
|
||||||
|
if (std.math.maxInt(i64) < result) return error.Overflow;
|
||||||
|
arg = Value{ .int = result };
|
||||||
|
}
|
||||||
value = try filter_fn(alloc, value, arg);
|
value = try filter_fn(alloc, value, arg);
|
||||||
|
|
||||||
if (std.mem.eql(u8, f.name, "safe")) is_safe = true;
|
if (std.mem.eql(u8, f.name, "safe")) is_safe = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue