haml 3.1.0.alpha.30 → 3.1.0.alpha.33

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.

@@ -1 +1 @@
1
- 3.1.0.alpha.30
1
+ 3.1.0.alpha.33
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.0.alpha.30
1
+ 3.1.0.alpha.33
@@ -124,9 +124,18 @@ module Haml
124
124
  # @param color [Symbol] The name of the color to use for this action.
125
125
  # Can be `:red`, `:green`, or `:yellow`.
126
126
  def puts_action(name, color, arg)
127
+ return if @options[:for_engine][:quiet]
127
128
  printf color(color, "%11s %s\n"), name, arg
128
129
  end
129
130
 
131
+ # Same as \{Kernel.puts}, but doesn't print anything if the `--quiet` option is set.
132
+ #
133
+ # @param args [Array] Passed on to \{Kernel.puts}
134
+ def puts(*args)
135
+ return if @options[:for_engine][:quiet]
136
+ Kernel.puts(*args)
137
+ end
138
+
130
139
  # Wraps the given string in terminal escapes
131
140
  # causing it to have the given color.
132
141
  # If terminal esapes aren't supported on this platform,
@@ -103,13 +103,6 @@ require 'hpricot'
103
103
  # @private
104
104
  HAML_TAGS = %w[haml:block haml:loud haml:silent]
105
105
 
106
- Hpricot::ElementContent.keys.each do |k|
107
- HAML_TAGS.each do |el|
108
- val = Hpricot::ElementContent[k]
109
- val[el.hash] = true if val.is_a?(Hash)
110
- end
111
- end
112
-
113
106
  HAML_TAGS.each do |t|
114
107
  Hpricot::ElementContent[t] = {}
115
108
  Hpricot::ElementContent.keys.each do |key|
@@ -117,6 +110,13 @@ HAML_TAGS.each do |t|
117
110
  end
118
111
  end
119
112
 
113
+ Hpricot::ElementContent.keys.each do |k|
114
+ HAML_TAGS.each do |el|
115
+ val = Hpricot::ElementContent[k]
116
+ val[el.hash] = true if val.is_a?(Hash)
117
+ end
118
+ end
119
+
120
120
  module Haml
121
121
  # Converts HTML documents into Haml templates.
122
122
  # Depends on [Hpricot](http://github.com/whymirror/hpricot) for HTML parsing.
@@ -16,6 +16,11 @@ module Haml
16
16
  # @api public
17
17
  RUBY_VERSION = ::RUBY_VERSION.split(".").map {|s| s.to_i}
18
18
 
19
+ # The Ruby engine we're running under. Defaults to `"ruby"`
20
+ # if the top-level constant is undefined.
21
+ # @api public
22
+ RUBY_ENGINE = defined?(::RUBY_ENGINE) ? ::RUBY_ENGINE : "ruby"
23
+
19
24
  # Returns the path of a file relative to the Haml root directory.
20
25
  #
21
26
  # @param file [String] The filename relative to the Haml root
@@ -476,13 +481,25 @@ WARNING
476
481
  RbConfig::CONFIG['host_os'] =~ /mswin|windows|mingw/i
477
482
  end
478
483
 
484
+ # Whether or not this is running on IronRuby.
485
+ #
486
+ # @return [Boolean]
487
+ def ironruby?
488
+ RUBY_ENGINE == "ironruby"
489
+ end
490
+
479
491
  ## Cross-Ruby-Version Compatibility
480
492
 
481
493
  # Whether or not this is running under Ruby 1.8 or lower.
482
494
  #
495
+ # Note that IronRuby counts as Ruby 1.8,
496
+ # because it doesn't support the Ruby 1.9 encoding API.
497
+ #
483
498
  # @return [Boolean]
484
499
  def ruby1_8?
485
- Haml::Util::RUBY_VERSION[0] == 1 && Haml::Util::RUBY_VERSION[1] < 9
500
+ # IronRuby says its version is 1.9, but doesn't support any of the encoding APIs.
501
+ # We have to fall back to 1.8 behavior.
502
+ ironruby? || (Haml::Util::RUBY_VERSION[0] == 1 && Haml::Util::RUBY_VERSION[1] < 9)
486
503
  end
487
504
 
488
505
  # Whether or not this is running under Ruby 1.8.6 or lower.
@@ -421,6 +421,20 @@ HAML
421
421
  <tr></tr>
422
422
  <% end %>
423
423
  </table>
424
+ ERB
425
+ end
426
+
427
+ def test_silent_inside_block_inside_tag
428
+ assert_equal(<<HAML.rstrip, render_erb(<<ERB))
429
+ %table
430
+ - foo.each do
431
+ - haml_puts "foo"
432
+ HAML
433
+ <table>
434
+ <% foo.each do %>
435
+ <% haml_puts "foo" %>
436
+ <% end %>
437
+ </table>
424
438
  ERB
425
439
  end
426
440
  end
@@ -64,4 +64,12 @@ class Test::Unit::TestCase
64
64
  else
65
65
  flunk "Expected exception #{klass}, none raised"
66
66
  end
67
+
68
+ def assert_raise_line(line)
69
+ yield
70
+ rescue Sass::SyntaxError => e
71
+ assert_equal(line, e.sass_line)
72
+ else
73
+ flunk "Expected exception on line #{line}, none raised"
74
+ end
67
75
  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: 3.1.0.alpha.30
4
+ version: 3.1.0.alpha.33
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: 2010-10-31 00:00:00 -04:00
13
+ date: 2010-11-19 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -51,11 +51,11 @@ files:
51
51
  - lib/haml/error.rb
52
52
  - lib/haml/filters.rb
53
53
  - lib/haml/helpers.rb
54
- - lib/haml/util.rb
54
+ - lib/haml/html.rb
55
55
  - lib/haml/helpers/action_view_extensions.rb
56
56
  - lib/haml/helpers/action_view_mods.rb
57
57
  - lib/haml/helpers/xss_mods.rb
58
- - lib/haml/html.rb
58
+ - lib/haml/util.rb
59
59
  - lib/haml/html/erb.rb
60
60
  - lib/haml/railtie.rb
61
61
  - lib/haml/template.rb