Add {{ | jsonify }} support for hashes.

This commit is contained in:
Parker Moore 2014-11-05 11:37:34 -08:00
parent 774c65a869
commit 9a15a09028
1 changed files with 5 additions and 1 deletions

View File

@ -328,10 +328,14 @@ module Jekyll
def as_liquid(item) def as_liquid(item)
case item case item
when String, Numeric, nil
item.to_liquid
when Hash
Hash[item.map { |k, v| [as_liquid(k), as_liquid(v)] }]
when Array when Array
item.map{ |i| as_liquid(i) } item.map{ |i| as_liquid(i) }
else else
item.respond_to?(:to_liquid) ? item.to_liquid : item item.respond_to?(:to_liquid) ? as_liquid(item.to_liquid) : item
end end
end end
end end