Mike Angell
ef13343591
Changes static registers to not be frozen ( #1163 )
...
* Changes static registers to not be frozen
* Add frozen test to static registers
2019-09-20 00:24:48 +10:00
Mike Angell
adb40c41b7
Enable frozen_string_literal
2019-09-18 13:40:07 +10:00
Mike Angell
d8403af515
Reimplementation of Static Registers ( #1157 )
2019-09-18 13:25:55 +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
Mike Angell
9a42c8c8b2
Merge pull request #1149 from Shopify/liquid-usage
...
Add usage tracking
2019-09-16 12:14:50 +10:00
Mike Angell
1fcef2133f
Merge pull request #1143 from Shopify/styling-fixes-1
...
Apply simple rubocop fixes
2019-09-16 12:14:32 +10:00
Mike Angell
d7514b1305
Merge pull request #1137 from Shopify/remove-lazy-stacks
...
Remove lazy load stacks
2019-09-16 12:14:14 +10:00
Thierry Joyal
c0ffee5919
Invokable methods for enumerable reject include?
2019-09-12 12:58:51 +00:00
Mike Angell
724d02e9b3
Disable interrupt fix in this round
2019-09-11 06:35:08 +10:00
Mike Angell
a5b387cdd4
Remove reserved word Interrupt to avoid confusion
...
Also resolves rubocop conflicts
2019-09-11 06:32:31 +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
1f90a37b63
Merge branch 'master' into styling-fixes-1
2019-09-04 14:26:27 +10: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
Mike Angell
dafbb4ae90
Remove hasnling false scopes
2019-08-31 20:03:54 +10:00
Ashwin Maroli
8750b4b006
Reduce allocations from Liquid::Context.new
2019-08-30 09:01:47 +05:30
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
2324564743
Remove lazy load stacks
...
Remove lazy load stacks and instead only create a new scope when a tag is known to need one
2019-08-29 09:09:32 +10:00
Mike Angell
7bae55dd39
Bugfix for new Liquid tag
2019-08-28 23:39:19 +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
Justin Li
831355dfbd
Merge pull request #1117 from ashmaroli/reduce-allocations-template-lookup-class
...
Reduce allocations while registering Liquid tags
2019-08-07 16:37:39 -04:00
Ashwin Maroli
00702d8e63
Use Object.const_get directly
2019-08-07 11:44:53 +05:30
Justin Li
197c058208
Merge pull request #1099 from ashmaroli/stash-types-private-constant
...
Use a private constant to stash token-types
2019-08-06 17:56:56 -04:00
Ashwin Maroli
c2c1497ca8
Reduce allocations while registering Liquid tags
2019-07-22 20:42:37 +05:30
Ashwin Maroli
d19967a79d
Reduce string allocations from truncate filters
2019-07-22 17:35:45 +05:30
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
Ashwin Maroli
2c42447659
Rename constant to SINGLE_TOKEN_EXPRESSION_TYPES
2019-05-17 23:30:24 +05:30
Ashwin Maroli
9ef6f9b642
Freeze mutable object assigned to constant
2019-04-29 23:50:49 +05:30
Ashwin Maroli
4684478e94
Use a private constant to stash token-types
2019-04-29 23:45:45 +05:30
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
7dc488a73b
Simplifications from review
2019-04-09 15:19:47 -04: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
Richard Monette
274f078806
defer hash allocation in parse_filter_expressions
...
add exploration of GC object allocation
remove performance test
can actually remove one more if branch
use named locals to improve readability
2019-03-20 13:20:31 -04:00
Justin Li
f2f467bdbc
v4.0.3
2019-03-12 12:43:48 -04:00
Justin Li
39fecd06db
Fix interrupts through includes
2019-03-12 12:18:22 -04:00
Justin Li
8013df8ca2
v4.0.2
2019-03-08 15:43:46 -05: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
David Cornu
ca9e75db53
Reduce perceived complexity for #sort and #sort_natural
2018-10-19 14:57:33 -04:00