haml-edge 2.1.21 → 2.1.22
Sign up to get free protection for your applications and to get access to all the features.
- data/EDGE_GEM_VERSION +1 -1
- data/FAQ.md +142 -0
- data/{README.rdoc → README.md} +141 -141
- data/Rakefile +29 -17
- data/VERSION +1 -1
- data/lib/haml/buffer.rb +63 -27
- data/lib/haml/engine.rb +103 -80
- data/lib/haml/error.rb +7 -7
- data/lib/haml/exec.rb +80 -26
- data/lib/haml/filters.rb +106 -40
- data/lib/haml/helpers/action_view_extensions.rb +34 -39
- data/lib/haml/helpers/action_view_mods.rb +132 -139
- data/lib/haml/helpers.rb +207 -153
- data/lib/haml/html.rb +40 -21
- data/lib/haml/precompiler.rb +2 -0
- data/lib/haml/shared.rb +34 -3
- data/lib/haml/template/patch.rb +1 -1
- data/lib/haml/template/plugin.rb +0 -2
- data/lib/haml/template.rb +5 -0
- data/lib/haml/util.rb +136 -1
- data/lib/haml/version.rb +16 -4
- data/lib/haml.rb +502 -481
- data/lib/sass/css.rb +106 -68
- data/lib/sass/engine.rb +55 -22
- data/lib/sass/environment.rb +52 -21
- data/lib/sass/error.rb +23 -12
- data/lib/sass/files.rb +27 -0
- data/lib/sass/plugin/merb.rb +2 -2
- data/lib/sass/plugin/rails.rb +0 -2
- data/lib/sass/plugin.rb +32 -23
- data/lib/sass/repl.rb +7 -0
- data/lib/sass/script/bool.rb +9 -5
- data/lib/sass/script/color.rb +87 -1
- data/lib/sass/script/funcall.rb +23 -2
- data/lib/sass/script/functions.rb +93 -44
- data/lib/sass/script/lexer.rb +33 -3
- data/lib/sass/script/literal.rb +93 -1
- data/lib/sass/script/node.rb +14 -0
- data/lib/sass/script/number.rb +128 -4
- data/lib/sass/script/operation.rb +16 -1
- data/lib/sass/script/parser.rb +51 -21
- data/lib/sass/script/string.rb +7 -4
- data/lib/sass/script/unary_operation.rb +14 -1
- data/lib/sass/script/variable.rb +12 -1
- data/lib/sass/script.rb +26 -5
- data/lib/sass/tree/attr_node.rb +46 -9
- data/lib/sass/tree/comment_node.rb +41 -1
- data/lib/sass/tree/debug_node.rb +8 -0
- data/lib/sass/tree/directive_node.rb +20 -0
- data/lib/sass/tree/file_node.rb +12 -0
- data/lib/sass/tree/for_node.rb +15 -0
- data/lib/sass/tree/if_node.rb +22 -0
- data/lib/sass/tree/mixin_def_node.rb +12 -1
- data/lib/sass/tree/mixin_node.rb +13 -0
- data/lib/sass/tree/node.rb +136 -6
- data/lib/sass/tree/rule_node.rb +66 -7
- data/lib/sass/tree/variable_node.rb +10 -0
- data/lib/sass/tree/while_node.rb +11 -1
- data/lib/sass.rb +544 -534
- metadata +7 -6
- data/FAQ +0 -138
@@ -1,166 +1,139 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
module ActionView
|
2
|
+
class Base
|
3
|
+
def render_with_haml(*args, &block)
|
4
|
+
options = args.first
|
5
|
+
|
6
|
+
# If render :layout is used with a block,
|
7
|
+
# it concats rather than returning a string
|
8
|
+
# so we need it to keep thinking it's Haml
|
9
|
+
# until it hits the sub-render
|
10
|
+
if is_haml? && !(options.is_a?(Hash) && options[:layout] && block_given?)
|
11
|
+
return non_haml { render_without_haml(*args, &block) }
|
12
|
+
end
|
13
|
+
render_without_haml(*args, &block)
|
14
|
+
end
|
15
|
+
alias_method :render_without_haml, :render
|
16
|
+
alias_method :render, :render_with_haml
|
17
|
+
|
18
|
+
# Rails >2.1
|
19
|
+
if Haml::Util.has?(:instance_method, self, :output_buffer)
|
20
|
+
def output_buffer_with_haml
|
21
|
+
return haml_buffer.buffer if is_haml?
|
22
|
+
output_buffer_without_haml
|
15
23
|
end
|
16
|
-
alias_method :
|
17
|
-
alias_method :
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
alias_method :output_buffer_without_haml, :output_buffer
|
25
|
+
alias_method :output_buffer, :output_buffer_with_haml
|
26
|
+
|
27
|
+
def set_output_buffer_with_haml(new)
|
28
|
+
if is_haml?
|
29
|
+
haml_buffer.buffer = new
|
30
|
+
else
|
31
|
+
set_output_buffer_without_haml new
|
24
32
|
end
|
25
|
-
|
26
|
-
|
33
|
+
end
|
34
|
+
alias_method :set_output_buffer_without_haml, :output_buffer=
|
35
|
+
alias_method :output_buffer=, :set_output_buffer_with_haml
|
36
|
+
end
|
37
|
+
end
|
27
38
|
|
28
|
-
|
29
|
-
|
30
|
-
|
39
|
+
module Helpers
|
40
|
+
# In Rails <=2.1, we've got to override considerable capturing infrastructure.
|
41
|
+
# In Rails >2.1, we can make do with only overriding #capture
|
42
|
+
# (which no longer behaves differently in helper contexts).
|
43
|
+
unless Haml::Util.has?(:instance_method, ActionView::Base, :output_buffer)
|
44
|
+
module CaptureHelper
|
45
|
+
def capture_with_haml(*args, &block)
|
46
|
+
# Rails' #capture helper will just return the value of the block
|
47
|
+
# if it's not actually in the template context,
|
48
|
+
# as detected by the existance of an _erbout variable.
|
49
|
+
# We've got to do the same thing for compatibility.
|
50
|
+
|
51
|
+
if is_haml? && block_is_haml?(block)
|
52
|
+
capture_haml(*args, &block)
|
31
53
|
else
|
32
|
-
|
54
|
+
capture_without_haml(*args, &block)
|
33
55
|
end
|
34
56
|
end
|
35
|
-
alias_method :
|
36
|
-
alias_method :
|
37
|
-
end
|
38
|
-
end
|
57
|
+
alias_method :capture_without_haml, :capture
|
58
|
+
alias_method :capture, :capture_with_haml
|
39
59
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
# In Rails >2.1, we can make do with only overriding #capture
|
46
|
-
# (which no longer behaves differently in helper contexts).
|
47
|
-
unless Haml::Util.has?(:instance_method, ActionView::Base, :output_buffer)
|
48
|
-
module CaptureHelper
|
49
|
-
def capture_with_haml(*args, &block)
|
50
|
-
# Rails' #capture helper will just return the value of the block
|
51
|
-
# if it's not actually in the template context,
|
52
|
-
# as detected by the existance of an _erbout variable.
|
53
|
-
# We've got to do the same thing for compatibility.
|
54
|
-
|
55
|
-
if is_haml? && block_is_haml?(block)
|
56
|
-
capture_haml(*args, &block)
|
57
|
-
else
|
58
|
-
capture_without_haml(*args, &block)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
alias_method :capture_without_haml, :capture
|
62
|
-
alias_method :capture, :capture_with_haml
|
63
|
-
|
64
|
-
def capture_erb_with_buffer_with_haml(buffer, *args, &block)
|
65
|
-
if is_haml?
|
66
|
-
capture_haml(*args, &block)
|
67
|
-
else
|
68
|
-
capture_erb_with_buffer_without_haml(buffer, *args, &block)
|
69
|
-
end
|
60
|
+
def capture_erb_with_buffer_with_haml(buffer, *args, &block)
|
61
|
+
if is_haml?
|
62
|
+
capture_haml(*args, &block)
|
63
|
+
else
|
64
|
+
capture_erb_with_buffer_without_haml(buffer, *args, &block)
|
70
65
|
end
|
71
|
-
alias_method :capture_erb_with_buffer_without_haml, :capture_erb_with_buffer
|
72
|
-
alias_method :capture_erb_with_buffer, :capture_erb_with_buffer_with_haml
|
73
66
|
end
|
67
|
+
alias_method :capture_erb_with_buffer_without_haml, :capture_erb_with_buffer
|
68
|
+
alias_method :capture_erb_with_buffer, :capture_erb_with_buffer_with_haml
|
69
|
+
end
|
74
70
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
71
|
+
module TextHelper
|
72
|
+
def concat_with_haml(string, binding = nil)
|
73
|
+
if is_haml?
|
74
|
+
haml_buffer.buffer.concat(string)
|
75
|
+
else
|
76
|
+
concat_without_haml(string, binding)
|
82
77
|
end
|
83
|
-
alias_method :concat_without_haml, :concat
|
84
|
-
alias_method :concat, :concat_with_haml
|
85
78
|
end
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
79
|
+
alias_method :concat_without_haml, :concat
|
80
|
+
alias_method :concat, :concat_with_haml
|
81
|
+
end
|
82
|
+
else
|
83
|
+
module CaptureHelper
|
84
|
+
def capture_with_haml(*args, &block)
|
85
|
+
if Haml::Helpers.block_is_haml?(block)
|
86
|
+
capture_haml(*args, &block)
|
87
|
+
else
|
88
|
+
capture_without_haml(*args, &block)
|
94
89
|
end
|
95
|
-
alias_method :capture_without_haml, :capture
|
96
|
-
alias_method :capture, :capture_with_haml
|
97
90
|
end
|
91
|
+
alias_method :capture_without_haml, :capture
|
92
|
+
alias_method :capture, :capture_with_haml
|
98
93
|
end
|
94
|
+
end
|
99
95
|
|
100
|
-
|
101
|
-
|
102
|
-
|
96
|
+
module TagHelper
|
97
|
+
def content_tag_with_haml(name, *args, &block)
|
98
|
+
return content_tag_without_haml(name, *args, &block) unless is_haml?
|
103
99
|
|
104
|
-
|
100
|
+
preserve = haml_buffer.options[:preserve].include?(name.to_s)
|
105
101
|
|
106
|
-
|
107
|
-
|
108
|
-
end
|
109
|
-
|
110
|
-
returning content_tag_without_haml(name, *args, &block) do |content|
|
111
|
-
return Haml::Helpers.preserve(content) if preserve && content
|
112
|
-
end
|
102
|
+
if block_given? && block_is_haml?(block) && preserve
|
103
|
+
return content_tag_without_haml(name, *args) {preserve(&block)}
|
113
104
|
end
|
114
105
|
|
115
|
-
|
116
|
-
|
106
|
+
returning content_tag_without_haml(name, *args, &block) do |content|
|
107
|
+
return Haml::Helpers.preserve(content) if preserve && content
|
108
|
+
end
|
117
109
|
end
|
118
110
|
|
119
|
-
|
120
|
-
|
111
|
+
alias_method :content_tag_without_haml, :content_tag
|
112
|
+
alias_method :content_tag, :content_tag_with_haml
|
113
|
+
end
|
121
114
|
|
122
|
-
|
123
|
-
|
124
|
-
end
|
115
|
+
class InstanceTag
|
116
|
+
# Includes TagHelper
|
125
117
|
|
126
|
-
|
127
|
-
|
128
|
-
end
|
129
|
-
|
130
|
-
alias_method :content_tag_without_haml, :content_tag
|
131
|
-
alias_method :content_tag, :content_tag_with_haml
|
118
|
+
def haml_buffer
|
119
|
+
@template_object.send :haml_buffer
|
132
120
|
end
|
133
121
|
|
134
|
-
|
135
|
-
|
136
|
-
if is_haml?
|
137
|
-
if block_given?
|
138
|
-
oldproc = proc
|
139
|
-
proc = haml_bind_proc do |*args|
|
140
|
-
concat "\n"
|
141
|
-
tab_up
|
142
|
-
oldproc.call(*args)
|
143
|
-
tab_down
|
144
|
-
concat haml_indent
|
145
|
-
end
|
146
|
-
concat haml_indent
|
147
|
-
end
|
148
|
-
res = form_tag_without_haml(url_for_options, options, *parameters_for_url, &proc) + "\n"
|
149
|
-
concat "\n" if block_given?
|
150
|
-
res
|
151
|
-
else
|
152
|
-
form_tag_without_haml(url_for_options, options, *parameters_for_url, &proc)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
alias_method :form_tag_without_haml, :form_tag
|
156
|
-
alias_method :form_tag, :form_tag_with_haml
|
122
|
+
def is_haml?
|
123
|
+
@template_object.send :is_haml?
|
157
124
|
end
|
158
125
|
|
159
|
-
|
160
|
-
|
161
|
-
|
126
|
+
alias_method :content_tag_without_haml, :content_tag
|
127
|
+
alias_method :content_tag, :content_tag_with_haml
|
128
|
+
end
|
129
|
+
|
130
|
+
module FormTagHelper
|
131
|
+
def form_tag_with_haml(url_for_options = {}, options = {}, *parameters_for_url, &proc)
|
132
|
+
if is_haml?
|
133
|
+
if block_given?
|
162
134
|
oldproc = proc
|
163
135
|
proc = haml_bind_proc do |*args|
|
136
|
+
concat "\n"
|
164
137
|
tab_up
|
165
138
|
oldproc.call(*args)
|
166
139
|
tab_down
|
@@ -168,14 +141,34 @@ if defined?(ActionView) and not defined?(Merb::Plugins)
|
|
168
141
|
end
|
169
142
|
concat haml_indent
|
170
143
|
end
|
171
|
-
|
172
|
-
concat "\n" if block_given?
|
144
|
+
res = form_tag_without_haml(url_for_options, options, *parameters_for_url, &proc) + "\n"
|
145
|
+
concat "\n" if block_given?
|
146
|
+
res
|
147
|
+
else
|
148
|
+
form_tag_without_haml(url_for_options, options, *parameters_for_url, &proc)
|
173
149
|
end
|
174
|
-
alias_method :form_for_without_haml, :form_for
|
175
|
-
alias_method :form_for, :form_for_with_haml
|
176
150
|
end
|
177
|
-
|
151
|
+
alias_method :form_tag_without_haml, :form_tag
|
152
|
+
alias_method :form_tag, :form_tag_with_haml
|
153
|
+
end
|
154
|
+
|
155
|
+
module FormHelper
|
156
|
+
def form_for_with_haml(object_name, *args, &proc)
|
157
|
+
if block_given? && is_haml?
|
158
|
+
oldproc = proc
|
159
|
+
proc = haml_bind_proc do |*args|
|
160
|
+
tab_up
|
161
|
+
oldproc.call(*args)
|
162
|
+
tab_down
|
163
|
+
concat haml_indent
|
164
|
+
end
|
165
|
+
concat haml_indent
|
166
|
+
end
|
167
|
+
form_for_without_haml(object_name, *args, &proc)
|
168
|
+
concat "\n" if block_given? && is_haml?
|
169
|
+
end
|
170
|
+
alias_method :form_for_without_haml, :form_for
|
171
|
+
alias_method :form_for, :form_for_with_haml
|
178
172
|
end
|
179
173
|
end
|
180
174
|
end
|
181
|
-
|