haml 2.2.22 → 2.2.23

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/REMEMBER CHANGED
@@ -3,4 +3,11 @@ Make .#{} work in extend
3
3
  Test newly-invalid selectors, including post-resolution parse errors in Sass
4
4
  Be smart about default namespaces (http://www.w3.org/TR/css3-namespace/#declaration)
5
5
  Don't conflict with Object#extend.
6
+
6
7
  http://camendesign.com/design/ provides some interesting formatting and nesting issues for sass-convert
8
+ Charles Roper's example code for media queries doesn't fare well in css2sass either
9
+
10
+ Add period to SCSS syntax errors?
11
+ Better #{} in prop names
12
+ Faster than Less
13
+ Comma multiline for Haml
data/Rakefile CHANGED
@@ -72,7 +72,7 @@ at_exit { File.delete(scope('REVISION')) rescue nil }
72
72
 
73
73
  desc "Install Haml as a gem."
74
74
  task :install => [:package] do
75
- sudo = RUBY_PLATFORM =~ /win32/ ? '' : 'sudo'
75
+ sudo = RUBY_PLATFORM =~ /win32|mingw/ ? '' : 'sudo'
76
76
  gem = RUBY_PLATFORM =~ /java/ ? 'jgem' : 'gem'
77
77
  sh %{#{sudo} #{gem} install --no-ri pkg/haml-#{File.read(scope('VERSION')).strip}}
78
78
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.22
1
+ 2.2.23
data/init.rb CHANGED
@@ -7,7 +7,9 @@ rescue LoadError
7
7
  # gems:install may be run to install Haml with the skeleton plugin
8
8
  # but not the gem itself installed.
9
9
  # Don't die if this is the case.
10
- raise e unless defined?(Rake) && Rake.application.top_level_tasks.include?('gems:install')
10
+ raise e unless defined?(Rake) &&
11
+ (Rake.application.top_level_tasks.include?('gems') ||
12
+ Rake.application.top_level_tasks.include?('gems:install'))
11
13
  end
12
14
  end
13
15
 
@@ -100,7 +100,11 @@ module Haml
100
100
  if contains_interpolation?(text)
101
101
  return if options[:suppress_eval]
102
102
 
103
- text = unescape_interpolation(text).gsub("\\n", "\n")
103
+ text = unescape_interpolation(text).gsub(/(\\+)n/) do |s|
104
+ escapes = $1.size
105
+ next s if escapes % 2 == 0
106
+ ("\\" * (escapes - 1)) + "\n"
107
+ end
104
108
  newline if text.gsub!(/\n"\Z/, "\\n\"")
105
109
  push_script <<RUBY.strip, :escape_html => false
106
110
  find_and_preserve(#{filter.inspect}.render_with_options(#{text}, _hamlout.options))
@@ -502,7 +502,7 @@ END
502
502
  # @param text [String] The string to sanitize
503
503
  # @return [String] The sanitized string
504
504
  def html_escape(text)
505
- text.to_s.gsub(/[\"><&]/n) {|s| HTML_ESCAPE[s]}
505
+ Haml::Util.silence_warnings {text.to_s.gsub(/[\"><&]/n) {|s| HTML_ESCAPE[s]}}
506
506
  end
507
507
 
508
508
  # Escapes HTML entities in `text`, but without escaping an ampersand
@@ -125,9 +125,8 @@ module ActionView
125
125
  @template_object.send :is_haml?
126
126
  end
127
127
 
128
- unless defined?(ActionView::Helpers) && defined?(ActionView::Helpers::ActiveRecordInstanceTag)
129
- alias_method :content_tag_without_haml, :content_tag
130
- alias_method :content_tag, :content_tag_with_haml
128
+ def content_tag(*args)
129
+ content_tag_with_haml(*args)
131
130
  end
132
131
  end
133
132
 
@@ -85,7 +85,15 @@ If you really need #{filename}.css, import it explicitly.
85
85
  END
86
86
  return filename + '.css'
87
87
  end
88
- raise SyntaxError.new("File to import not found or unreadable: #{original_filename}.", @line)
88
+
89
+ message = "File to import not found or unreadable: #{original_filename}.\n"
90
+ if load_paths.size == 1
91
+ message << "Load path: #{load_paths.first}"
92
+ else
93
+ message << "Load paths:\n " << load_paths.join("\n ")
94
+ end
95
+
96
+ raise SyntaxError.new(message, @line)
89
97
  end
90
98
 
91
99
  private
@@ -204,8 +204,13 @@ END
204
204
 
205
205
  def dependency_updated?(css_mtime)
206
206
  lambda do |dep|
207
- File.mtime(dep) > css_mtime ||
208
- dependencies(dep).any?(&dependency_updated?(css_mtime))
207
+ begin
208
+ File.mtime(dep) > css_mtime ||
209
+ dependencies(dep).any?(&dependency_updated?(css_mtime))
210
+ rescue Sass::SyntaxError
211
+ # If there's an error finding depenencies, default to recompiling.
212
+ true
213
+ end
209
214
  end
210
215
  end
211
216
 
@@ -629,6 +629,15 @@ HAML
629
629
  assert_equal("<a href='#\"'></a>\n", render('%a(href="#\\"")'))
630
630
  end
631
631
 
632
+ def test_filter_with_newline_and_interp
633
+ assert_equal(<<HTML, render(<<HAML))
634
+ \\n
635
+ HTML
636
+ :plain
637
+ \\n\#{""}
638
+ HAML
639
+ end
640
+
632
641
  # HTML escaping tests
633
642
 
634
643
  def test_ampersand_equals_should_escape
@@ -55,7 +55,12 @@ MSG
55
55
  "a," => "Rules can\'t end in commas.",
56
56
  "a,\n!b = 1" => ["Rules can\'t end in commas.", 1],
57
57
  "!a = b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath variable declarations.",
58
- "@import foo.sass" => "File to import not found or unreadable: foo.sass.",
58
+ "@import foo.sass" => <<MSG,
59
+ File to import not found or unreadable: foo.sass.
60
+ Load paths:
61
+ #{File.dirname(__FILE__)}
62
+ .
63
+ MSG
59
64
  "@import templates/basic\n foo" => "Illegal nesting: Nothing may be nested beneath import directives.",
60
65
  "foo\n @import templates/basic" => "Import directives may only be used at the root of a document.",
61
66
  "foo\n @import #{File.dirname(__FILE__)}/templates/basic" => "Import directives may only be used at the root of a document.",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 2
8
- - 22
9
- version: 2.2.22
8
+ - 23
9
+ version: 2.2.23
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nathan Weizenbaum
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-03-22 00:00:00 -07:00
18
+ date: 2010-04-11 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency