Dylan Thacker-Smith
27c91203ab
Use replacement string for replace filters literally ( #924 )
2017-08-28 11:51:20 -04:00
Justin Li
44eaa4b9d8
Merge pull request #920 from Shopify/symbol_to_liquid
...
Support rendering symbols as strings
2017-08-18 12:10:53 -04:00
Pascal Betz
a979b3ec95
Do not raise when variable is defined but nil when using strict_variables
2017-08-18 12:09:57 -04:00
Justin Li
bf3e759da3
Support rendering symbols as strings
2017-08-17 23:10:57 -04:00
Thierry Joyal
e340803d12
CGI powered standard filters to handle non string inputs
2017-05-25 15:53:41 +00:00
Dylan Thacker-Smith
48a6d86ac2
Use stackprof to test to lack of object allocations ( #896 )
2017-05-12 09:20:51 -04:00
Dylan Thacker-Smith
3bb29d5456
Replace assert_equal nil, with a assert_nil ( #895 )
2017-05-11 14:05:03 -04:00
Dylan Thacker-Smith
9c72ccb82f
Limit how much blocks can be nested during parsing ( #894 )
2017-05-11 09:37:53 -04:00
Mike Angell
c9bac9befe
Merge branch 'master' into contains-strict-fix
2017-03-24 11:09:09 +10:00
Lasse Skindstad Ebert
5149cde5c3
Fix include tag used with strict_variables ( #829 )
...
Fixes https://github.com/Shopify/liquid/issues/828
2017-03-22 16:00:31 -04:00
chenxianyu
4318240ae0
test: modify Strainer.add_filter duplicate inclusion test case
2017-02-22 10:33:22 +08:00
chenxianyu
aa79c33dda
fix: Strainer.add_filter method
2017-02-13 15:50:19 +08:00
Richard Monette
d17f86ba4d
handle join on fixnum
2017-02-01 12:47:35 -05:00
Dylan Thacker-Smith
0c58328a40
test: Equality comparison of two hashes ( #850 )
2017-01-16 15:56:38 -05:00
Dylan Thacker-Smith
2bb3552033
Fix internal liquid error when comparing hash with incompatible type ( #849 )
2017-01-16 13:13:17 -05:00
Dylan Thacker-Smith
869dbc7ebf
feature: Allow a default exception renderer to be specified ( #837 )
...
This could be used to preserve the old default of rendering
non-Liquid::Error messages or for providing default behaviour like error
reporting which could be missed if the exception renderer needed to be
specified on each render.
2016-12-12 10:29:09 -05:00
Dylan Thacker-Smith
f27bd619b9
change: Render an opaque internal error by default for non-Liquid::Error ( #835 )
...
These errors may contain sensitive information, so is safer to
render a more vague message by default.
This is done by replacing non-Liquid::Error exceptions with a
Liquid::InternalError exception with the non-Liquid::Error accessible on
through the cause method. This also allows the template name and line
number to be attached to the template errors.
The exception_handler render option has been changed to exception_renderer
since now it should raise an exception to re-raise on a liquid rendering
error or return a string to be rendered where the error occurred.
2016-12-07 17:34:29 -05:00
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
6ed6e7e12f
Allow :id to start with the word contains
2016-08-20 20:32:46 +10: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