Commit Graph
1255 Commits
Author SHA1 Message Date
Stephen Paul Weber 7d13d88258 s/Traversal/ParseTreeVisitor 2018-10-18 09:38:33 -04:00
Stephen Paul Weber ff727016ef s/callback_for/add_callback_for 2018-10-18 09:37:48 -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 DoironandGitHub fd09f049b0 Merge pull request #1026 from Shopify/where-filter
Add `where` filter to standard filters
2018-10-11 17:45:30 -04:00
Samuel 842986a972 Add where filter to standard filters
Users of Liquid will often wish to filter an array to only those items that match a certain criteria. For example, showing "pinned" messages at the top of a list.

Example usage:

`{{ comments | where: "pinned" | first }}`

or

`{{ products | where: "category", "kitchen" }}`

* Add where filter to standard filters
* Add tests for new where functionality
2018-10-11 16:52:32 -04:00
Florian Weingarten 4661700a97 bump to v4.0.1 v4.0.1 2018-10-09 11:13:19 +02:00
Justin LiandGitHub cd5a6dd225 Merge pull request #930 from er1/fix-sort-natural-on-nil
Fix sort and sort_natural on sorting with non-string and nil values
2018-10-04 22:32:37 -04:00
printercuandGitHub 89c1ba2b0e Fix rubocop warning 2018-09-27 17:24:01 +03:00
printercuandGitHub 479d8fb4a4 Single regexp for strip_html 2018-09-27 17:13:35 +03:00
Justin Li 2f0a2c66f3 Add sort_numeric filter 2018-09-13 17:16:50 -04:00
Justin LiandGitHub 53b8babf52 Merge pull request #1027 from Shopify/rubocop-fix
Update deprecated rubocop name
2018-09-13 17:16:36 -04:00
Justin Li 76b4920d3e Update deprecated rubocop name 2018-09-13 17:15:32 -04:00
Justin LiandGitHub 8dcc319128 Merge pull request #1024 from koic/suppress_warning_bigdecimal_new
Suppress warning: `BigDecimal.new` is deprecated
2018-09-09 08:28:24 -04:00
Koichi ITO 0b36461d80 Suppress warning: BigDecimal.new is deprecated
## Summary

`BigDecimal.new` is deprecated since BigDecimal 1.3.3 for Ruby 2.5.

This PR suppresses the following warnings.

```console
% ruby -v
ruby 2.6.0dev (2018-09-06 trunk 64648) [x86_64-darwin17]
% RUBYOPT=-w bundle exec rake
(snip)
/Users/koic/src/github.com/Shopify/liquid/lib/liquid/utils.rb:49:
warning: BigDecimal.new is deprecated; use Kernel.BigDecimal method
instead.
/Users/koic/src/github.com/Shopify/liquid/lib/liquid/utils.rb:53:
warning: BigDecimal.new is deprecated; use Kernel.BigDecimal method
instead.
```

## Other Information

The following is a change of BigDecimal 1.3.3 for Ruby 2.5 related to this PR.

- https://github.com/ruby/bigdecimal/commit/533737338db915b00dc7168c3602e4b462b23503
- https://github.com/ruby/bigdecimal/commit/16738ad0aca158d3c70123990d8caa5789818177
2018-09-09 21:10:20 +09:00
Justin LiandGitHub 70e75719de Merge pull request #1010 from Shopify/circle-ci-remove-38409b
Goodbye CircleCI 👋
2018-05-15 10:53:51 -04:00
shopify-admins b037b19688 Removing CircleCI 1.0 [ci skip] 2018-05-15 10:35:38 -04:00
Florian WeingartenandGitHub d0f77f6cf4 Merge pull request #1006 from Benhgift/master
add installation instruction
2018-04-26 18:20:02 +01:00
Ben Gift 0be260bc97 add installation instruction 2018-04-26 08:12:47 -07:00
Dylan Thacker-SmithandGitHub 5f0b64cebc Merge pull request #1005 from christopheraue/render_refactor
Refactored and optimized rendering
2018-04-19 16:44:57 -04:00
Christopher Aue c086017bc9 refactored and optimized rendering
Measures:
1) A while loop is faster than iterating with #each.
2) Check string, variable and block tokens first. They are far more
   frequent than interrupt tokens. In their case, checking for an
   interrupt can be avoided.
3) String tokens just map to themselves and don't need the special
   treatment of BlockBody#render_node (except the resource limit
   check).

Benchmark
=========

$ bundle exec rake benchmark:run

Before
------

Run 1)
              parse:     41.630  (± 0.0%) i/s -    420.000  in  10.089309s
             render:     75.962  (± 3.9%) i/s -    763.000  in  10.066823s
     parse & render:     25.497  (± 0.0%) i/s -    256.000  in  10.040862s

Run 2)
              parse:     42.130  (± 0.0%) i/s -    424.000  in  10.064738s
             render:     77.003  (± 1.3%) i/s -    777.000  in  10.093524s
     parse & render:     25.739  (± 0.0%) i/s -    258.000  in  10.024581s

Run 3)
              parse:     41.976  (± 2.4%) i/s -    420.000  in  10.021406s
             render:     76.184  (± 1.3%) i/s -    763.000  in  10.018104s
     parse & render:     25.641  (± 0.0%) i/s -    258.000  in  10.062549s

After
-----

Run 1)
              parse:     42.283  (± 0.0%) i/s -    424.000  in  10.028306s
             render:     83.158  (± 2.4%) i/s -    832.000  in  10.009201s
     parse & render:     26.417  (± 0.0%) i/s -    266.000  in  10.069718s

Run 2)
              parse:     41.159  (± 4.9%) i/s -    412.000  in  10.031297s
             render:     81.591  (± 3.7%) i/s -    816.000  in  10.018225s
     parse & render:     25.924  (± 3.9%) i/s -    260.000  in  10.035653s

Run 3)
              parse:     42.418  (± 2.4%) i/s -    424.000  in  10.003100s
             render:     84.183  (± 2.4%) i/s -    847.000  in  10.069781s
     parse & render:     26.726  (± 0.0%) i/s -    268.000  in  10.029857s
2018-04-19 12:10:15 +02:00
Dylan Thacker-SmithandGitHub 4369fe6c85 Improve the unexpected end delimiter message for block tags. (#1003) 2018-04-05 11:18:13 -04:00
Justin LiandGitHub c118e6b435 Merge pull request #992 from ashmaroli/each-without-index
Replace unnecessary Array#each_with_index with Array#each
2018-03-16 14:28:05 -04:00
Ashwin Maroli 0fbaf873d9 replace unnecessary #each_with_index with #each 2018-03-16 14:31:43 +05:30
Justin LiandGitHub 5980ddbfae Merge pull request #988 from ashmaroli/regex-to-constant
Assign regexps to constants
2018-03-14 16:49:17 -04:00
Ashwin Maroli 193fc0fb7a revert to earlier regex for matching floats 2018-03-14 07:02:04 +05:30
Ashwin Maroli e4da4d49d2 assign regex to a constant 2018-03-13 23:36:56 +05:30
Justin LiandGitHub a0bec1f873 Merge pull request #981 from nicolasleger/patch-1
[CI] Test against Ruby 2.5 version
2018-03-05 11:23:18 -05:00
Nicolas LegerandGitHub 4aa3261518 [CI] Test against Ruby 2.5 version 2018-02-12 00:23:06 +01:00
Dylan Thacker-Smith 04d552fabb Gemfile: Use https rather than git protocol to fetch liquid-c 2018-02-01 07:08:19 -05:00
Dylan Thacker-SmithandGitHub 5106466a2d Add a regression test for a liquid-c trim mode bug (#972) 2018-01-25 10:55:01 -05:00
Justin LiandGitHub 5d6c1ed7c6 Merge pull request #963 from lostapathy/patch-1
have travis test against ruby 2.4
2017-12-15 16:53:26 -05:00
Joe FrancisandGitHub a594653a0c have travis test against ruby 2.4 2017-12-15 14:27:17 -06:00
Thibaut CouroubleandGitHub 0c802aba17 Merge pull request #958 from Shopify/minmax
Rename min/max filters for clarity
2017-12-06 11:41:12 -05:00
Thibaut Courouble 147d7ae24d Rename min/max filters for clarity 2017-12-06 09:48:30 -05:00
Thibaut Courouble 282d42f98d Fix min/max filters 2017-12-06 08:58:05 -05:00
Justin Li e6ba6ee87b Revert "Use replacement string for replace filters literally (#924)"
This reverts commit 27c91203ab.
2017-12-04 15:07:59 -05:00
Nithin BekalandGitHub 2ad7a37d44 Merge pull request #954 from Shopify/max-min-filters
Add max and min filters
2017-11-30 14:18:43 -05:00
Nithin Bekal 4bdaaf069f Add max/min filters 2017-11-30 13:56:37 -05:00
Justin LiandGitHub 85b1e91aed Merge pull request #952 from Shopify/bump-rubocop
Bump rubocop
2017-11-22 12:44:36 -05:00
Justin Li a7c5e247c8 Bump rubocop 2017-11-22 11:59:06 -05:00
Dylan Thacker-SmithandGitHub 6c117fd7dd refactor: Reduce maximum block nesting in Liquid::BlockBody#parse (#944) 2017-10-19 10:12:40 -04:00
Maxime BedardandGitHub 7d2d90d715 Merge pull request #932 from Shopify/avoid-default-values-hash
Avoid hash with default values due to inconsistent marshaling
2017-10-17 16:02:45 -04:00
Maxime Bedard f761d21215 Use {} notation 2017-09-20 09:48:23 -04:00
Maxime Bedard a796c17f8b Avoid hash with default values due to inconsistent marshalling 2017-09-19 16:23:14 -04:00
Eric Chan deb10ebc7a Sorting support for data with undefined values 2017-09-14 02:00:43 -04:00
Eric Chan cfe1844de9 Added test coverage for sort_natural 2017-09-13 22:17:59 -04:00
Eric Chan 59950bff87 Fix sort_natural on sorting with non-string values 2017-09-13 01:37:40 -04:00
Dylan Thacker-SmithandGitHub 27c91203ab Use replacement string for replace filters literally (#924) 2017-08-28 11:51:20 -04:00
Justin LiandGitHub 44eaa4b9d8 Merge pull request #920 from Shopify/symbol_to_liquid
Support rendering symbols as strings
2017-08-18 12:10:53 -04:00