curly-templates 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +7 -0
- data/curly-templates.gemspec +1 -1
- data/lib/curly.rb +1 -1
- data/lib/curly/compiler.rb +9 -5
- data/spec/compiler_spec.rb +4 -0
- metadata +2 -2
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:
|
data/curly-templates.gemspec
CHANGED
data/lib/curly.rb
CHANGED
data/lib/curly/compiler.rb
CHANGED
@@ -51,7 +51,11 @@ module Curly
|
|
51
51
|
send("compile_#{type}", value)
|
52
52
|
end
|
53
53
|
|
54
|
-
|
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
|
-
'
|
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
|
-
"
|
89
|
+
"" # Replace the content with an empty string.
|
86
90
|
end
|
87
91
|
|
88
92
|
def compile_comment(comment)
|
89
|
-
"
|
93
|
+
"" # Replace the content with an empty string.
|
90
94
|
end
|
91
95
|
end
|
92
96
|
end
|
data/spec/compiler_spec.rb
CHANGED
@@ -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.
|
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:
|
153
|
+
hash: 658747487634727033
|
154
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
155
|
none: false
|
156
156
|
requirements:
|