mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Merged last set of changes from original SVN location
This commit is contained in:
@@ -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.
|
* 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.
|
||||||
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
|
* 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]
|
||||||
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' }}
|
{{ '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
|
class ProductDrop < Liquid::Drop
|
||||||
def top_sales
|
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 )
|
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]
|
||||||
|
|||||||
+44
@@ -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]
|
||||||
+6
-1
@@ -1,7 +1,8 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
History.txt
|
||||||
MIT-LICENSE
|
MIT-LICENSE
|
||||||
Manifest.txt
|
Manifest.txt
|
||||||
README
|
README.txt
|
||||||
Rakefile
|
Rakefile
|
||||||
example/server/example_servlet.rb
|
example/server/example_servlet.rb
|
||||||
example/server/liquid_servlet.rb
|
example/server/liquid_servlet.rb
|
||||||
@@ -20,6 +21,7 @@ lib/liquid/errors.rb
|
|||||||
lib/liquid/extensions.rb
|
lib/liquid/extensions.rb
|
||||||
lib/liquid/file_system.rb
|
lib/liquid/file_system.rb
|
||||||
lib/liquid/htmltags.rb
|
lib/liquid/htmltags.rb
|
||||||
|
lib/liquid/module_ex.rb
|
||||||
lib/liquid/standardfilters.rb
|
lib/liquid/standardfilters.rb
|
||||||
lib/liquid/strainer.rb
|
lib/liquid/strainer.rb
|
||||||
lib/liquid/tag.rb
|
lib/liquid/tag.rb
|
||||||
@@ -36,6 +38,7 @@ lib/liquid/tags/unless.rb
|
|||||||
lib/liquid/template.rb
|
lib/liquid/template.rb
|
||||||
lib/liquid/variable.rb
|
lib/liquid/variable.rb
|
||||||
test/block_test.rb
|
test/block_test.rb
|
||||||
|
test/condition_test.rb
|
||||||
test/context_test.rb
|
test/context_test.rb
|
||||||
test/drop_test.rb
|
test/drop_test.rb
|
||||||
test/error_handling_test.rb
|
test/error_handling_test.rb
|
||||||
@@ -47,6 +50,7 @@ test/helper.rb
|
|||||||
test/html_tag_test.rb
|
test/html_tag_test.rb
|
||||||
test/if_else_test.rb
|
test/if_else_test.rb
|
||||||
test/include_tag_test.rb
|
test/include_tag_test.rb
|
||||||
|
test/module_ex_test.rb
|
||||||
test/output_test.rb
|
test/output_test.rb
|
||||||
test/parsing_quirks_test.rb
|
test/parsing_quirks_test.rb
|
||||||
test/regexp_test.rb
|
test/regexp_test.rb
|
||||||
@@ -56,5 +60,6 @@ test/standard_tag_test.rb
|
|||||||
test/statements_test.rb
|
test/statements_test.rb
|
||||||
test/strainer_test.rb
|
test/strainer_test.rb
|
||||||
test/template_test.rb
|
test/template_test.rb
|
||||||
|
test/test_helper.rb
|
||||||
test/unless_else_test.rb
|
test/unless_else_test.rb
|
||||||
test/variable_test.rb
|
test/variable_test.rb
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ require 'rubygems'
|
|||||||
require 'rake'
|
require 'rake'
|
||||||
require 'hoe'
|
require 'hoe'
|
||||||
|
|
||||||
PKG_VERSION = "1.7.0"
|
PKG_VERSION = "1.9.0"
|
||||||
PKG_NAME = "liquid"
|
PKG_NAME = "liquid"
|
||||||
PKG_DESC = "A secure non evaling end user template engine with aesthetic markup."
|
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|
|
Hoe.new(PKG_NAME, PKG_VERSION) do |p|
|
||||||
p.rubyforge_name = PKG_NAME
|
p.rubyforge_name = PKG_NAME
|
||||||
p.summary = PKG_DESC
|
p.summary = PKG_DESC
|
||||||
p.description = nil
|
p.description = PKG_DESC
|
||||||
p.author = "Tobias Luetke"
|
p.author = "Tobias Luetke"
|
||||||
p.email = "[email protected]"
|
p.email = "[email protected]"
|
||||||
p.url = "http://home.leetsoft.com/liquid"
|
p.url = "http://www.liquidmarkup.org"
|
||||||
end
|
end
|
||||||
@@ -96,7 +96,7 @@ module Liquid
|
|||||||
left, right = context[left], context[right]
|
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)
|
if operation.respond_to?(:call)
|
||||||
operation.call(self, left, right)
|
operation.call(self, left, right)
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
module Liquid
|
module Liquid
|
||||||
|
|
||||||
class ContextError < StandardError
|
|
||||||
end
|
|
||||||
|
|
||||||
# Context keeps the variable stack and resolves variables, as well as keywords
|
# Context keeps the variable stack and resolves variables, as well as keywords
|
||||||
#
|
#
|
||||||
# context['variable'] = 'testing'
|
# context['variable'] = 'testing'
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
module Liquid
|
module Liquid
|
||||||
class FilterNotFound < StandardError
|
class Error < ::StandardError; end
|
||||||
end
|
|
||||||
|
class ArgumentError < Error; end
|
||||||
class FileSystemError < StandardError
|
class ContextError < Error; end
|
||||||
end
|
class FilterNotFound < Error; end
|
||||||
|
class FileSystemError < Error; end
|
||||||
|
class StandardError < Error; end
|
||||||
|
class SyntaxError < Error; end
|
||||||
end
|
end
|
||||||
@@ -24,7 +24,7 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.global_filter(filter)
|
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
|
@@filters[filter.name] = filter
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ require File.dirname(__FILE__) + '/helper'
|
|||||||
|
|
||||||
class ErrorDrop < Liquid::Drop
|
class ErrorDrop < Liquid::Drop
|
||||||
def standard_error
|
def standard_error
|
||||||
raise StandardError, 'standard error'
|
raise Liquid::StandardError, 'standard error'
|
||||||
end
|
end
|
||||||
|
|
||||||
def argument_error
|
def argument_error
|
||||||
raise ArgumentError, 'argument error'
|
raise Liquid::ArgumentError, 'argument error'
|
||||||
end
|
end
|
||||||
|
|
||||||
def syntax_error
|
def syntax_error
|
||||||
raise SyntaxError, 'syntax error'
|
raise Liquid::SyntaxError, 'syntax error'
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -59,6 +59,19 @@ class ErrorHandlingTest < Test::Unit::TestCase
|
|||||||
|
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user