Skip to content

Commit

Permalink
More little fixes and changed default benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
trishume committed Aug 2, 2013
1 parent 15b53b7 commit 6cde983
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
```

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 also recommended that you use it in the template editors of existing apps to give editors better error messages.

Expand Down
10 changes: 5 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ end

namespace :benchmark do

desc "Run the liquid benchmark"
desc "Run the liquid benchmark with lax parsing"
task :run do
ruby "./performance/benchmark.rb strict"
ruby "./performance/benchmark.rb lax"
end

desc "Run the liquid benchmark with lax parsing"
task :lax do
ruby "./performance/benchmark.rb lax"
desc "Run the liquid benchmark with strict parsing"
task :strict do
ruby "./performance/benchmark.rb strict"
end
end

Expand Down
2 changes: 0 additions & 2 deletions lib/liquid/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ def look(type, ahead = 0)
tok[0] == type
end

# === General Liquid parsing functions ===

def expression
token = @tokens[@p]
if token[0] == :id
Expand Down

0 comments on commit 6cde983

Please sign in to comment.