cells-haml 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d164d78990344d5558e5e9a0e599a025e6e9edf
4
- data.tar.gz: 9ecf73ac5ef7ab21a6ac190730a0a5277f9dba64
3
+ metadata.gz: afb505222abec10007aa42aba06dc1471e13bd35
4
+ data.tar.gz: d6cf9966745815f0831df6b914757f42c91791d1
5
5
  SHA512:
6
- metadata.gz: 58dec84fbd28d6a92506d64fe92d30e11dd7a3df4b1e13aebfbc1211854d5faee464e5f7eeaec3849a363d97e1a800c0d43445b71b18ca222cfc9fea6d6a63b2
7
- data.tar.gz: 7204ba46aeb830d110493064adc5cc3426bfe9da4a2e59772160d14772872224be7a5446b9f3aeb775de6a85975f1d96d8bc4d3179c60c0aad512dfd5877bdec
6
+ metadata.gz: bfdf392451a738e1de7266b25c36f0707463cbc412d61f574da61258d3e89d1b33c2d25ff919796d9dff08ad043f6f51e0f5c4661fd26c1e673cef013aa28ddb
7
+ data.tar.gz: 4b2c625bd551d555979a71b632cf0f522343d4c4ebb7c200dc6c644ae9fd8736247451b8c09e4f70e161f386337709de508df655657609bec94f94aac34a2302
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ #gem "cells", :github => "apotonick/cells"
6
+ gem "cells", path: "../../cells"
7
+ gem "appraisal"
8
+ gem "railties", "~> 3.2.0"
9
+ gem "activemodel"
10
+ gem "minitest", "~> 4.0"
11
+ gem "tilt", "~> 1.4"
12
+ gem "tzinfo"
13
+
14
+ gemspec :path => "../"
15
+
16
+ # gem "erbse", path: "../../erbse"
@@ -2,8 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "cells", :github => "apotonick/cells"
6
- #gem "cells", path: "../../cells"
5
+ # gem "cells", :github => "apotonick/cells"
6
+ gem "cells", path: "../../cells"
7
7
  gem "appraisal"
8
8
  gem "railties", "~> 4.2.0"
9
9
  gem "activemodel"
@@ -2,87 +2,87 @@ require 'tilt/haml'
2
2
 
3
3
  module Cell
4
4
  module Haml
5
- def output_buffer_with_haml
6
- return haml_buffer.buffer if is_haml?
7
- output_buffer_without_haml
8
- end
9
-
10
- def set_output_buffer_with_haml(new_buffer)
11
- if is_haml?
12
- if ::Haml::Util.rails_xss_safe? && new_buffer.is_a?(ActiveSupport::SafeBuffer)
13
- new_buffer = String.new(new_buffer)
14
- end
15
- haml_buffer.buffer = new_buffer
16
- else
17
- set_output_buffer_without_haml new_buffer
18
- end
19
- end
20
-
21
-
22
- def self.included(base)
23
- base.class_eval do
24
- alias_method :output_buffer_without_haml, :output_buffer
25
- alias_method :output_buffer, :output_buffer_with_haml
26
-
27
- alias_method :set_output_buffer_without_haml, :output_buffer=
28
- alias_method :output_buffer=, :set_output_buffer_with_haml
29
- end
30
- end
31
-
32
- # TODO: remove the concept of output buffers and just return block's result!
33
- class OutputBuffer < String
34
- end
35
-
36
-
37
- def with_output_buffer(buf = nil)
38
- unless buf
39
- buf = OutputBuffer.new
40
- end
41
- self.output_buffer, old_buffer = buf, output_buffer
42
- yield
43
- output_buffer
44
- ensure
45
- self.output_buffer = old_buffer
46
- end
47
-
48
-
49
- # generic ERB HAML HELPERS>>>>>>
50
- def capture(*args,&block)
51
- value = nil
52
- buffer = with_output_buffer() { value = yield(*args) }
53
- if string = buffer.presence || value and string.is_a?(String)
54
- return string
55
- end
56
- end
57
-
58
- # From FormTagHelper. why do they escape every possible string? why?
59
- def form_tag_in_block(html_options, &block)
60
- content = capture(&block)
61
- form_tag_with_body(html_options, content)
62
- end
63
-
64
- def form_tag_with_body(html_options, content)
65
- "#{form_tag_html(html_options)}" << content.to_s << "</form>"
66
- end
67
-
68
- def form_tag_html(html_options)
69
- extra_tags = extra_tags_for_form(html_options)
70
- "#{tag(:form, html_options, true) + extra_tags}"
71
- end
72
-
73
- # Rails 4.0, TagHelper.
74
- def tag_option(key, value, escape)
75
- super(key, value, false)
76
- end
77
-
78
- def content_tag_string(name, content, options, escape=true)
79
- super(name, content, options, false)
80
- end
5
+ # def output_buffer_with_haml
6
+ # return haml_buffer.buffer if is_haml?
7
+ # output_buffer_without_haml
8
+ # end
9
+
10
+ # def set_output_buffer_with_haml(new_buffer)
11
+ # if is_haml?
12
+ # if ::Haml::Util.rails_xss_safe? && new_buffer.is_a?(ActiveSupport::SafeBuffer)
13
+ # new_buffer = String.new(new_buffer)
14
+ # end
15
+ # haml_buffer.buffer = new_buffer
16
+ # else
17
+ # set_output_buffer_without_haml new_buffer
18
+ # end
19
+ # end
20
+
21
+
22
+ # def self.included(base)
23
+ # base.class_eval do
24
+ # alias_method :output_buffer_without_haml, :output_buffer
25
+ # alias_method :output_buffer, :output_buffer_with_haml
26
+
27
+ # alias_method :set_output_buffer_without_haml, :output_buffer=
28
+ # alias_method :output_buffer=, :set_output_buffer_with_haml
29
+ # end
30
+ # end
31
+
32
+ # # TODO: remove the concept of output buffers and just return block's result!
33
+ # class OutputBuffer < String
34
+ # end
35
+
36
+
37
+ # def with_output_buffer(buf = nil)
38
+ # unless buf
39
+ # buf = OutputBuffer.new
40
+ # end
41
+ # self.output_buffer, old_buffer = buf, output_buffer
42
+ # yield
43
+ # output_buffer
44
+ # ensure
45
+ # self.output_buffer = old_buffer
46
+ # end
47
+
48
+
49
+ # # generic ERB HAML HELPERS>>>>>>
50
+ # def capture(*args,&block)
51
+ # value = nil
52
+ # buffer = with_output_buffer() { value = yield(*args) }
53
+ # if string = buffer.presence || value and string.is_a?(String)
54
+ # return string
55
+ # end
56
+ # end
57
+
58
+ # # From FormTagHelper. why do they escape every possible string? why?
59
+ # def form_tag_in_block(html_options, &block)
60
+ # content = capture(&block)
61
+ # form_tag_with_body(html_options, content)
62
+ # end
63
+
64
+ # def form_tag_with_body(html_options, content)
65
+ # "#{form_tag_html(html_options)}" << content.to_s << "</form>"
66
+ # end
67
+
68
+ # def form_tag_html(html_options)
69
+ # extra_tags = extra_tags_for_form(html_options)
70
+ # "#{tag(:form, html_options, true) + extra_tags}"
71
+ # end
72
+
73
+ # # Rails 4.0, TagHelper.
74
+ # def tag_option(key, value, escape)
75
+ # super(key, value, false)
76
+ # end
77
+
78
+ # def content_tag_string(name, content, options, escape=true)
79
+ # super(name, content, options, false)
80
+ # end
81
81
  end
82
82
 
83
- ViewModel.class_eval do
84
- include Haml
85
- end
83
+ # ViewModel.class_eval do
84
+ # include Haml
85
+ # end
86
86
 
87
87
  ViewModel.template_engine = :haml
88
88
  end
@@ -1,5 +1,5 @@
1
1
  module Cell
2
2
  module Haml
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -6,3 +6,10 @@ Word.
6
6
 
7
7
  = content_tag( :ul) do
8
8
  Hallo
9
+
10
+ - content = capture do
11
+ Bonjour!
12
+
13
+ Weiter!
14
+
15
+ = content
@@ -34,6 +34,8 @@ class HamlTest < MiniTest::Spec
34
34
  <ul>Hallo
35
35
  </ul>
36
36
  </form>
37
+ Weiter!
38
+ Bonjour!
37
39
  }
38
40
  end
39
41
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cells-haml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih
@@ -82,6 +82,7 @@ files:
82
82
  - README.md
83
83
  - Rakefile
84
84
  - cells-haml.gemspec
85
+ - gemfiles/rails_3.2-tilt-1.4.gemfile
85
86
  - gemfiles/rails_4.2-tilt-1.4.gemfile
86
87
  - gemfiles/rails_4.2-tilt-2.0.gemfile
87
88
  - gemfiles/rails_4.2-tilt-3.0.gemfile