liquid 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/liquid/tags/literal.rb +42 -0
  2. metadata +21 -20
  3. data/CHANGELOG +0 -46
  4. data/Rakefile +0 -43
@@ -0,0 +1,42 @@
1
+ module Liquid
2
+
3
+ class Literal < Block
4
+
5
+ # Class methods
6
+
7
+ # Converts a shorthand Liquid literal into its long representation.
8
+ #
9
+ # Currently the Template parser only knows how to handle the long version.
10
+ # So, it always checks if it is in the presence of a literal, in which case it gets converted through this method.
11
+ #
12
+ # Example:
13
+ # Liquid::Literal "{{{ hello world }}}" #=> "{% literal %} hello world {% endliteral %}"
14
+ def self.from_shorthand(literal)
15
+ literal =~ LiteralShorthand ? "{% literal %}#{$1}{% endliteral %}" : literal
16
+ end
17
+
18
+ # Public instance methods
19
+
20
+ def parse(tokens) # :nodoc:
21
+ @nodelist ||= []
22
+ @nodelist.clear
23
+
24
+ while token = tokens.shift
25
+ if token =~ FullToken && block_delimiter == $1
26
+ end_tag
27
+ return
28
+ else
29
+ @nodelist << token
30
+ end
31
+ end
32
+
33
+ # Make sure that its ok to end parsing in the current block.
34
+ # Effectively this method will throw and exception unless the current block is
35
+ # of type Document
36
+ assert_missing_delimitation!
37
+ end # parse
38
+
39
+ end
40
+
41
+ Template.register_tag('literal', Literal)
42
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liquid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 2
9
- - 1
10
- version: 2.2.1
9
+ - 2
10
+ version: 2.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tobias Luetke
@@ -15,12 +15,13 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-23 00:00:00 -04:00
18
+ date: 2010-08-24 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
22
22
  description: A secure, non-evaling end user template engine with aesthetic markup.
23
- email: tobi@leetsoft.com
23
+ email:
24
+ - tobi@leetsoft.com
24
25
  executables: []
25
26
 
26
27
  extensions: []
@@ -30,14 +31,7 @@ extra_rdoc_files:
30
31
  - Manifest.txt
31
32
  - README.md
32
33
  files:
33
- - CHANGELOG
34
- - History.txt
35
- - MIT-LICENSE
36
- - Manifest.txt
37
- - README.md
38
- - Rakefile
39
34
  - lib/extras/liquid_view.rb
40
- - lib/liquid.rb
41
35
  - lib/liquid/block.rb
42
36
  - lib/liquid/condition.rb
43
37
  - lib/liquid/context.rb
@@ -60,17 +54,22 @@ files:
60
54
  - lib/liquid/tags/if.rb
61
55
  - lib/liquid/tags/ifchanged.rb
62
56
  - lib/liquid/tags/include.rb
57
+ - lib/liquid/tags/literal.rb
63
58
  - lib/liquid/tags/unless.rb
64
59
  - lib/liquid/template.rb
65
60
  - lib/liquid/variable.rb
61
+ - lib/liquid.rb
62
+ - MIT-LICENSE
63
+ - README.md
64
+ - History.txt
65
+ - Manifest.txt
66
66
  has_rdoc: true
67
67
  homepage: http://www.liquidmarkup.org
68
68
  licenses: []
69
69
 
70
70
  post_install_message:
71
- rdoc_options:
72
- - --main
73
- - README.md
71
+ rdoc_options: []
72
+
74
73
  require_paths:
75
74
  - lib
76
75
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -87,16 +86,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
86
  requirements:
88
87
  - - ">="
89
88
  - !ruby/object:Gem::Version
90
- hash: 3
89
+ hash: 21
91
90
  segments:
92
- - 0
93
- version: "0"
91
+ - 1
92
+ - 3
93
+ - 7
94
+ version: 1.3.7
94
95
  requirements: []
95
96
 
96
- rubyforge_project: liquid
97
+ rubyforge_project:
97
98
  rubygems_version: 1.3.7
98
99
  signing_key:
99
- specification_version: 2
100
+ specification_version: 3
100
101
  summary: A secure, non-evaling end user template engine with aesthetic markup.
101
102
  test_files: []
102
103
 
data/CHANGELOG DELETED
@@ -1,46 +0,0 @@
1
- * Make context and assign work the same
2
-
3
- * Ruby 1.9.1 bugfixes
4
-
5
- * Fix LiquidView for Rails 2.2. Fix local assigns for all versions of Rails
6
-
7
- * Fixed gem install rake task
8
- * Improve Error encapsulation in liquid by maintaining a own set of exceptions instead of relying on ruby build ins
9
-
10
- * Added If with or / and expressions
11
-
12
- * 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.
13
-
14
- * Added more tags to standard library
15
-
16
- * Added include tag ( like partials in rails )
17
-
18
- * [...] Gazillion of detail improvements
19
-
20
- * Added strainers as filter hosts for better security [Tobias Luetke]
21
-
22
- * Fixed that rails integration would call filter with the wrong "self" [Michael Geary]
23
-
24
- * 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]
25
-
26
- * Removed count helper from standard lib. use size [Tobias Luetke]
27
-
28
- * Fixed bug with string filter parameters failing to tolerate commas in strings. [Paul Hammond]
29
-
30
- * 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]
31
-
32
- {{ 'Typo' | link_to: 'http://typo.leetsoft.com', 'Typo - a modern weblog engine' }}
33
-
34
-
35
- * 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]
36
-
37
- class ProductDrop < Liquid::Drop
38
- def top_sales
39
- Shop.current.products.find(:all, :order => 'sales', :limit => 10 )
40
- end
41
- end
42
- t = Liquid::Template.parse( ' {% for product in product.top_sales %} {{ product.name }} {% endfor %} ' )
43
- t.render('product' => ProductDrop.new )
44
-
45
-
46
- * Added filter parameters support. Example: {{ date | format_date: "%Y" }} [Paul Hammond]
data/Rakefile DELETED
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $:.unshift File.join(File.dirname(__FILE__), 'test') unless $:.include? File.join(File.dirname(__FILE__), 'test')
3
-
4
- require 'rubygems'
5
- require 'rake'
6
- require 'rake/testtask'
7
- require 'rake/gempackagetask'
8
-
9
- task :default => 'test'
10
-
11
- Rake::TestTask.new(:test) do |t|
12
- t.libs << '.' << 'lib' << 'test'
13
- t.pattern = 'test/lib/**/*_test.rb'
14
- t.verbose = false
15
- end
16
-
17
- gemspec = eval(File.read('liquid.gemspec'))
18
- Rake::GemPackageTask.new(gemspec) do |pkg|
19
- pkg.gem_spec = gemspec
20
- end
21
-
22
- desc "build the gem and release it to rubygems.org"
23
- task :release => :gem do
24
- sh "gem push pkg/liquid-#{gemspec.version}.gem"
25
- end
26
-
27
- namespace :profile do
28
-
29
- task :default => [:run]
30
-
31
- desc "Run the liquid profile/perforamce coverage"
32
- task :run do
33
-
34
- ruby "performance/shopify.rb"
35
-
36
- end
37
-
38
- desc "Run KCacheGrind"
39
- task :grind => :run do
40
- system "kcachegrind /tmp/liquid.rubyprof_calltreeprinter.txt"
41
- end
42
-
43
- end