Permalink
Browse files

Merged last set of changes from original SVN location

  • Loading branch information...
1 parent 1d64736 commit 7f58cbf82d9a064c191a1e5ca957f1850bbed5fb @tobi tobi committed May 8, 2008
Showing with 95 additions and 33 deletions.
  1. +16 −16 CHANGELOG
  2. +44 −0 History.txt
  3. +6 −1 Manifest.txt
  4. 0 README → README.txt
  5. +3 −3 Rakefile
  6. +1 −1 lib/liquid/condition.rb
  7. +0 −3 lib/liquid/context.rb
  8. +8 −5 lib/liquid/errors.rb
  9. +1 −1 lib/liquid/strainer.rb
  10. +16 −3 test/error_handling_test.rb
View
@@ -1,32 +1,32 @@
-Changelog
+* Fixed gem install rake task
+* Improve Error encapsulation in liquid by maintaining a own set of exceptions instead of relying on ruby build ins
-Added If with or / and expressions
+* Added If with or / and expressions
-Implemented .to_liquid for all objects which can be passed to liquid like Strings Arrays Hashes Numerics and Booleans.
-To export new objects to liquid just implement .to_liquid on them and return objects which themselves have .to_liquid methods.
+* Implemented .to_liquid for all objects which can be passed to liquid like Strings Arrays Hashes Numerics and Booleans. To export new objects to liquid just implement .to_liquid on them and return objects which themselves have .to_liquid methods.
-Added more tags to standard library
+* Added more tags to standard library
-Added include tag ( like partials in rails )
+* Added include tag ( like partials in rails )
-[...] Gazillion of detail improvements
+* [...] Gazillion of detail improvements
-Added strainers as filter hosts for better security [Tobias Luetke]
+* Added strainers as filter hosts for better security [Tobias Luetke]
-Fixed that rails integration would call filter with the wrong "self" [Michael Geary]
+* Fixed that rails integration would call filter with the wrong "self" [Michael Geary]
-Fixed bad error reporting when a filter called a method which doesn't exist. Liquid told you that it couldn't find the
-filter which was obviously misleading [Tobias Luetke]
+* Fixed bad error reporting when a filter called a method which doesn't exist. Liquid told you that it couldn't find the filter which was obviously misleading [Tobias Luetke]
-Removed count helper from standard lib. use size [Tobias Luetke]
+* Removed count helper from standard lib. use size [Tobias Luetke]
-Fixed bug with string filter parameters failing to tolerate commas in strings. [Paul Hammond]
+* Fixed bug with string filter parameters failing to tolerate commas in strings. [Paul Hammond]
-Improved filter parameters. Filter parameters are now context sensitive; Types are resolved according to the rules of the context. Multiple parameters are now separated by the Liquid::ArgumentSeparator: , by default [Paul Hammond]
+* Improved filter parameters. Filter parameters are now context sensitive; Types are resolved according to the rules of the context. Multiple parameters are now separated by the Liquid::ArgumentSeparator: , by default [Paul Hammond]
+
{{ 'Typo' | link_to: 'http://typo.leetsoft.com', 'Typo - a modern weblog engine' }}
-Added Liquid::Drop. A base class which you can use for exporting proxy objects to liquid which can acquire more data when used in liquid. [Tobias Luetke]
+* Added Liquid::Drop. A base class which you can use for exporting proxy objects to liquid which can acquire more data when used in liquid. [Tobias Luetke]
class ProductDrop < Liquid::Drop
def top_sales
@@ -37,4 +37,4 @@ Added Liquid::Drop. A base class which you can use for exporting proxy objects t
t.render('product' => ProductDrop.new )
-Added filter parameters support. Example: {{ date | format_date: "%Y" }} [Paul Hammond]
+* Added filter parameters support. Example: {{ date | format_date: "%Y" }} [Paul Hammond]
View
@@ -0,0 +1,44 @@
+1.9.0 / 2008-03-04
+
+* Fixed gem install rake task
+* Improve Error encapsulation in liquid by maintaining a own set of exceptions instead of relying on ruby build ins
+
+Before 1.9.0
+
+* Added If with or / and expressions
+
+* Implemented .to_liquid for all objects which can be passed to liquid like Strings Arrays Hashes Numerics and Booleans. To export new objects to liquid just implement .to_liquid on them and return objects which themselves have .to_liquid methods.
+
+* Added more tags to standard library
+
+* Added include tag ( like partials in rails )
+
+* [...] Gazillion of detail improvements
+
+* Added strainers as filter hosts for better security [Tobias Luetke]
+
+* Fixed that rails integration would call filter with the wrong "self" [Michael Geary]
+
+* Fixed bad error reporting when a filter called a method which doesn't exist. Liquid told you that it couldn't find the filter which was obviously misleading [Tobias Luetke]
+
+* Removed count helper from standard lib. use size [Tobias Luetke]
+
+* Fixed bug with string filter parameters failing to tolerate commas in strings. [Paul Hammond]
+
+* Improved filter parameters. Filter parameters are now context sensitive; Types are resolved according to the rules of the context. Multiple parameters are now separated by the Liquid::ArgumentSeparator: , by default [Paul Hammond]
+
+ {{ 'Typo' | link_to: 'http://typo.leetsoft.com', 'Typo - a modern weblog engine' }}
+
+
+* Added Liquid::Drop. A base class which you can use for exporting proxy objects to liquid which can acquire more data when used in liquid. [Tobias Luetke]
+
+ class ProductDrop < Liquid::Drop
+ def top_sales
+ Shop.current.products.find(:all, :order => 'sales', :limit => 10 )
+ end
+ end
+ t = Liquid::Template.parse( ' {% for product in product.top_sales %} {{ product.name }} {% endfor %} ' )
+ t.render('product' => ProductDrop.new )
+
+
+* Added filter parameters support. Example: {{ date | format_date: "%Y" }} [Paul Hammond]
View
@@ -1,7 +1,8 @@
CHANGELOG
+History.txt
MIT-LICENSE
Manifest.txt
-README
+README.txt
Rakefile
example/server/example_servlet.rb
example/server/liquid_servlet.rb
@@ -20,6 +21,7 @@ lib/liquid/errors.rb
lib/liquid/extensions.rb
lib/liquid/file_system.rb
lib/liquid/htmltags.rb
+lib/liquid/module_ex.rb
lib/liquid/standardfilters.rb
lib/liquid/strainer.rb
lib/liquid/tag.rb
@@ -36,6 +38,7 @@ lib/liquid/tags/unless.rb
lib/liquid/template.rb
lib/liquid/variable.rb
test/block_test.rb
+test/condition_test.rb
test/context_test.rb
test/drop_test.rb
test/error_handling_test.rb
@@ -47,6 +50,7 @@ test/helper.rb
test/html_tag_test.rb
test/if_else_test.rb
test/include_tag_test.rb
+test/module_ex_test.rb
test/output_test.rb
test/parsing_quirks_test.rb
test/regexp_test.rb
@@ -56,5 +60,6 @@ test/standard_tag_test.rb
test/statements_test.rb
test/strainer_test.rb
test/template_test.rb
+test/test_helper.rb
test/unless_else_test.rb
test/variable_test.rb
View
File renamed without changes.
View
@@ -3,7 +3,7 @@ require 'rubygems'
require 'rake'
require 'hoe'
-PKG_VERSION = "1.7.0"
+PKG_VERSION = "1.9.0"
PKG_NAME = "liquid"
PKG_DESC = "A secure non evaling end user template engine with aesthetic markup."
@@ -17,8 +17,8 @@ end
Hoe.new(PKG_NAME, PKG_VERSION) do |p|
p.rubyforge_name = PKG_NAME
p.summary = PKG_DESC
- p.description = nil
+ p.description = PKG_DESC
p.author = "Tobias Luetke"
p.email = "tobi@leetsoft.com"
- p.url = "http://home.leetsoft.com/liquid"
+ p.url = "http://www.liquidmarkup.org"
end
View
@@ -96,7 +96,7 @@ def interpret_condition(left, right, op, context)
left, right = context[left], context[right]
- operation = self.class.operators[op] || raise(ArgumentError.new("Error in tag '#{name}' - Unknown operator #{op}"))
+ operation = self.class.operators[op] || raise(ArgumentError.new("Unknown operator #{op}"))
if operation.respond_to?(:call)
operation.call(self, left, right)
View
@@ -1,8 +1,5 @@
module Liquid
- class ContextError < StandardError
- end
-
# Context keeps the variable stack and resolves variables, as well as keywords
#
# context['variable'] = 'testing'
View
@@ -1,7 +1,10 @@
module Liquid
- class FilterNotFound < StandardError
- end
-
- class FileSystemError < StandardError
- end
+ class Error < ::StandardError; end
+
+ class ArgumentError < Error; end
+ class ContextError < Error; end
+ class FilterNotFound < Error; end
+ class FileSystemError < Error; end
+ class StandardError < Error; end
+ class SyntaxError < Error; end
end
View
@@ -24,7 +24,7 @@ def initialize(context)
end
def self.global_filter(filter)
- raise StandardError, "Passed filter is not a module" unless filter.is_a?(Module)
+ raise ArgumentError, "Passed filter is not a module" unless filter.is_a?(Module)
@@filters[filter.name] = filter
end
@@ -4,15 +4,15 @@
class ErrorDrop < Liquid::Drop
def standard_error
- raise StandardError, 'standard error'
+ raise Liquid::StandardError, 'standard error'
end
def argument_error
- raise ArgumentError, 'argument error'
+ raise Liquid::ArgumentError, 'argument error'
end
def syntax_error
- raise SyntaxError, 'syntax error'
+ raise Liquid::SyntaxError, 'syntax error'
end
end
@@ -59,6 +59,19 @@ def test_argument
end
+ def test_unrecognized_operator
+
+ assert_nothing_raised do
+
+ template = Liquid::Template.parse(' {% if 1 =! 2 %}ok{% endif %} ')
+ assert_equal ' Liquid error: Unknown operator =! ', template.render
+
+ assert_equal 1, template.errors.size
+ assert_equal Liquid::ArgumentError, template.errors.first.class
+
+ end
+
+ end
end

0 comments on commit 7f58cbf

Please sign in to comment.