mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-29 07:05:12 -07:00
More little fixes and changed default benchmark
This commit is contained in:
@@ -62,6 +62,12 @@ Liquid::Template.error_mode = :warn # Adds errors to template.errors but continu
|
|||||||
Liquid::Template.error_mode = :lax # The default mode, accepts almost anything.
|
Liquid::Template.error_mode = :lax # The default mode, accepts almost anything.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you want to set the error mode only on specific templates you can pass `:error_mode` as an option to `parse`:
|
||||||
|
```ruby
|
||||||
|
Liquid::Template.parse(source, :error_mode => :strict)
|
||||||
|
```
|
||||||
|
This is useful for doing things like enabling strict mode only in the theme editor.
|
||||||
|
|
||||||
It is recommended that you enable `:strict` or `:warn` mode on new apps to stop invalid templates from being created.
|
It is recommended that you enable `:strict` or `:warn` mode on new apps to stop invalid templates from being created.
|
||||||
It is also recommended that you use it in the template editors of existing apps to give editors better error messages.
|
It is also recommended that you use it in the template editors of existing apps to give editors better error messages.
|
||||||
|
|
||||||
|
|||||||
@@ -38,14 +38,14 @@ end
|
|||||||
|
|
||||||
namespace :benchmark do
|
namespace :benchmark do
|
||||||
|
|
||||||
desc "Run the liquid benchmark"
|
desc "Run the liquid benchmark with lax parsing"
|
||||||
task :run do
|
task :run do
|
||||||
ruby "./performance/benchmark.rb strict"
|
ruby "./performance/benchmark.rb lax"
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Run the liquid benchmark with lax parsing"
|
desc "Run the liquid benchmark with strict parsing"
|
||||||
task :lax do
|
task :strict do
|
||||||
ruby "./performance/benchmark.rb lax"
|
ruby "./performance/benchmark.rb strict"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ module Liquid
|
|||||||
tok[0] == type
|
tok[0] == type
|
||||||
end
|
end
|
||||||
|
|
||||||
# === General Liquid parsing functions ===
|
|
||||||
|
|
||||||
def expression
|
def expression
|
||||||
token = @tokens[@p]
|
token = @tokens[@p]
|
||||||
if token[0] == :id
|
if token[0] == :id
|
||||||
|
|||||||
Reference in New Issue
Block a user