From 6cde98319fa1593369a181c1b93d1f681276a988 Mon Sep 17 00:00:00 2001 From: Tristan Hume Date: Fri, 2 Aug 2013 15:21:15 -0400 Subject: [PATCH] More little fixes and changed default benchmark --- README.md | 6 ++++++ Rakefile | 10 +++++----- lib/liquid/parser.rb | 2 -- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 78b7394..695e9bb 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/Rakefile b/Rakefile index 6dca0af..40abbfd 100755 --- a/Rakefile +++ b/Rakefile @@ -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 diff --git a/lib/liquid/parser.rb b/lib/liquid/parser.rb index 98870e2..749c1a7 100644 --- a/lib/liquid/parser.rb +++ b/lib/liquid/parser.rb @@ -44,8 +44,6 @@ module Liquid tok[0] == type end - # === General Liquid parsing functions === - def expression token = @tokens[@p] if token[0] == :id