diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb
index 613726fd..0d55e9ba 100644
--- a/lib/jekyll/filters.rb
+++ b/lib/jekyll/filters.rb
@@ -235,13 +235,13 @@ module Jekyll
# Returns the filtered array of objects
def where_exp(input, variable, expression)
return input unless input.is_a?(Enumerable)
- input = input.values if input.is_a?(Hash)
+ input = input.values if input.is_a?(Hash) # FIXME
- c = parse_condition(expression)
+ condition = parse_condition(expression)
@context.stack do
input.select do |object|
@context[variable] = object
- c.evaluate(@context)
+ condition.evaluate(@context)
end
end
end
@@ -388,13 +388,13 @@ module Jekyll
# Parse a string to a Liquid Condition
def parse_condition(exp)
parser = Liquid::Parser.new(exp)
- a = parser.expression
- if op = parser.consume?(:comparison)
- b = parser.expression
- condition = Liquid::Condition.new(a, op, b)
- else
- condition = Liquid::Condition.new(a)
- end
+ left_expr = parser.expression
+ condition =
+ if operator = parser.consume?(:comparison)
+ Liquid::Condition.new(left_expr, operator, parser.expression)
+ else
+ Liquid::Condition.new(left_expr)
+ end
parser.consume(:end_of_string)
condition
diff --git a/site/_docs/templates.md b/site/_docs/templates.md
index cb6a145b..663a060d 100644
--- a/site/_docs/templates.md
+++ b/site/_docs/templates.md
@@ -100,7 +100,7 @@ common tasks easier.
{% raw %}{{ site.members | where_exp:"item",
"item.graduation_year < 2014" }}{% endraw %}
{% raw %}{{ site.members | where_exp:"item",
-"item.projects includes 'foo'" }}{% endraw %}
+"item.projects contains 'foo'" }}{% endraw %}