mirror of
https://github.com/jekyll/jekyll.git
synced 2026-02-04 03:35:25 -05:00
Add {{ | jsonify }} support for hashes.
This commit is contained in:
@@ -328,10 +328,14 @@ module Jekyll
|
||||
|
||||
def as_liquid(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
|
||||
item.map{ |i| as_liquid(i) }
|
||||
else
|
||||
item.respond_to?(:to_liquid) ? item.to_liquid : item
|
||||
item.respond_to?(:to_liquid) ? as_liquid(item.to_liquid) : item
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user