From ccee1b6a55722557206ad3dd8e1ed414a8cdfe1b Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 8 Jun 2014 19:33:37 -0400 Subject: [PATCH 1/2] Try item#to_liquid before looking at the data --- lib/jekyll/filters.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index 3ee63188..679e3bca 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -247,7 +247,9 @@ module Jekyll end def item_property(item, property) - if item.respond_to?(:data) + if item.respond_to?(:to_liquid) + item.to_liquid[property.to_s] + elsif item.respond_to?(:data) item.data[property.to_s] else item[property.to_s] From 50b04cdf922b5b9872c097e18162930f42f3979b Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 8 Jun 2014 19:33:45 -0400 Subject: [PATCH 2/2] Use `raise` instead of logging & aborting --- lib/jekyll/filters.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index 679e3bca..002d926f 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -207,9 +207,8 @@ module Jekyll when nils == "last" order = + 1 else - Jekyll.logger.error "Invalid nils order:", - "'#{nils}' is not a valid nils order. It must be 'first' or 'last'." - exit(1) + raise ArgumentError.new("Invalid nils order: " + + "'#{nils}' is not a valid nils order. It must be 'first' or 'last'.") end input.sort { |apple, orange|