Daniel Insley
017c1b5e83
Base64 Decode & Encode Filters ( #1450 )
2021-06-03 13:23:11 -04:00
Dylan Thacker-Smith
cfe1637bdd
Translate RangeError to Liquid::Error for truncatewords with large int ( #1431 )
2021-04-20 11:48:22 -04:00
Dylan Thacker-Smith
dcb5a67089
performance: Use split limit in truncatewords ( #1361 )
2021-02-19 13:11:35 -05:00
Unending
3cae09b968
handle carriage return in newlines_to_br
2021-01-16 18:49:01 +01:00
Dylan Thacker-Smith
065ccbc4aa
Remove support for taint checking
2020-07-23 16:22:46 -04:00
Alessandro Diogo Brückheimer
e83b1e4159
Add ForceEqualSignAlignment to .rubocop.yml ( #1190 )
...
* Add ForceEqualSignAlignment to .rubocop.yml
* Revert ForceEqualSignAlignment cop
* Update method alignment
* Undo addition of whitespace to improve readability
* Fix missing alignment
2019-10-21 21:18:48 +10:00
Mike Angell
2bfeed2b00
Resolve InputIterator dropping context ( #1184 )
...
* Resolve InputIterator dropping context
* Prefer attr_reader
2019-10-09 08:00:16 +11:00
Mike Angell
f1d62978ef
Allow default function to handle false as value ( #1144 )
...
* Allow default function to handle false as value
* Change to named parameter
* Remove redundant freeze
* add brackets to make intention clearer
* Use named param format from liquid
* Update syntax
* document default filter
2019-10-09 04:03:33 +11:00
Mike Angell
b667bcb48b
Shopify stye guide fixes ( #1160 )
2019-09-20 02:08:11 +10:00
Mike Angell
0d26f05bb8
Enabled frozen string literals ( #1154 )
...
* Enabled frozen string literals
* Update rubocop config
* Prefer string interpolation in simple cases
Co-Authored-By: Dylan Thacker-Smith <dylan.smith@shopify.com >
2019-09-18 13:19:45 +10:00
Mike Angell
9a42c8c8b2
Merge pull request #1149 from Shopify/liquid-usage
...
Add usage tracking
2019-09-16 12:14:50 +10:00
Mike Angell
b6547f322e
Simplify usage
2019-09-11 04:56:25 +10:00
Mike Angell
b316ff8413
Add usage tracking
2019-09-11 04:20:34 +10:00
Mike Angell
799da202df
Apply simple rubocop fixes
2019-08-31 21:58:33 +10:00
Ashwin Maroli
d19967a79d
Reduce string allocations from truncate filters
2019-07-22 17:35:45 +05:30
Clayton Smith
e2d9907df2
Validate the character encoding in url_decode.
2019-03-07 14:01:10 -05:00
Justin Li
23d669f5e6
Merge pull request #1032 from printercu/patch-1
...
Single regexp for strip_html
2019-02-22 13:04:04 -05:00
Justin Li
ed73794f82
Preserve existing strip_html behaviour for weird inputs
2019-02-22 13:00:36 -05:00
Ashwin Maroli
f59f6dea83
Fix simple RuboCop offenses and update TODO file ( #1062 )
...
* Fix Layout/EmptyLineAfterMagicComment offense
* Fix Layout/ExtraSpacing offense
* Fix Layout/ClosingParenthesisIndentation offenses
* Fix Style/MutableConstant offense
* Fix Style/UnneededInterpolation offenses
* Fix Style/RedundantParentheses offenses
* Update TODO config for RuboCop
* Add executable bit to test/test_helper.rb
ref: https://travis-ci.org/Shopify/liquid/jobs/488169512#L578
2019-02-22 12:32:56 -05:00
Garland Zhang
cec27ea326
Extract raise error line and some filters with begin/rescue blocks
2019-02-21 17:00:20 -05:00
David Cornu
ca9e75db53
Reduce perceived complexity for #sort and #sort_natural
2018-10-19 14:57:33 -04:00
Samuel Doiron
fd09f049b0
Merge pull request #1026 from Shopify/where-filter
...
Add `where` filter to standard filters
2018-10-11 17:45:30 -04:00
Samuel
842986a972
Add where filter to standard filters
...
Users of Liquid will often wish to filter an array to only those items that match a certain criteria. For example, showing "pinned" messages at the top of a list.
Example usage:
`{{ comments | where: "pinned" | first }}`
or
`{{ products | where: "category", "kitchen" }}`
* Add where filter to standard filters
* Add tests for new where functionality
2018-10-11 16:52:32 -04:00
Justin Li
cd5a6dd225
Merge pull request #930 from er1/fix-sort-natural-on-nil
...
Fix sort and sort_natural on sorting with non-string and nil values
2018-10-04 22:32:37 -04:00
printercu
89c1ba2b0e
Fix rubocop warning
2018-09-27 17:24:01 +03:00
printercu
479d8fb4a4
Single regexp for strip_html
2018-09-27 17:13:35 +03:00
Thibaut Courouble
147d7ae24d
Rename min/max filters for clarity
2017-12-06 09:48:30 -05:00
Thibaut Courouble
282d42f98d
Fix min/max filters
2017-12-06 08:58:05 -05:00
Justin Li
e6ba6ee87b
Revert "Use replacement string for replace filters literally ( #924 )"
...
This reverts commit 27c91203ab .
2017-12-04 15:07:59 -05:00
Nithin Bekal
4bdaaf069f
Add max/min filters
2017-11-30 13:56:37 -05:00
Eric Chan
deb10ebc7a
Sorting support for data with undefined values
2017-09-14 02:00:43 -04:00
Eric Chan
cfe1844de9
Added test coverage for sort_natural
2017-09-13 22:17:59 -04:00
Eric Chan
59950bff87
Fix sort_natural on sorting with non-string values
2017-09-13 01:37:40 -04:00
Dylan Thacker-Smith
27c91203ab
Use replacement string for replace filters literally ( #924 )
2017-08-28 11:51:20 -04:00
Thierry Joyal
e340803d12
CGI powered standard filters to handle non string inputs
2017-05-25 15:53:41 +00:00
Richard Monette
d17f86ba4d
handle join on fixnum
2017-02-01 12:47:35 -05:00
Richard Monette
b2feeacbce
Merge pull request #812 from Shopify/allow-split-to-accept-numeric
...
allow split to accept numeric
2016-10-26 10:59:44 -04:00
Richard Monette
143ba39a08
allow split to accept numeric
2016-10-26 10:43:04 -04:00
Richard Monette
bb3624b799
dont explode when sorting nil property
2016-10-04 13:22:29 -04:00
Konstantin Tennhard
95d5c24bfc
Standard filter truncate: truncate_string string coercion
...
The argument `truncate_string` is now coerced into a string to avoid
`NoMethodError`s. This is mostly for added resiliency. It is doubtful
that someone would actually intent to use a number as truncate string,
but accidentally supplying one is entirely possible.
2016-09-12 12:13:12 -04:00
Konstantin Tennhard
302185a7fc
Standard filter truncatewords: force truncate_string to string
...
Currently, `truncatewords` raises a TypeError when the argument
`truncate_string` is an interger. This PR forces string coercion for any
value provided for this argument. Thus,
```ruby
assert_equal 'one two1', @filters.truncatewords("one two three", 2, 1)
```
holds true. Another option would be to raise a `Liquid::ArgumentError`.
What is preferred?
2016-09-09 16:50:50 -04:00
Florian Weingarten
f93243cc1a
abs filter
2016-04-04 09:32:31 -04:00
Dylan Thacker-Smith
4239c899a4
Raise a Liquid::Error when a non-array is passed into the concat filter.
2016-03-31 15:47:06 -04:00
Justin Li
f2e6adf566
Remove arbitrary send vector
2016-02-01 11:38:40 -05:00
Pat Hawks
7e322f5cf8
Performance improvement: default filter
2016-01-23 23:18:51 -08:00
Guillaume Malette
a32ad449c0
Merge pull request #672 from Shopify/fix-proc-mapping
...
Test mapping over procs
2016-01-06 15:59:53 -05:00
Jonathan Cheatham
b892a73463
Ensure truncate is operating on a string
2015-12-22 19:40:35 -08:00
Guillaume Malette
0b55d09cea
Fix mapping over proc attributes
2015-11-20 13:04:42 -05:00
Tanel Jakobsoo
8d5a907dc8
Fixed issue where "nil" value for "escape" filter breaks rendering
...
Closes #664
2015-11-06 16:32:02 +02:00
Justin Li
8612716129
Remove rescue in unescape filter
2015-10-21 02:01:21 -04:00