From 74245cd39698c26be5d80f54e4d1ebb2991d1a0f Mon Sep 17 00:00:00 2001 From: Jake Olney Date: Tue, 12 Jul 2022 18:33:15 -0700 Subject: [PATCH] clarify sort_natural and fix unless syntax --- lib/liquid/standardfilters.rb | 6 +++++- lib/liquid/tags/unless.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/liquid/standardfilters.rb b/lib/liquid/standardfilters.rb index 808c93c2d..ed7136abf 100644 --- a/lib/liquid/standardfilters.rb +++ b/lib/liquid/standardfilters.rb @@ -358,7 +358,11 @@ def sort(input, property = nil) # @liquid_type filter # @liquid_category array # @liquid_summary - # Sorts the items in an array in case-insensitive alphabetical, or numerical, order. + # Sorts the items in an array in case-insensitive alphabetical order. + # @liquid_description + # > Caution: + # > You shouldn't use the `sort_natural` filter to sort numerical values. When comparing items an array, each item is converted to a + # > string, so sorting on numerical values can lead to unexpected results. # @liquid_syntax array | sort_natural # @liquid_return [array[untyped]] def sort_natural(input, property = nil) diff --git a/lib/liquid/tags/unless.rb b/lib/liquid/tags/unless.rb index fd0d1ea73..30c65b0ac 100644 --- a/lib/liquid/tags/unless.rb +++ b/lib/liquid/tags/unless.rb @@ -15,7 +15,7 @@ module Liquid # @liquid_syntax # {% unless condition %} # expression - # {% endif %} + # {% endunless %} # @liquid_syntax_keyword condition The condition to evaluate. # @liquid_syntax_keyword expression The expression to render unless the condition is met. class Unless < If