temple 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -0
- data/lib/temple/generators.rb +1 -1
- data/lib/temple/html/pretty.rb +1 -1
- data/lib/temple/version.rb +1 -1
- data/test/html/test_pretty.rb +1 -1
- data/test/test_generator.rb +3 -3
- metadata +2 -2
data/CHANGES
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
master
|
2
2
|
|
3
|
+
* Don't modify strings destructively with gsub! in HTML::Pretty.
|
4
|
+
This doesn't work with Rails safe buffers in version >= 3.0.8.
|
5
|
+
|
6
|
+
0.3.0
|
7
|
+
|
3
8
|
* Compiled expression dispatching
|
4
9
|
* Method temple_dispatch is obsolete
|
5
10
|
* EscapeHTML renamed to Escapable
|
data/lib/temple/generators.rb
CHANGED
@@ -118,7 +118,7 @@ module Temple
|
|
118
118
|
#
|
119
119
|
# @api public
|
120
120
|
class RailsOutputBuffer < StringBuffer
|
121
|
-
set_default_options :buffer_class => '
|
121
|
+
set_default_options :buffer_class => 'ActiveSupport::SafeBuffer',
|
122
122
|
:buffer => '@output_buffer',
|
123
123
|
:capture_generator => RailsOutputBuffer
|
124
124
|
|
data/lib/temple/html/pretty.rb
CHANGED
@@ -35,7 +35,7 @@ module Temple
|
|
35
35
|
tmp = unique_name
|
36
36
|
[:multi,
|
37
37
|
[:code, "#{tmp} = (#{code}).to_s"],
|
38
|
-
[:code, "#{tmp}.gsub
|
38
|
+
[:code, "#{tmp} = #{tmp}.gsub(\"\\n\", #{indent.inspect}) if #{@pre_tags_name} !~ #{tmp}"],
|
39
39
|
[:dynamic, tmp]]
|
40
40
|
else
|
41
41
|
[:dynamic, code]
|
data/lib/temple/version.rb
CHANGED
data/test/html/test_pretty.rb
CHANGED
@@ -22,7 +22,7 @@ describe Temple::HTML::Pretty do
|
|
22
22
|
[:static, "text"],
|
23
23
|
[:multi,
|
24
24
|
[:code, "_temple_html_pretty2 = (code).to_s"],
|
25
|
-
[:code, '_temple_html_pretty2.gsub
|
25
|
+
[:code, '_temple_html_pretty2 = _temple_html_pretty2.gsub("\n", "\n ") if _temple_html_pretty1 !~ _temple_html_pretty2'],
|
26
26
|
[:dynamic, "_temple_html_pretty2"]]],
|
27
27
|
[:static, "</p>"]],
|
28
28
|
[:static, "\n</div>"]]]
|
data/test/test_generator.rb
CHANGED
@@ -105,11 +105,11 @@ end
|
|
105
105
|
describe Temple::Generators::RailsOutputBuffer do
|
106
106
|
it 'should compile simple expressions' do
|
107
107
|
gen = Temple::Generators::RailsOutputBuffer.new
|
108
|
-
gen.call([:static, 'test']).should.equal '@output_buffer =
|
108
|
+
gen.call([:static, 'test']).should.equal '@output_buffer = ActiveSupport::SafeBuffer.new; ' +
|
109
109
|
'@output_buffer.safe_concat(("test")); @output_buffer'
|
110
|
-
gen.call([:dynamic, 'test']).should.equal '@output_buffer =
|
110
|
+
gen.call([:dynamic, 'test']).should.equal '@output_buffer = ActiveSupport::SafeBuffer.new; ' +
|
111
111
|
'@output_buffer.safe_concat(((test).to_s)); @output_buffer'
|
112
|
-
gen.call([:code, 'test']).should.equal '@output_buffer =
|
112
|
+
gen.call([:code, 'test']).should.equal '@output_buffer = ActiveSupport::SafeBuffer.new; ' +
|
113
113
|
'test; @output_buffer'
|
114
114
|
end
|
115
115
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: temple
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.3.
|
5
|
+
version: 0.3.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Magnus Holm
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-
|
14
|
+
date: 2011-06-09 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: tilt
|