Dylan Thacker-Smith
b146b49f46
fix: Clear the strainer cache when a global filter is added ( #826 )
2016-11-24 10:32:11 -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
64fca66ef5
Merge pull request #797 from Shopify/truncatewords-resiliency
...
Standard filter truncate / truncatewords: force truncate_string to string
2016-09-13 10:43:55 -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
Philibert Dugas
b7ee1a2176
Fixing #697 with better exception
...
When including a template which is not defined, the exception raised is
*undefined method `split` for nil:NilClass*
This occurs for a scenario like the following:
`{% include nil %}`
or
`{% include undefined-var %}`
Making the code raise an argument error to allow better understanding of
the include error
2016-09-12 09:31:59 -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
Michael Angell
e1d40c7d89
Add whitespace control character and associated tests
2016-06-28 09:15:45 +10:00
Gaurav Chande
00f53b16e8
Prevent Range usage in templates from blowing up
2016-06-02 16:38:44 -04:00
Gaurav Chande
5bb211d933
Ensure no tag leakage since registry is global
2016-04-25 11:50:46 -04:00
Gaurav Chande
6adc431a19
Make tag registry enumerable
2016-04-25 11:38:42 -04:00
Florian Weingarten
f93243cc1a
abs filter
2016-04-04 09:32:31 -04:00
Florian Weingarten
1e533a52e7
Merge pull request #735 from Shopify/fix-to-number-for-negative-float-strings
...
Fix to_number filter for negative float strings
2016-03-31 15:52:51 -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
Florian Weingarten
1597f8859f
Fix to_number filter for negative float strings
2016-03-31 09:18:55 -04:00
Florian Weingarten
d2f16d92d6
Fix a bunch of Ruby warnings
2016-03-30 20:42:30 +00:00
Ismael Celis
929c89789f
Test that all maths filters work with duck-typed #to_number
2016-03-30 13:35:09 -03:00
Ismael Celis
d03c4ae8e8
Allow Utils.to_number to work with anything that responds to #to_number
2016-03-30 01:57:21 -03:00
Gaurav Chande
8e6b9d503d
Make Strainer also raise when registered method is overriden as protected
2016-02-24 20:23:49 +00:00
Gaurav Chande
8be38d1795
Strainer#add_filter should raise when registered method is overriden as private
2016-02-24 20:03:17 +00:00
Justin Li
a6fa4c5c38
Merge pull request #691 from urbandictionary/missing_variables_and_filters
...
Merge pull request 691
2016-02-02 23:13:44 -05:00
Ivan Kuznetsov
dadd9b4dd2
Add strict_variables/strict_filters render options to check for undefined variables and filters
2016-02-03 10:49:33 +07:00
Justin Li
198f0aa366
Add test for nested assign score bookkeeping
2016-02-01 13:01:23 -05: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
Florian Weingarten
74cc41ce74
Merge pull request #662 from nickpearson/keep-argument-error-backtrace
...
Keep original stack trace in Liquid::ArgumentError
2015-10-29 15:24:54 +01:00
Nick Pearson
c582023321
Keep original stack trace in Liquid::ArgumentError
2015-10-29 08:15:37 -05:00
Thierry Joyal
ac041c4ad1
Rename before_method as liquid_method_missing
2015-10-28 17:28:19 +00:00
Larry Archer
e6392d1cc1
Tests for new url_decode filter
2015-10-21 01:58:22 -04:00
Marcel M. Cary
4100f8d641
Fix "sort" filter on empty array to return empty array
...
When sorting an empty array with the "sort" filter, it returns nil
instead of []. This confuses subsequent filters in the chain that
expect an array. For example, when followed by the "map" filter, it
produces an array containing one nil element: [nil].
I could special-case the nil return value, but that would be more
cumbersome than making sure "sort" always returns an array.
Add a case to the "sort" method to return [] if the array is empty,
before performing any checks on ary.first that assume a non-empty array.
There is still a danger of returning nil if the first item in the array
is nil and it is non-empty, but I'm not sure how better to handle that
case.
Apply a similar fix to sort_natural, uniq, and compact filters.
2015-09-29 10:24:31 -07:00
Dylan Thacker-Smith
704937bc00
Fix offenses from the new version of rubocop.
2015-09-25 19:34:44 -04:00
Justin Li
affae5ebef
Merge pull request #610 from boobooninja/gf3
...
Merge pull request 610
2015-08-03 20:50:14 -04:00
Akinori MUSHA
a215b70de9
Properly rescue ::ArgumentError in the date filter
2015-07-24 13:35:06 +09:00
Dylan Thacker-Smith
cd0c5e954c
Fix a timezone test failure.
2015-07-23 16:19:59 -04:00
Florian Weingarten
4d6dec9b5a
Fix chained access to multi-dimensional hash
2015-07-17 10:10:00 -04:00
Loren Hale
0b11b573d9
add global_filter
...
add a global filter using a proc
only add one proc and not an array
add tests to make sure the global_filter is applied after native filters
2015-07-12 16:46:43 +08:00
Justin Li
b4e133e26f
Fix regression in range lookup
2015-07-09 13:21:46 -04:00
Dylan Thacker-Smith
cebf75b8d7
Implement line numbers without the Liquid::Token class.
2015-07-08 19:21:59 -04:00
Justin Li
4c1b89e20e
Add regression test for ranges on non-integer types
2015-07-08 17:41:18 -04:00
Dylan Thacker-Smith
80b6ac3bc7
Add taint warnings to the context rather than the template.
2015-07-07 15:53:02 -04:00
Gaurav Chande
3c23cfc167
Add Liquid::Tag#tag_name
2015-07-02 20:18:09 +00:00
Carson Reinke
8385099960
Added "compact" filter
2015-06-15 14:14:28 -04:00
Florian Weingarten
e2323332cd
Run tests with latest liquid/c gem
2015-06-08 18:38:35 +00:00
Florian Weingarten
1e23036b2d
Fix uniq filter with string input
2015-06-04 22:55:03 -04:00
Dylan Thacker-Smith
ad3748af21
Include template name with line numbers in render errors.
2015-06-04 13:44:01 -04:00
Florian Weingarten
5919626da4
Rename 'has_key?' and 'has_interrupt?'
2015-06-04 13:14:46 -04:00
Florian Weingarten
82269e2509
fix a few more rubocop offenses
2015-06-04 13:09:58 -04:00