add global_filter

add a global filter using a proc
only add one proc and not an array
add tests to make sure the global_filter is applied after native filters
This commit is contained in:
Loren Hale
2015-07-12 16:46:43 +08:00
parent b42d35ff36
commit 0b11b573d9
5 changed files with 49 additions and 15 deletions
+8 -2
View File
@@ -73,10 +73,16 @@ module Liquid
end
def render(context)
@filters.inject(context.evaluate(@name)) do |output, (filter_name, filter_args, filter_kwargs)|
obj = @filters.inject(context.evaluate(@name)) do |output, (filter_name, filter_args, filter_kwargs)|
filter_args = evaluate_filter_expressions(context, filter_args, filter_kwargs)
context.invoke(filter_name, output, *filter_args)
end.tap{ |obj| taint_check(context, obj) }
end
obj = context.apply_global_filter(obj)
taint_check(context, obj)
obj
end
private