liquid 5.8.1 → 5.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/liquid/standardfilters.rb +22 -4
- data/lib/liquid/tags/doc.rb +6 -2
- data/lib/liquid/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f97ab28ad2792ea056687b9879110d166b0617add41fdf3f590e3b90bfbf176
|
4
|
+
data.tar.gz: 97361f583e5ac620bc70a195c92dea7346174a77928e365dc787ed99e576209e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1afca81c6258b41da81eed6757992df8e68a5df0222a91fbd9754595bc824e1f5d7a40dccdc3aef1e554084eb21b92d99b9c8f03334d1fd830d15381bd5539d4
|
7
|
+
data.tar.gz: d87c729523f2b1d31c7e509570a6e0becb0679d80292afedc2f9bf5278883ef748c107fb705b2dd11af21a5f7fc18423c7b08573032ef6062ecb24af37bf4c03
|
@@ -387,6 +387,7 @@ module Liquid
|
|
387
387
|
end
|
388
388
|
elsif ary.all? { |el| el.respond_to?(:[]) }
|
389
389
|
begin
|
390
|
+
property = Utils.to_s(property)
|
390
391
|
ary.sort { |a, b| nil_safe_compare(a[property], b[property]) }
|
391
392
|
rescue TypeError
|
392
393
|
raise_property_error(property)
|
@@ -416,6 +417,7 @@ module Liquid
|
|
416
417
|
end
|
417
418
|
elsif ary.all? { |el| el.respond_to?(:[]) }
|
418
419
|
begin
|
420
|
+
property = Utils.to_s(property)
|
419
421
|
ary.sort { |a, b| nil_safe_casecmp(a[property], b[property]) }
|
420
422
|
rescue TypeError
|
421
423
|
raise_property_error(property)
|
@@ -503,6 +505,7 @@ module Liquid
|
|
503
505
|
elsif ary.empty? # The next two cases assume a non-empty array.
|
504
506
|
[]
|
505
507
|
else
|
508
|
+
property = Utils.to_s(property)
|
506
509
|
ary.uniq do |item|
|
507
510
|
item[property]
|
508
511
|
rescue TypeError
|
@@ -534,6 +537,7 @@ module Liquid
|
|
534
537
|
# @liquid_syntax array | map: string
|
535
538
|
# @liquid_return [array[untyped]]
|
536
539
|
def map(input, property)
|
540
|
+
property = Utils.to_s(property)
|
537
541
|
InputIterator.new(input, context).map do |e|
|
538
542
|
e = e.call if e.is_a?(Proc)
|
539
543
|
|
@@ -563,6 +567,7 @@ module Liquid
|
|
563
567
|
elsif ary.empty? # The next two cases assume a non-empty array.
|
564
568
|
[]
|
565
569
|
else
|
570
|
+
property = Liquid::Utils.to_s(property)
|
566
571
|
ary.reject do |item|
|
567
572
|
item[property].nil?
|
568
573
|
rescue TypeError
|
@@ -712,7 +717,16 @@ module Liquid
|
|
712
717
|
input.gsub(/\r?\n/, "<br />\n")
|
713
718
|
end
|
714
719
|
|
715
|
-
#
|
720
|
+
# @liquid_public_docs
|
721
|
+
# @liquid_type filter
|
722
|
+
# @liquid_category date
|
723
|
+
# @liquid_summary
|
724
|
+
# Formats a date according to a specified format string.
|
725
|
+
# @liquid_description
|
726
|
+
# This filter formats a date using various format specifiers. If the format string is empty,
|
727
|
+
# the original input is returned. If the input cannot be converted to a date, the original input is returned.
|
728
|
+
#
|
729
|
+
# The following format specifiers can be used:
|
716
730
|
#
|
717
731
|
# %a - The abbreviated weekday name (``Sun'')
|
718
732
|
# %A - The full weekday name (``Sunday'')
|
@@ -741,8 +755,8 @@ module Liquid
|
|
741
755
|
# %Y - Year with century
|
742
756
|
# %Z - Time zone name
|
743
757
|
# %% - Literal ``%'' character
|
744
|
-
#
|
745
|
-
#
|
758
|
+
# @liquid_syntax date | date: string
|
759
|
+
# @liquid_return [string]
|
746
760
|
def date(input, format)
|
747
761
|
str_format = Utils.to_s(format)
|
748
762
|
return input if str_format.empty?
|
@@ -943,6 +957,8 @@ module Liquid
|
|
943
957
|
# @liquid_syntax array | sum
|
944
958
|
# @liquid_return [number]
|
945
959
|
def sum(input, property = nil)
|
960
|
+
property = property.nil? ? nil : Utils.to_s(property)
|
961
|
+
|
946
962
|
ary = InputIterator.new(input, context)
|
947
963
|
return 0 if ary.empty?
|
948
964
|
|
@@ -970,8 +986,10 @@ module Liquid
|
|
970
986
|
attr_reader :context
|
971
987
|
|
972
988
|
def filter_array(input, property, target_value, default_value = [], &block)
|
973
|
-
|
989
|
+
property = Liquid::Utils.to_s(property)
|
990
|
+
return default_value if property.empty?
|
974
991
|
|
992
|
+
ary = InputIterator.new(input, context)
|
975
993
|
return default_value if ary.empty?
|
976
994
|
|
977
995
|
block.call(ary) do |item|
|
data/lib/liquid/tags/doc.rb
CHANGED
@@ -13,12 +13,16 @@ module Liquid
|
|
13
13
|
# Liquid code inside will be parsed but not executed. This facilitates
|
14
14
|
# tooling support for features like code completion, linting, and inline
|
15
15
|
# documentation.
|
16
|
+
#
|
17
|
+
# For detailed documentation syntax and examples, see the
|
18
|
+
# [`LiquidDoc` reference](/docs/storefronts/themes/tools/liquid-doc).
|
19
|
+
#
|
16
20
|
# @liquid_syntax
|
17
21
|
# {% doc %}
|
18
22
|
# Renders a message.
|
19
23
|
#
|
20
|
-
# @param {string} foo - A
|
21
|
-
# @param {string} [bar] - An optional
|
24
|
+
# @param {string} foo - A string value.
|
25
|
+
# @param {string} [bar] - An optional string value.
|
22
26
|
#
|
23
27
|
# @example
|
24
28
|
# {% render 'message', foo: 'Hello', bar: 'World' %}
|
data/lib/liquid/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: liquid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.8.
|
4
|
+
version: 5.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Lütke
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-03-19 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: strscan
|
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: 1.3.7
|
161
161
|
requirements: []
|
162
|
-
rubygems_version: 3.6.
|
162
|
+
rubygems_version: 3.6.6
|
163
163
|
specification_version: 4
|
164
164
|
summary: A secure, non-evaling end user template engine with aesthetic markup.
|
165
165
|
test_files: []
|