Dylan Thacker-Smith
588d407e0b
Fix new changelog entry so it is under unreleased
2022-02-24 09:27:22 -05:00
Dylan Thacker-Smith
50c88fe74d
History.md: Add missing PR number to previous changelog entry
2022-02-24 09:27:10 -05:00
Dylan Thacker-Smith
873ca150ad
Merge remote-tracking branch 'origin/master' into pr-1422
2022-02-24 09:21:08 -05:00
Dylan Thacker-Smith and GitHub
0d5e01ae98
Fix some internal errors in filters from invalid input. ( #1476 )
...
These fixes came from improving the corresponding test, so these might not
actually be causing problems in practice.
2022-02-24 09:17:37 -05:00
Charles-Philippe Clermont and GitHub
15eaa49e48
Merge pull request #1518 from Shopify/fix/kwarg-key-name-liquid-c-inconsistency
...
Fix kwarg parsing inconsistency with Liquid::C
2022-02-14 13:22:12 -05:00
Tobias Lütke and GitHub
91c54c579d
Merge pull request #1477 from Watson1978/performance
...
Increase parsing performance
2022-02-14 12:25:19 -05:00
Charles-P. Clermont
1310c4978d
Fix kwarg parsing inconsistency with Liquid::C
...
Liquid::C parses liquid filter arguments with dashes in them, Liquid does not.
For tags that accept kwargs and dumps them on the HTML tag, this is an important feature.
e.g. {{ ... | image_tag: loading: 'lazy', data-something: 'value!' }}
Without this change, Liquid would incorrectly parse the
`data-something` kwarg as a single argument and would skip over the
invalid characters.
See https://github.com/Shopify/theme-check/issues/539 for more context
2022-02-11 15:10:07 -05:00
shainaraskas and GitHub
3de1db3c3a
Merge pull request #1509 from Shopify/1508-shopify-docs-link
...
Fix Shopify documentation link
2022-01-20 12:06:16 -05:00
Shaina Raskas
03522caaf8
fix Shopify documentation link
2022-01-20 09:40:48 -05:00
Shaina Raskas
7acea2a9c9
Revert "fix Shopify documentation link"
...
This reverts commit d8ef698539 .
2022-01-20 09:37:26 -05:00
Shaina Raskas
d8ef698539
fix Shopify documentation link
2022-01-20 09:27:00 -05:00
Watson
ebdfdb80e5
Detect quoted string using String#{start_with?, end_with?} to reduce Regexp#=== calling
2021-09-26 04:30:49 +09:00
Watson
95e9fa5010
Use String#=~ and Regexp.last_match instead to retrieve the markup content
...
If the first value is only used obtained with String#scan,
it will increase the performance if replace with `String#=~` and `Regexp.last_match`.
### Environment
- MacBook Air (M1, 2020)
- macOS 12.0 beta 7
- Apple M1
- Ruby 3.0.2
### Test code
```ruby
require 'benchmark/ips'
WhitespaceControl = '-'
VariableStart = /\{\{/
VariableEnd = /\}\}/
ContentOfVariable = /\A#{VariableStart}#{WhitespaceControl}?(.*?)#{WhitespaceControl}?#{VariableEnd}\z/om
token = "{{item.product.featured_image | product_img_url: 'thumb' }}"
Benchmark.ips do |x|
x.report("String#scan") { token.scan(ContentOfVariable) {|content| break } }
x.report("String#match") { m = token.match(ContentOfVariable); m[1] }
x.report("String#=~") { token =~ ContentOfVariable; Regexp.last_match(1) }
x.compare!
end
```
### Result
```
Warming up --------------------------------------
String#scan 135.724k i/100ms
String#match 117.397k i/100ms
String#=~ 151.637k i/100ms
Calculating -------------------------------------
String#scan 1.351M (± 0.8%) i/s - 6.786M in 5.021955s
String#match 1.169M (± 1.3%) i/s - 5.870M in 5.020429s
String#=~ 1.520M (± 0.9%) i/s - 7.733M in 5.087427s
Comparison:
String#=~: 1520250.9 i/s
String#scan: 1351399.0 i/s - 1.12x (± 0.00) slower
String#match: 1169384.1 i/s - 1.30x (± 0.00) slower
```
2021-09-26 04:12:53 +09:00
Anders Søgaard
0f17ed01b4
Use rindex again
2021-09-17 08:38:56 +02:00
Anders Søgaard
45f186b4df
Remove string formatter
2021-09-17 08:33:59 +02:00
5187399fd4
Update lib/liquid/standardfilters.rb
...
Co-authored-by: Dylan Thacker-Smith <[email protected] >
2021-09-17 08:26:16 +02:00
Anders Søgaard and GitHub
f17c49776d
Merge branch 'Shopify:master' into master
2021-09-16 19:14:10 +02:00
Anders Søgaard
aead4c5daa
Refactor filter
2021-09-16 19:10:50 +02:00
Anders Søgaard
d81f7f04ce
Add tests to make sure it returns original string on no replacement
2021-09-16 18:42:18 +02:00
Anders Søgaard and GitHub
db3999a008
Improve where filter tests ( #1472 )
2021-09-16 10:02:39 -04:00
Marc-André Cournoyer and GitHub
10e2aa8d5b
Merge pull request #1471 from Shopify/bump-5.1.0
...
Prep for 5.1.0 release
v5.1.0
2021-09-15 15:15:13 -04:00
Anders Søgaard
e3c82a9e4e
Favor unless over if for negative conditions
2021-09-13 18:07:29 +02:00
Anders Søgaard
986391cb7d
start_index will never be -1
2021-09-13 18:00:03 +02:00
7c4114671b
Remove to_liquid_value fixes in changelog
...
Co-authored-by: Dylan Thacker-Smith <[email protected] >
2021-09-13 10:53:46 -04:00
Anders Søgaard
b5abd145e3
Remove default value for replacement argument
2021-09-10 18:02:35 +02:00
Anders Søgaard
f5e77b6d1d
Update test to support third argument
2021-09-10 18:02:23 +02:00
Anders Søgaard
dc7818f371
Update filter to use rindex
2021-09-10 09:55:08 +02:00
Anders Søgaard
f72cfb13ab
Delegate functions to corresponding replace functions
2021-09-10 08:24:50 +02:00
Marc-André Cournoyer
b01de9d325
Prep for 5.1.0 release
2021-09-09 14:28:45 -04:00
Zac Clay and GitHub
a5369c26a8
Add missing quote in comment ( #1468 )
2021-09-09 14:23:11 -04:00
Charles-Philippe Clermont and GitHub
a03de8f9ea
Merge pull request #1470 from Shopify/fix/range-parse-tree-visitor
...
Add ParseTreeVisitor to RangeLookup
2021-09-09 11:39:14 -04:00
Charles-P. Clermont
e86fe27259
Fix lint
2021-09-09 11:22:39 -04:00
Charles-P. Clermont
c8906d05b9
Add ParseTreeVisitor to RangeLookup
2021-09-09 11:22:39 -04:00
Anders Søgaard and GitHub
d5ecf00a8c
Update History.md
2021-09-09 09:28:22 +02:00
Anders Søgaard and GitHub
973aa9f1b5
Merge branch 'Shopify:master' into master
2021-09-09 08:59:07 +02:00
Michael Go and GitHub
50d1a2ffc9
Merge pull request #1458 from Shopify/use-to-liquid-value-with-conditions
...
use Utils.to_liquid_value on conditionals
2021-06-15 12:18:14 -03:00
Michael Go
f686c5dec7
use Utils.to_liquid_value on conditionals
2021-06-14 18:19:37 -03:00
Michael Go and GitHub
aa8ce87b96
Merge pull request #1454 from Shopify/default-filter-with-to-liquid-value
...
utilize input's to_liquid_value on default filter
2021-06-14 15:43:56 -03:00
Peter Zhu and GitHub
698f5e0d96
Merge pull request #1456 from Shopify/pz-psych-4-unsafe-load
...
Fix benchmark for breaking change in Psych 4
2021-06-10 13:14:13 -04:00
Peter Zhu
996bfe0c82
Fix benchmark for breaking change in Psych 4
...
Psych 4 introduces a breaking change (ruby/psych#487 ) where
`Psych#load`/`Psych#load_file` now default to safe loading,
meaning that YAML references are not allowed anymore. This
commit changes the benchmark to use `Psych#unsafe_load_file`
when it's available.
2021-06-10 13:01:16 -04:00
Michael Go and GitHub
be81c9ae5a
Merge pull request #1457 from Shopify/fix-unless-to-use-to-liquid-value-helper
...
fix unless to use to_liquid_value helper with multiple conditions
2021-06-10 14:00:19 -03:00
Michael Go
edd4d70aee
fix unless to use to_liquid_value helper with multiple conditions
2021-06-10 13:28:17 -03:00
Michael Go
ac66dbbafe
utilize input's to_liquid_value on default filter
2021-06-08 15:20:53 -03:00
Daniel Insley and GitHub
017c1b5e83
Base64 Decode & Encode Filters ( #1450 )
2021-06-03 13:23:11 -04:00
Michael Go and GitHub
250555c9a8
Merge pull request #1441 from Shopify/to-raw-value
...
Implement to_liquid_value to Liquid::Drop
2021-05-27 10:21:05 -03:00
Michael Go
e361a4d53c
introduce to_liquid_value on variable look and conditional statements
2021-05-26 17:27:18 -03:00
Dylan Thacker-Smith
b9e0d28729
rubocop: Clarify that a config is a rubocop-shopify backport
2021-04-20 09:01:06 -07:00
Dylan Thacker-Smith
020f6b93c5
rubocop: Fix unsupported ruby version in TargetRubyVersion error
2021-04-20 09:00:20 -07:00
Dylan Thacker-Smith and GitHub
cfe1637bdd
Translate RangeError to Liquid::Error for truncatewords with large int ( #1431 )
2021-04-20 11:48:22 -04:00
Anders Søgaard and ADTC
b3d14e5b49
Update tests
...
Co-Authored-By: ADTC <[email protected] >
2021-04-06 07:34:36 +02:00