haml 2.2.12 → 2.2.13

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of haml might be problematic. Click here for more details.

data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.12
1
+ 2.2.13
@@ -58,7 +58,9 @@ module Haml
58
58
  # @return [String]
59
59
  def precompiled
60
60
  return @precompiled if ruby1_8?
61
- return @precompiled.encode(Encoding.find(@options[:encoding]))
61
+ encoding = Encoding.find(@options[:encoding])
62
+ return @precompiled.force_encoding(encoding) if encoding == Encoding::BINARY
63
+ return @precompiled.encode(encoding)
62
64
  end
63
65
 
64
66
  # Precompiles the Haml template.
@@ -23,6 +23,10 @@ module Haml
23
23
  ' ' * tabs
24
24
  end
25
25
 
26
+ def attr_hash
27
+ attributes.to_hash
28
+ end
29
+
26
30
  def parse_text(text, tabs)
27
31
  text.strip!
28
32
  text.gsub!('#{', '\#{') #'
@@ -177,16 +181,16 @@ module Haml
177
181
  output += "%#{name}" unless name == 'div' &&
178
182
  (static_id?(options) || static_classname?(options))
179
183
 
180
- if attributes
184
+ if attr_hash
181
185
  if static_id?(options)
182
- output += "##{attributes['id']}"
186
+ output += "##{attr_hash['id']}"
183
187
  remove_attribute('id')
184
188
  end
185
189
  if static_classname?(options)
186
- attributes['class'].split(' ').each { |c| output += ".#{c}" }
190
+ attr_hash['class'].split(' ').each { |c| output += ".#{c}" }
187
191
  remove_attribute('class')
188
192
  end
189
- output += haml_attributes(options) if attributes.length > 0
193
+ output += haml_attributes(options) if attr_hash.length > 0
190
194
  end
191
195
 
192
196
  (self.children || []).inject(output + "\n") do |output, child|
@@ -198,7 +202,7 @@ module Haml
198
202
 
199
203
  def dynamic_attributes
200
204
  @dynamic_attributes ||= begin
201
- Haml::Util.map_hash(attributes) do |name, value|
205
+ Haml::Util.map_hash(attr_hash) do |name, value|
202
206
  next if value.empty?
203
207
  full_match = nil
204
208
  ruby_value = value.gsub(%r{<haml:loud>\s*(.+?)\s*</haml:loud>}) do
@@ -220,7 +224,7 @@ module Haml
220
224
  end
221
225
 
222
226
  def static_attribute?(name, options)
223
- attributes[name] and !dynamic_attribute?(name, options)
227
+ attr_hash[name] and !dynamic_attribute?(name, options)
224
228
  end
225
229
 
226
230
  def dynamic_attribute?(name, options)
@@ -238,7 +242,7 @@ module Haml
238
242
  # Returns a string representation of an attributes hash
239
243
  # that's prettier than that produced by Hash#inspect
240
244
  def haml_attributes(options)
241
- attrs = attributes.map do |name, value|
245
+ attrs = attr_hash.map do |name, value|
242
246
  value = dynamic_attribute?(name, options) ? dynamic_attributes[name] : value.inspect
243
247
  name = name.index(/\W/) ? name.inspect : ":#{name}"
244
248
  "#{name} => #{value}"
@@ -832,12 +832,18 @@ HAML
832
832
  line_no ||= key.split("\n").length
833
833
 
834
834
  if expected_message == :compile
835
- assert_match(/^compile error\n/, err.message, "Line: #{key}")
835
+ if Haml::Util.ruby1_8?
836
+ assert_match(/^compile error\n/, err.message, "Line: #{key}")
837
+ else
838
+ assert_match(/^#{Regexp.quote __FILE__}:#{line_no}: syntax error,/, err.message, "Line: #{key}")
839
+ end
836
840
  else
837
841
  assert_equal(expected_message, err.message, "Line: #{key}")
838
842
  end
839
843
 
840
- assert_match(/^#{Regexp.escape(__FILE__)}:#{line_no}/, err.backtrace[0], "Line: #{key}")
844
+ if Haml::Util.ruby1_8?
845
+ assert_match(/^#{Regexp.escape(__FILE__)}:#{line_no}/, err.backtrace[0], "Line: #{key}")
846
+ end
841
847
  else
842
848
  assert(false, "Exception not raised for\n#{key}")
843
849
  end
@@ -1183,6 +1189,16 @@ HTML
1183
1189
  HAML
1184
1190
  end
1185
1191
 
1192
+ def test_fake_ascii_encoding
1193
+ assert_equal(<<HTML.force_encoding("ascii-8bit"), render(<<HAML, :encoding => "ascii-8bit"))
1194
+ <p>bâr</p>
1195
+ <p>föö</p>
1196
+ HTML
1197
+ %p bâr
1198
+ %p föö
1199
+ HAML
1200
+ end
1201
+
1186
1202
  def test_convert_template_render_proc
1187
1203
  assert_converts_template_properly {|e| e.render_proc.call}
1188
1204
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.12
4
+ version: 2.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-05 00:00:00 -08:00
13
+ date: 2009-11-09 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -43,200 +43,200 @@ executables:
43
43
  extensions: []
44
44
 
45
45
  extra_rdoc_files:
46
- - VERSION
47
- - MIT-LICENSE
48
- - README.md
49
46
  - VERSION_NAME
50
- - REVISION
51
47
  - CONTRIBUTING
48
+ - README.md
49
+ - MIT-LICENSE
50
+ - VERSION
51
+ - REVISION
52
52
  files:
53
53
  - rails/init.rb
54
54
  - lib/sass.rb
55
- - lib/sass/plugin/rails.rb
56
- - lib/sass/plugin/merb.rb
55
+ - lib/sass/css.rb
56
+ - lib/sass/script/node.rb
57
+ - lib/sass/script/number.rb
58
+ - lib/sass/script/operation.rb
59
+ - lib/sass/script/literal.rb
60
+ - lib/sass/script/functions.rb
61
+ - lib/sass/script/bool.rb
62
+ - lib/sass/script/color.rb
63
+ - lib/sass/script/lexer.rb
64
+ - lib/sass/script/parser.rb
65
+ - lib/sass/script/variable.rb
66
+ - lib/sass/script/string.rb
67
+ - lib/sass/script/funcall.rb
68
+ - lib/sass/script/unary_operation.rb
57
69
  - lib/sass/script.rb
58
70
  - lib/sass/error.rb
71
+ - lib/sass/repl.rb
72
+ - lib/sass/tree/comment_node.rb
73
+ - lib/sass/tree/node.rb
59
74
  - lib/sass/tree/for_node.rb
60
- - lib/sass/tree/mixin_node.rb
61
- - lib/sass/tree/if_node.rb
62
- - lib/sass/tree/prop_node.rb
63
- - lib/sass/tree/mixin_def_node.rb
64
- - lib/sass/tree/variable_node.rb
65
75
  - lib/sass/tree/debug_node.rb
66
- - lib/sass/tree/directive_node.rb
67
- - lib/sass/tree/node.rb
68
- - lib/sass/tree/comment_node.rb
69
- - lib/sass/tree/rule_node.rb
70
76
  - lib/sass/tree/import_node.rb
71
77
  - lib/sass/tree/while_node.rb
78
+ - lib/sass/tree/mixin_def_node.rb
79
+ - lib/sass/tree/if_node.rb
80
+ - lib/sass/tree/mixin_node.rb
81
+ - lib/sass/tree/directive_node.rb
82
+ - lib/sass/tree/rule_node.rb
83
+ - lib/sass/tree/prop_node.rb
84
+ - lib/sass/tree/variable_node.rb
85
+ - lib/sass/plugin/rails.rb
86
+ - lib/sass/plugin/merb.rb
87
+ - lib/sass/environment.rb
72
88
  - lib/sass/files.rb
73
- - lib/sass/plugin.rb
74
- - lib/sass/script/parser.rb
75
- - lib/sass/script/color.rb
76
- - lib/sass/script/string.rb
77
- - lib/sass/script/unary_operation.rb
78
- - lib/sass/script/number.rb
79
- - lib/sass/script/funcall.rb
80
- - lib/sass/script/variable.rb
81
- - lib/sass/script/functions.rb
82
- - lib/sass/script/bool.rb
83
- - lib/sass/script/lexer.rb
84
- - lib/sass/script/operation.rb
85
- - lib/sass/script/node.rb
86
- - lib/sass/script/literal.rb
87
- - lib/sass/css.rb
88
89
  - lib/sass/engine.rb
89
- - lib/sass/repl.rb
90
- - lib/sass/environment.rb
91
- - lib/haml/util.rb
90
+ - lib/sass/plugin.rb
91
+ - lib/haml/filters.rb
92
92
  - lib/haml/exec.rb
93
- - lib/haml/html.rb
94
93
  - lib/haml/error.rb
95
- - lib/haml/buffer.rb
96
94
  - lib/haml/template.rb
97
- - lib/haml/template/plugin.rb
95
+ - lib/haml/shared.rb
96
+ - lib/haml/engine.rb
97
+ - lib/haml/version.rb
98
98
  - lib/haml/template/patch.rb
99
+ - lib/haml/template/plugin.rb
99
100
  - lib/haml/helpers.rb
100
- - lib/haml/version.rb
101
- - lib/haml/filters.rb
102
- - lib/haml/engine.rb
101
+ - lib/haml/buffer.rb
102
+ - lib/haml/html.rb
103
103
  - lib/haml/precompiler.rb
104
- - lib/haml/shared.rb
105
- - lib/haml/helpers/action_view_extensions.rb
104
+ - lib/haml/util.rb
106
105
  - lib/haml/helpers/action_view_mods.rb
107
106
  - lib/haml/helpers/xss_mods.rb
107
+ - lib/haml/helpers/action_view_extensions.rb
108
108
  - lib/haml.rb
109
- - bin/css2sass
110
109
  - bin/sass
111
- - bin/haml
110
+ - bin/css2sass
112
111
  - bin/html2haml
112
+ - bin/haml
113
+ - test/linked_rails.rb
114
+ - test/benchmark.rb
113
115
  - test/sass/script_test.rb
116
+ - test/sass/css2sass_test.rb
117
+ - test/sass/results/units.css
118
+ - test/sass/results/parent_ref.css
119
+ - test/sass/results/compressed.css
120
+ - test/sass/results/complex.css
121
+ - test/sass/results/compact.css
122
+ - test/sass/results/mixins.css
123
+ - test/sass/results/line_numbers.css
124
+ - test/sass/results/alt.css
125
+ - test/sass/results/subdir/subdir.css
126
+ - test/sass/results/subdir/nested_subdir/nested_subdir.css
127
+ - test/sass/results/nested.css
128
+ - test/sass/results/import.css
129
+ - test/sass/results/multiline.css
130
+ - test/sass/results/script.css
131
+ - test/sass/results/basic.css
132
+ - test/sass/results/expanded.css
133
+ - test/sass/more_results/more_import.css
114
134
  - test/sass/more_results/more1_with_line_comments.css
115
135
  - test/sass/more_results/more1.css
116
- - test/sass/more_results/more_import.css
117
- - test/sass/templates/bork2.sass
136
+ - test/sass/templates/basic.sass
137
+ - test/sass/templates/bork.sass
118
138
  - test/sass/templates/compressed.sass
119
- - test/sass/templates/expanded.sass
120
139
  - test/sass/templates/import.sass
121
- - test/sass/templates/subdir/subdir.sass
122
- - test/sass/templates/subdir/nested_subdir/_nested_partial.sass
123
- - test/sass/templates/subdir/nested_subdir/nested_subdir.sass
124
- - test/sass/templates/basic.sass
140
+ - test/sass/templates/script.sass
141
+ - test/sass/templates/expanded.sass
142
+ - test/sass/templates/nested.sass
125
143
  - test/sass/templates/_partial.sass
126
- - test/sass/templates/units.sass
127
- - test/sass/templates/mixins.sass
128
- - test/sass/templates/multiline.sass
129
144
  - test/sass/templates/line_numbers.sass
130
- - test/sass/templates/nested.sass
131
145
  - test/sass/templates/compact.sass
146
+ - test/sass/templates/subdir/subdir.sass
147
+ - test/sass/templates/subdir/nested_subdir/nested_subdir.sass
148
+ - test/sass/templates/subdir/nested_subdir/_nested_partial.sass
149
+ - test/sass/templates/parent_ref.sass
132
150
  - test/sass/templates/alt.sass
133
- - test/sass/templates/script.sass
134
151
  - test/sass/templates/importee.sass
135
- - test/sass/templates/parent_ref.sass
136
- - test/sass/templates/bork.sass
152
+ - test/sass/templates/mixins.sass
153
+ - test/sass/templates/multiline.sass
154
+ - test/sass/templates/units.sass
137
155
  - test/sass/templates/complex.sass
138
- - test/sass/css2sass_test.rb
139
- - test/sass/plugin_test.rb
156
+ - test/sass/templates/bork2.sass
157
+ - test/sass/more_templates/_more_partial.sass
140
158
  - test/sass/more_templates/more1.sass
141
159
  - test/sass/more_templates/more_import.sass
142
- - test/sass/more_templates/_more_partial.sass
143
160
  - test/sass/functions_test.rb
144
- - test/sass/results/nested.css
145
- - test/sass/results/units.css
146
- - test/sass/results/script.css
147
- - test/sass/results/subdir/nested_subdir/nested_subdir.css
148
- - test/sass/results/subdir/subdir.css
149
- - test/sass/results/import.css
150
- - test/sass/results/compact.css
151
- - test/sass/results/expanded.css
152
- - test/sass/results/alt.css
153
- - test/sass/results/mixins.css
154
- - test/sass/results/complex.css
155
- - test/sass/results/compressed.css
156
- - test/sass/results/parent_ref.css
157
- - test/sass/results/line_numbers.css
158
- - test/sass/results/multiline.css
159
- - test/sass/results/basic.css
160
161
  - test/sass/engine_test.rb
162
+ - test/sass/plugin_test.rb
161
163
  - test/haml/mocks/article.rb
162
- - test/haml/util_test.rb
163
- - test/haml/template_test.rb
164
- - test/haml/html2haml_test.rb
165
- - test/haml/rhtml/_av_partial_1.rhtml
164
+ - test/haml/rhtml/_av_partial_2.rhtml
166
165
  - test/haml/rhtml/standard.rhtml
166
+ - test/haml/rhtml/_av_partial_1.rhtml
167
167
  - test/haml/rhtml/action_view.rhtml
168
- - test/haml/rhtml/_av_partial_2.rhtml
169
- - test/haml/helper_test.rb
170
- - test/haml/templates/action_view_ugly.haml
171
- - test/haml/templates/list.haml
172
- - test/haml/templates/_text_area.haml
173
- - test/haml/templates/_partial.haml
174
- - test/haml/templates/nuke_outer_whitespace.haml
175
- - test/haml/templates/render_layout.haml
176
- - test/haml/templates/_av_partial_2.haml
177
- - test/haml/templates/partial_layout.haml
178
- - test/haml/templates/helpful.haml
179
- - test/haml/templates/_av_partial_1_ugly.haml
180
- - test/haml/templates/just_stuff.haml
181
- - test/haml/templates/standard_ugly.haml
182
- - test/haml/templates/silent_script.haml
183
- - test/haml/templates/very_basic.haml
184
- - test/haml/templates/nuke_inner_whitespace.haml
185
- - test/haml/templates/eval_suppressed.haml
186
- - test/haml/templates/tag_parsing.haml
187
- - test/haml/templates/whitespace_handling.haml
188
- - test/haml/templates/partials.haml
189
- - test/haml/templates/standard.haml
190
- - test/haml/templates/partialize.haml
191
- - test/haml/templates/_layout_for_partial.haml
192
- - test/haml/templates/_av_partial_1.haml
193
- - test/haml/templates/filters.haml
194
- - test/haml/templates/_layout.erb
195
- - test/haml/templates/content_for_layout.haml
196
- - test/haml/templates/_av_partial_2_ugly.haml
197
- - test/haml/templates/helpers.haml
198
- - test/haml/templates/original_engine.haml
199
- - test/haml/templates/breakage.haml
200
- - test/haml/templates/action_view.haml
201
- - test/haml/spec/tests.json
202
- - test/haml/spec/lua_haml_spec.lua
168
+ - test/haml/util_test.rb
203
169
  - test/haml/spec/ruby_haml_test.rb
204
170
  - test/haml/spec/README.md
171
+ - test/haml/spec/lua_haml_spec.lua
172
+ - test/haml/spec/tests.json
173
+ - test/haml/html2haml_test.rb
174
+ - test/haml/template_test.rb
175
+ - test/haml/helper_test.rb
176
+ - test/haml/results/tag_parsing.xhtml
205
177
  - test/haml/results/content_for_layout.xhtml
206
- - test/haml/results/just_stuff.xhtml
207
- - test/haml/results/whitespace_handling.xhtml
208
- - test/haml/results/nuke_outer_whitespace.xhtml
209
- - test/haml/results/silent_script.xhtml
210
- - test/haml/results/filters.xhtml
211
- - test/haml/results/standard.xhtml
212
- - test/haml/results/nuke_inner_whitespace.xhtml
213
- - test/haml/results/helpful.xhtml
178
+ - test/haml/results/helpers.xhtml
179
+ - test/haml/results/original_engine.xhtml
214
180
  - test/haml/results/very_basic.xhtml
215
- - test/haml/results/eval_suppressed.xhtml
181
+ - test/haml/results/helpful.xhtml
182
+ - test/haml/results/list.xhtml
216
183
  - test/haml/results/partials.xhtml
184
+ - test/haml/results/eval_suppressed.xhtml
185
+ - test/haml/results/nuke_inner_whitespace.xhtml
186
+ - test/haml/results/whitespace_handling.xhtml
217
187
  - test/haml/results/render_layout.xhtml
218
- - test/haml/results/original_engine.xhtml
219
- - test/haml/results/helpers.xhtml
220
- - test/haml/results/list.xhtml
188
+ - test/haml/results/silent_script.xhtml
189
+ - test/haml/results/standard.xhtml
190
+ - test/haml/results/just_stuff.xhtml
221
191
  - test/haml/results/partial_layout.xhtml
222
- - test/haml/results/tag_parsing.xhtml
192
+ - test/haml/results/filters.xhtml
193
+ - test/haml/results/nuke_outer_whitespace.xhtml
223
194
  - test/haml/markaby/standard.mab
195
+ - test/haml/templates/tag_parsing.haml
196
+ - test/haml/templates/nuke_inner_whitespace.haml
197
+ - test/haml/templates/partial_layout.haml
198
+ - test/haml/templates/_av_partial_2_ugly.haml
199
+ - test/haml/templates/partials.haml
200
+ - test/haml/templates/_layout_for_partial.haml
201
+ - test/haml/templates/original_engine.haml
202
+ - test/haml/templates/helpers.haml
203
+ - test/haml/templates/_layout.erb
204
+ - test/haml/templates/action_view_ugly.haml
205
+ - test/haml/templates/content_for_layout.haml
206
+ - test/haml/templates/silent_script.haml
207
+ - test/haml/templates/very_basic.haml
208
+ - test/haml/templates/render_layout.haml
209
+ - test/haml/templates/filters.haml
210
+ - test/haml/templates/_av_partial_1.haml
211
+ - test/haml/templates/standard_ugly.haml
212
+ - test/haml/templates/_partial.haml
213
+ - test/haml/templates/nuke_outer_whitespace.haml
214
+ - test/haml/templates/breakage.haml
215
+ - test/haml/templates/list.haml
216
+ - test/haml/templates/standard.haml
217
+ - test/haml/templates/whitespace_handling.haml
218
+ - test/haml/templates/eval_suppressed.haml
219
+ - test/haml/templates/action_view.haml
220
+ - test/haml/templates/_av_partial_2.haml
221
+ - test/haml/templates/partialize.haml
222
+ - test/haml/templates/just_stuff.haml
223
+ - test/haml/templates/helpful.haml
224
+ - test/haml/templates/_av_partial_1_ugly.haml
225
+ - test/haml/templates/_text_area.haml
224
226
  - test/haml/engine_test.rb
225
- - test/linked_rails.rb
226
- - test/benchmark.rb
227
227
  - test/test_helper.rb
228
- - extra/sass-mode.el
229
228
  - extra/haml-mode.el
229
+ - extra/sass-mode.el
230
230
  - extra/update_watch.rb
231
231
  - Rakefile
232
232
  - init.rb
233
233
  - .yardopts
234
- - VERSION
235
- - MIT-LICENSE
236
- - README.md
237
234
  - VERSION_NAME
238
- - REVISION
239
235
  - CONTRIBUTING
236
+ - README.md
237
+ - MIT-LICENSE
238
+ - VERSION
239
+ - REVISION
240
240
  has_rdoc: true
241
241
  homepage: http://haml.hamptoncatlin.com/
242
242
  licenses: []
@@ -268,19 +268,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  requirements: []
269
269
 
270
270
  rubyforge_project: haml
271
- rubygems_version: 1.3.5
271
+ rubygems_version: 1.3.4
272
272
  signing_key:
273
273
  specification_version: 3
274
274
  summary: An elegant, structured XHTML/XML templating engine. Comes with Sass, a similar CSS templating engine.
275
275
  test_files:
276
276
  - test/sass/script_test.rb
277
277
  - test/sass/css2sass_test.rb
278
- - test/sass/plugin_test.rb
279
278
  - test/sass/functions_test.rb
280
279
  - test/sass/engine_test.rb
280
+ - test/sass/plugin_test.rb
281
281
  - test/haml/util_test.rb
282
- - test/haml/template_test.rb
282
+ - test/haml/spec/ruby_haml_test.rb
283
283
  - test/haml/html2haml_test.rb
284
+ - test/haml/template_test.rb
284
285
  - test/haml/helper_test.rb
285
- - test/haml/spec/ruby_haml_test.rb
286
286
  - test/haml/engine_test.rb