temple 0.3.1 → 0.3.2

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.
@@ -33,9 +33,14 @@ module Temple
33
33
  if @pretty
34
34
  @last = :noindent
35
35
  tmp = unique_name
36
+ gsub_code = if ''.respond_to?(:html_safe?)
37
+ "#{tmp} = #{tmp}.html_safe? ? #{tmp}.gsub(\"\\n\", #{indent.inspect}).html_safe : #{tmp}.gsub(\"\\n\", #{indent.inspect})"
38
+ else
39
+ "#{tmp}.gsub!(\"\\n\", #{indent.inspect})"
40
+ end
36
41
  [:multi,
37
42
  [:code, "#{tmp} = (#{code}).to_s"],
38
- [:code, "#{tmp} = #{tmp}.gsub(\"\\n\", #{indent.inspect}) if #{@pre_tags_name} !~ #{tmp}"],
43
+ [:code, "if #{@pre_tags_name} !~ #{tmp}; #{gsub_code}; end"],
39
44
  [:dynamic, tmp]]
40
45
  else
41
46
  [:dynamic, code]
@@ -1,3 +1,3 @@
1
1
  module Temple
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
@@ -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 = _temple_html_pretty2.gsub("\n", "\n ") if _temple_html_pretty1 !~ _temple_html_pretty2'],
25
+ [:code, 'if _temple_html_pretty1 !~ _temple_html_pretty2; _temple_html_pretty2.gsub!("\n", "\n "); end'],
26
26
  [:dynamic, "_temple_html_pretty2"]]],
27
27
  [:static, "</p>"]],
28
28
  [:static, "\n</div>"]]]
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: temple
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.1
5
+ version: 0.3.2
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-06-09 00:00:00 Z
14
+ date: 2011-06-19 00:00:00 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: tilt