curly-templates 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ### Unreleased
2
2
 
3
+ ### Curly 0.10.1 (July 11, 2013)
4
+
5
+ * Fix a bug in the compiler that caused some templates to be erroneously HTML
6
+ escaped.
7
+
8
+ *Daniel Schierbeck*
9
+
3
10
  ### Curly 0.10.0 (July 11, 2013)
4
11
 
5
12
  * Allow comments in Curly templates using the `{{! ... }}` syntax:
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'curly-templates'
7
- s.version = '0.10.0'
7
+ s.version = '0.10.1'
8
8
  s.date = '2013-07-11'
9
9
 
10
10
  s.summary = "Free your views!"
data/lib/curly.rb CHANGED
@@ -26,7 +26,7 @@
26
26
  # See Curly::Presenter for more information on presenters.
27
27
  #
28
28
  module Curly
29
- VERSION = "0.10.0"
29
+ VERSION = "0.10.1"
30
30
 
31
31
  # Compiles a Curly template to Ruby code.
32
32
  #
@@ -51,7 +51,11 @@ module Curly
51
51
  send("compile_#{type}", value)
52
52
  end
53
53
 
54
- parts.join(" << ")
54
+ <<-RUBY
55
+ buffer = ActiveSupport::SafeBuffer.new
56
+ #{parts.join("\n")}
57
+ buffer
58
+ RUBY
55
59
  end
56
60
 
57
61
  private
@@ -74,19 +78,19 @@ module Curly
74
78
  RUBY
75
79
  end
76
80
 
77
- 'ERB::Util.html_escape(%s)' % code.strip
81
+ 'buffer.concat(%s)' % code.strip
78
82
  end
79
83
 
80
84
  def compile_text(text)
81
- text.inspect
85
+ 'buffer.safe_concat(%s)' % text.inspect
82
86
  end
83
87
 
84
88
  def compile_comment_line(comment)
85
- "''" # Replace the content with an empty string.
89
+ "" # Replace the content with an empty string.
86
90
  end
87
91
 
88
92
  def compile_comment(comment)
89
- "''" # Replace the content with an empty string.
93
+ "" # Replace the content with an empty string.
90
94
  end
91
95
  end
92
96
  end
@@ -95,6 +95,10 @@ describe Curly::Compiler do
95
95
  evaluate("{{dirty}}").should == "<p>dirty</p>"
96
96
  end
97
97
 
98
+ it "does not escape HTML in the template itself" do
99
+ evaluate("<div>").should == "<div>"
100
+ end
101
+
98
102
  it "removes comments from the output" do
99
103
  evaluate("HELO{{! I'm a comment, yo }}WORLD").should == "HELOWORLD"
100
104
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curly-templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -150,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
150
150
  version: '0'
151
151
  segments:
152
152
  - 0
153
- hash: 4015061898851795676
153
+ hash: 658747487634727033
154
154
  required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  none: false
156
156
  requirements: