Dylan Thacker-Smith
065ccbc4aa
Remove support for taint checking
2020-07-23 16:22:46 -04:00
Feken Baboyan
8541c6be35
make Template override static registers only when the register key is not defined
2020-05-28 09:08:03 -04:00
Dylan Thacker-Smith
81149344a5
Fix ParseTreeVisitorTest for ruby-head
2020-03-31 10:53:46 -04:00
Justin Li
dbaef5e79b
Merge pull request #1180 from Shopify/test-all-filters
...
Test all filters against random data to detect exceptions
2020-01-13 15:52:44 -05:00
Dylan Thacker-Smith
f7ad602bfc
Fix liquid tag nested in outer block
2020-01-09 19:13:13 -05:00
Dylan Thacker-Smith
67eca3f58d
Upgrade rubocop and style guide for ruby 2.7 compatibility
2020-01-09 13:15:34 -05:00
Dylan Thacker-Smith
40c68c9c83
Remove support for taint_mode on ruby versions that don't support it
2019-12-19 11:12:51 -05:00
Mike Angell
57c9cf64eb
Allow render to handle with and for correctly ( #1193 )
...
* Allow render to handle with and for correctly
* code improvements
2019-10-23 04:12:46 +10: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
3784020a8d
[New Feature] Add forloop inside render tag when using for syntax ( #1191 )
...
* Add forloop to render for syntax
* Remove forloop guard
2019-10-17 23:06:13 +10:00
uchoudh
1223444738
Fix flaky tests ( #1186 )
2019-10-12 02:52:07 +11: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
04b800d768
Add support for as in Render and Include tags ( #1181 )
...
* Add support for alias
* Remove duplicate code
* Default to template name
* Improve variable matching
* Extract render_partial
* remove method
2019-10-09 07:59:52 +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
uchoudh
ffadc64f28
Merge pull request #1172 from Shopify/add-liquid-profiling-attr
...
Add liquid profile attributes
2019-10-08 10:49:54 -04:00
Mike Angell
5302f40342
Rubocop fixes ( #1182 )
2019-10-07 17:06:47 +11:00
Mike Angell
b0f8c2c03e
Remove error logging
2019-10-05 01:13:35 +10:00
Mike Angell
37e40673ff
Filter test
2019-10-04 17:00:54 +10:00
uchoudh
fefee4c675
Add liquid profile attributes
...
Attribute testing
Add partial name support
2019-10-03 10:12:39 -04:00
Mike Angell
0db9c56f34
Disable rendering of tag based on register ( #1162 )
...
* Disable rendering of tag based on register
* Improvements to disable tag
* Resolve disbale tag tests
* Test disable_tags register
* disabled_tags is now always avaiable
* Allow multiple tags to be disabled at once
* Move disabled check to block_body
* Code improvements
* Remove redundant nil check
* Improve disabled tag error output
* Improve disable tag API
* Code improvements
* Switch disabled? to not mutate output
* Fix array handling shortcut in disable_tags
2019-09-26 00:18:30 +10: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
Thierry Joyal
1dcad34b06
Merge pull request #1151 from Shopify/invokable-methods-for-enumerable-reject-include
...
Invokable methods for enumerable reject include?
2019-09-16 09:49:40 -04:00
Thierry Joyal
c0ffee5919
Invokable methods for enumerable reject include?
2019-09-12 12:58:51 +00:00
Mike Angell
604d899496
Render tag styling fixes
2019-08-31 22:48:25 +10:00
Mike Angell
799da202df
Apply simple rubocop fixes
2019-08-31 21:58:33 +10:00
Samuel
9672ed5285
Add a new {% render %} tag
...
Example:
```
// the_count.liquid
{{ number }}! Ah ah ah.
// my_template.liquid
{% for number in range (1..3) %}
{% render "the_count", number: number %}
{% endfor %}
Output:
1! Ah ah ah.
2! Ah ah ah.
3! Ah ah ah.
```
The `render` tag is a more strict version of the `include` tag. It is
designed to isolate itself from the parent rendering context both by
creating a new scope (which does not inherit the parent scope) and by
only inheriting "static" registers.
Static registers are those that do not hold mutable state which could
affect rendering. This again helps `render`ed templates remain entirely
separate from their calling context.
Unlike `include`, `render` does not permit specifying the target
template using a variable, only a string literal. For example, this
means that `{% render my_dynamic_template %}` is invalid syntax. This
will make it possible to statically analyze the dependencies between
templates without making Turing angry.
Note that the `static_environment` of a rendered template is inherited, unlike
the scope and regular environment. This environment is immutable from within the
template.
An alternate syntax, which mimics the `{% include ... for %}` tag is
currently in design discussion.
2019-08-29 16:32:05 -04:00
Samuel
d338ccb9a6
Add isolated subcontexts
...
An isolated subcontext inherits the environment, filters,
and static registers of its supercontext, but with a fresh
(isolated) scope.
This will pave the way for adding the `render` tag, which renders
templates in such a subcontext.
2019-08-29 10:27:15 -04:00
Mike Angell
8f68cffdf1
Resolve failing rubocop issues
2019-08-29 00:45:38 +10:00
Tobias Lütke
6eab595fae
Merge pull request #1086 from Shopify/liquid-tag
...
Add {% liquid %} and {% echo %} tags
2019-08-27 15:10:20 -04:00
Florian Weingarten
248c54a386
Merge pull request #1091 from Shopify/rendering-with-less-garbage
...
Rendering with less garbage
2019-07-19 15:53:22 +01:00
Florian Weingarten
9640e77805
render_to_output_buffer
2019-04-23 17:06:29 -04:00
David Cornu
70ed1fc86d
Make sure the limit and offset values are integers
2019-04-23 16:44:37 -04:00
Florian Weingarten
2a1ca3152d
liquid without the garbage
2019-04-22 16:34:31 -04:00
Florian Weingarten
c89ce9c2ed
use bytesize, not length
2019-04-17 18:55:13 +01:00
Justin Li
e6ed804ca5
Fix line number tracking after a non-empty blank token
2019-04-08 18:43:09 -04:00
Justin Li
951abb67ee
Remove {% local %} tag
2019-04-08 18:34:39 -04:00
Justin Li
8d1cd41453
Add {% liquid %}, {% echo %}, and {% local %} tags
2019-04-01 20:08:38 -04:00
Justin Li
39fecd06db
Fix interrupts through includes
2019-03-12 12:18:22 -04:00
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
Stephen Paul Weber (Work)
fe4034ccf9
Merge pull request #1025 from Shopify/traverse-ast
...
Liquid::ParseTreeVisitor
2018-10-18 09:42:56 -04:00
Stephen Paul Weber
8217a8d86c
Add test for the full array structure
2018-10-18 09:39:05 -04:00
Stephen Paul Weber
7d13d88258
s/Traversal/ParseTreeVisitor
2018-10-18 09:38:33 -04:00
Stephen Paul Weber
c11fc656cf
Colocate Traversal classes with classes they traverse
...
This puts all knowledge of the traversal in the same file, and removes
the need for a CASES registry.
2018-10-18 09:37:48 -04:00
Stephen Paul Weber
d789ec4175
Liquid::Traversal
...
This enables traversal over whole document tree.
2018-10-15 10:11:58 -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