haml 3.1.8 → 3.2.0.alpha.2
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/CONTRIBUTING +1 -1
- data/README.md +2 -2
- data/REVISION +1 -1
- data/Rakefile +16 -41
- data/VERSION +1 -1
- data/VERSION_NAME +1 -1
- data/lib/haml/buffer.rb +1 -5
- data/lib/haml/compiler.rb +7 -8
- data/lib/haml/exec.rb +1 -1
- data/lib/haml/helpers.rb +3 -5
- data/lib/haml/helpers/action_view_mods.rb +5 -21
- data/lib/haml/parser.rb +1 -1
- data/lib/haml/template.rb +1 -3
- data/lib/haml/util.rb +1 -1
- data/test/haml/engine_test.rb +12 -51
- data/test/haml/helper_test.rb +8 -25
- data/test/haml/html2haml_test.rb +1 -1
- data/test/haml/results/whitespace_handling.xhtml +50 -46
- data/test/haml/template_test.rb +2 -28
- data/test/haml/templates/partial_layout.haml +1 -4
- data/test/linked_rails.rb +4 -4
- data/vendor/sass/VERSION +1 -1
- data/vendor/sass/doc-src/SASS_CHANGELOG.md +2 -115
- data/vendor/sass/doc-src/SASS_REFERENCE.md +4 -12
- data/vendor/sass/lib/sass.rb +0 -1
- data/vendor/sass/lib/sass/cache_stores/base.rb +1 -3
- data/vendor/sass/lib/sass/cache_stores/filesystem.rb +0 -2
- data/vendor/sass/lib/sass/css.rb +1 -2
- data/vendor/sass/lib/sass/engine.rb +23 -39
- data/vendor/sass/lib/sass/environment.rb +0 -11
- data/vendor/sass/lib/sass/exec.rb +1 -14
- data/vendor/sass/lib/sass/importers/base.rb +1 -2
- data/vendor/sass/lib/sass/importers/filesystem.rb +13 -18
- data/vendor/sass/lib/sass/less.rb +2 -2
- data/vendor/sass/lib/sass/plugin.rb +8 -4
- data/vendor/sass/lib/sass/plugin/compiler.rb +17 -42
- data/vendor/sass/lib/sass/plugin/configuration.rb +2 -0
- data/vendor/sass/lib/sass/railtie.rb +1 -1
- data/vendor/sass/lib/sass/script/funcall.rb +1 -14
- data/vendor/sass/lib/sass/script/functions.rb +1 -44
- data/vendor/sass/lib/sass/script/interpolation.rb +0 -9
- data/vendor/sass/lib/sass/script/lexer.rb +1 -6
- data/vendor/sass/lib/sass/script/list.rb +0 -7
- data/vendor/sass/lib/sass/script/literal.rb +0 -5
- data/vendor/sass/lib/sass/script/node.rb +0 -8
- data/vendor/sass/lib/sass/script/number.rb +5 -28
- data/vendor/sass/lib/sass/script/operation.rb +0 -8
- data/vendor/sass/lib/sass/script/parser.rb +5 -12
- data/vendor/sass/lib/sass/script/string_interpolation.rb +0 -9
- data/vendor/sass/lib/sass/script/unary_operation.rb +0 -7
- data/vendor/sass/lib/sass/script/variable.rb +0 -5
- data/vendor/sass/lib/sass/scss/parser.rb +38 -78
- data/vendor/sass/lib/sass/scss/rx.rb +1 -2
- data/vendor/sass/lib/sass/scss/static_parser.rb +2 -2
- data/vendor/sass/lib/sass/shared.rb +1 -1
- data/vendor/sass/lib/sass/tree/comment_node.rb +11 -24
- data/vendor/sass/lib/sass/tree/debug_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/each_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/extend_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/for_node.rb +2 -2
- data/vendor/sass/lib/sass/tree/function_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/if_node.rb +14 -1
- data/vendor/sass/lib/sass/tree/mixin_def_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/mixin_node.rb +2 -2
- data/vendor/sass/lib/sass/tree/node.rb +5 -2
- data/vendor/sass/lib/sass/tree/prop_node.rb +9 -2
- data/vendor/sass/lib/sass/tree/return_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/rule_node.rb +2 -9
- data/vendor/sass/lib/sass/tree/variable_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/visitors/check_nesting.rb +18 -17
- data/vendor/sass/lib/sass/tree/visitors/convert.rb +5 -10
- data/vendor/sass/lib/sass/tree/visitors/perform.rb +19 -50
- data/vendor/sass/lib/sass/tree/visitors/to_css.rb +15 -9
- data/vendor/sass/lib/sass/tree/warn_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/while_node.rb +1 -1
- data/vendor/sass/lib/sass/util.rb +6 -58
- data/vendor/sass/sass.gemspec +1 -2
- data/vendor/sass/test/sass/cache_test.rb +0 -15
- data/vendor/sass/test/sass/conversion_test.rb +6 -2
- data/vendor/sass/test/sass/css2sass_test.rb +0 -9
- data/vendor/sass/test/sass/engine_test.rb +26 -124
- data/vendor/sass/test/sass/functions_test.rb +0 -13
- data/vendor/sass/test/sass/importer_test.rb +0 -110
- data/vendor/sass/test/sass/plugin_test.rb +13 -16
- data/vendor/sass/test/sass/script_conversion_test.rb +0 -2
- data/vendor/sass/test/sass/script_test.rb +0 -18
- data/vendor/sass/test/sass/scss/css_test.rb +1 -7
- data/vendor/sass/test/sass/scss/scss_test.rb +13 -37
- data/vendor/sass/test/sass/test_helper.rb +1 -1
- data/vendor/sass/test/sass/util_test.rb +0 -12
- data/vendor/sass/vendor/fssm/LICENSE +1 -1
- data/vendor/sass/vendor/fssm/README.markdown +27 -55
- data/vendor/sass/vendor/fssm/Rakefile +54 -6
- data/vendor/sass/vendor/fssm/VERSION.yml +5 -0
- data/vendor/sass/vendor/fssm/example.rb +3 -6
- data/vendor/sass/vendor/fssm/fssm.gemspec +70 -17
- data/vendor/sass/vendor/fssm/lib/fssm.rb +3 -7
- data/vendor/sass/vendor/fssm/lib/fssm/backends/fsevents.rb +1 -1
- data/vendor/sass/vendor/fssm/lib/fssm/backends/inotify.rb +2 -2
- data/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb +2 -2
- data/vendor/sass/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +10 -10
- data/vendor/sass/vendor/fssm/lib/fssm/monitor.rb +9 -19
- data/vendor/sass/vendor/fssm/lib/fssm/path.rb +21 -24
- data/vendor/sass/vendor/fssm/lib/fssm/pathname.rb +479 -13
- data/vendor/sass/vendor/fssm/lib/fssm/state/directory.rb +11 -29
- data/vendor/sass/vendor/fssm/lib/fssm/state/file.rb +1 -1
- data/vendor/sass/vendor/fssm/lib/fssm/support.rb +12 -41
- data/vendor/sass/vendor/fssm/lib/fssm/tree.rb +6 -6
- data/vendor/sass/vendor/fssm/profile/prof-cache.rb +3 -3
- data/vendor/sass/vendor/fssm/profile/prof-pathname.rb +7 -7
- data/vendor/sass/vendor/fssm/spec/path_spec.rb +15 -36
- data/vendor/sass/vendor/fssm/spec/spec_helper.rb +6 -6
- metadata +78 -125
- data/lib/haml/helpers/rails_323_textarea_fix.rb +0 -41
- data/test/gemfiles/Gemfile.rails-2.0.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.0.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.1.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.1.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.2.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.2.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.3.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.3.x.lock +0 -40
- data/test/gemfiles/Gemfile.rails-3.0.x +0 -8
- data/test/gemfiles/Gemfile.rails-3.0.x.lock +0 -85
- data/test/gemfiles/Gemfile.rails-3.1.x +0 -8
- data/test/gemfiles/Gemfile.rails-3.1.x.lock +0 -97
- data/test/gemfiles/Gemfile.rails-3.2.x +0 -8
- data/test/gemfiles/Gemfile.rails-3.2.x.lock +0 -95
- data/test/gemfiles/Gemfile.rails-xss-2.3.x +0 -9
- data/test/gemfiles/Gemfile.rails-xss-2.3.x.lock +0 -42
- data/vendor/sass/lib/sass/logger.rb +0 -15
- data/vendor/sass/lib/sass/logger/base.rb +0 -32
- data/vendor/sass/lib/sass/logger/log_level.rb +0 -49
- data/vendor/sass/lib/sass/tree/visitors/deep_copy.rb +0 -87
- data/vendor/sass/lib/sass/tree/visitors/set_options.rb +0 -97
- data/vendor/sass/test/Gemfile +0 -4
- data/vendor/sass/test/Gemfile.lock +0 -19
- data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.css +0 -1
- data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.scss +0 -1
- data/vendor/sass/test/sass/logger_test.rb +0 -58
- data/vendor/sass/test/sass/templates/bork5.sass +0 -3
- data/vendor/sass/test/sass/templates/nested_bork5.sass +0 -2
- data/vendor/sass/vendor/fssm/Gemfile +0 -3
- data/vendor/sass/vendor/fssm/lib/fssm/backends/rbfsevent.rb +0 -42
- data/vendor/sass/vendor/fssm/lib/fssm/version.rb +0 -3
- data/vendor/sass/vendor/fssm/profile/prof-pathname-rubinius.rb +0 -35
- data/vendor/sass/vendor/fssm/spec/count_down_latch.rb +0 -151
- data/vendor/sass/vendor/fssm/spec/monitor_spec.rb +0 -202
data/CONTRIBUTING
CHANGED
data/README.md
CHANGED
@@ -31,7 +31,7 @@ and both Haml and Sass will be installed.
|
|
31
31
|
Views with the `.html.haml` extension will automatically use Haml.
|
32
32
|
|
33
33
|
To use Haml programatically,
|
34
|
-
check out the [YARD documentation](http://haml.
|
34
|
+
check out the [YARD documentation](http://haml-lang.com/docs/yardoc/).
|
35
35
|
|
36
36
|
## Formatting
|
37
37
|
|
@@ -98,7 +98,7 @@ like `if` and `while`:
|
|
98
98
|
= "Happy new " + "year!"
|
99
99
|
|
100
100
|
Haml provides far more tools than those presented here.
|
101
|
-
Check out the [reference documentation](http://haml.
|
101
|
+
Check out the [reference documentation](http://beta.haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html)
|
102
102
|
for full details.
|
103
103
|
|
104
104
|
### Indentation
|
data/REVISION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
5f04bbda570a41acfb1d5d8ac971ae99c1ae7046
|
data/Rakefile
CHANGED
@@ -69,7 +69,7 @@ task :permissions do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
task :revision_file do
|
72
|
-
require
|
72
|
+
require 'lib/haml'
|
73
73
|
|
74
74
|
release = Rake.application.top_level_tasks.include?('release') || File.exist?(scope('EDGE_GEM_VERSION'))
|
75
75
|
if Haml.version[:rev] && !release
|
@@ -304,9 +304,7 @@ rescue LoadError; end
|
|
304
304
|
# ----- Testing Multiple Rails Versions -----
|
305
305
|
|
306
306
|
rails_versions = [
|
307
|
-
"
|
308
|
-
"v3.0.10",
|
309
|
-
"v2.3.14",
|
307
|
+
"v2.3.5",
|
310
308
|
"v2.2.3",
|
311
309
|
"v2.1.2",
|
312
310
|
]
|
@@ -321,45 +319,22 @@ def test_rails_version(version)
|
|
321
319
|
Rake::Task['test'].execute
|
322
320
|
end
|
323
321
|
|
324
|
-
def gemfiles
|
325
|
-
@gemfiles ||=
|
326
|
-
begin
|
327
|
-
raise 'Must install bundler to run Rails compatibility tests' if `which bundle`.empty?
|
328
|
-
Dir[File.dirname(__FILE__) + '/test/gemfiles/Gemfile.*'].
|
329
|
-
reject {|f| f =~ /\.lock$/}.
|
330
|
-
reject {|f| RUBY_VERSION !~ /^1\.8/ && f =~ /Gemfile\.rails-2\.[0-2]/}
|
331
|
-
end
|
332
|
-
end
|
333
|
-
|
334
|
-
def with_each_gemfile
|
335
|
-
old_env = ENV['BUNDLE_GEMFILE']
|
336
|
-
gemfiles.each do |gemfile|
|
337
|
-
puts "Using gemfile: #{gemfile}"
|
338
|
-
ENV['BUNDLE_GEMFILE'] = gemfile
|
339
|
-
yield
|
340
|
-
end
|
341
|
-
ensure
|
342
|
-
ENV['BUNDLE_GEMFILE'] = old_env
|
343
|
-
end
|
344
|
-
|
345
322
|
namespace :test do
|
346
|
-
namespace :bundles do
|
347
|
-
desc "Install all dependencies necessary to test Haml."
|
348
|
-
task :install do
|
349
|
-
with_each_gemfile {sh "bundle install"}
|
350
|
-
end
|
351
|
-
|
352
|
-
desc "Update all dependencies for testing Haml."
|
353
|
-
task :update do
|
354
|
-
with_each_gemfile {sh "bundle update"}
|
355
|
-
end
|
356
|
-
end
|
357
|
-
|
358
323
|
desc "Test all supported versions of rails. This takes a while."
|
359
|
-
task :rails_compatibility
|
360
|
-
|
361
|
-
|
362
|
-
|
324
|
+
task :rails_compatibility do
|
325
|
+
sh %{rm -rf test/rails}
|
326
|
+
puts "Checking out rails. Please wait."
|
327
|
+
sh %{git clone git://github.com/rails/rails.git test/rails}
|
328
|
+
begin
|
329
|
+
rails_versions.each {|version| test_rails_version version}
|
330
|
+
|
331
|
+
puts "Checking out rails_xss. Please wait."
|
332
|
+
sh %{git clone git://github.com/NZKoz/rails_xss.git test/plugins/rails_xss}
|
333
|
+
test_rails_version(rails_versions.find {|s| s =~ /^v2\.3/})
|
334
|
+
ensure
|
335
|
+
`rm -rf test/rails`
|
336
|
+
`rm -rf test/plugins`
|
337
|
+
end
|
363
338
|
end
|
364
339
|
end
|
365
340
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.2.0.alpha.2
|
data/VERSION_NAME
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Bleeding Edge
|
data/lib/haml/buffer.rb
CHANGED
@@ -97,8 +97,6 @@ module Haml
|
|
97
97
|
# The number of tabs that Engine thinks we should have
|
98
98
|
# @real_tabs + @tabulation is the number of tabs actually output
|
99
99
|
@real_tabs = 0
|
100
|
-
|
101
|
-
@preserve_pattern = /<[\s]*#{@options[:preserve].join("|")}/i
|
102
100
|
end
|
103
101
|
|
104
102
|
# Appends text to the buffer, properly tabulated.
|
@@ -159,9 +157,7 @@ module Haml
|
|
159
157
|
return result
|
160
158
|
<% else %>
|
161
159
|
|
162
|
-
|
163
|
-
|
164
|
-
has_newline = result.include?("\\n")
|
160
|
+
has_newline = result.include?("\\n")
|
165
161
|
<% if in_tag && !nuke_inner_whitespace %>
|
166
162
|
<% unless preserve_tag %> if !has_newline <% end %>
|
167
163
|
@real_tabs -= 1
|
data/lib/haml/compiler.rb
CHANGED
@@ -18,7 +18,7 @@ END
|
|
18
18
|
postamble = <<END.gsub("\n", ";")
|
19
19
|
#{precompiled_method_return_value}
|
20
20
|
ensure
|
21
|
-
@haml_buffer = @haml_buffer.upper
|
21
|
+
@haml_buffer = @haml_buffer.upper
|
22
22
|
end
|
23
23
|
END
|
24
24
|
preamble + locals_code(local_names) + precompiled + postamble
|
@@ -156,8 +156,8 @@ END
|
|
156
156
|
|
157
157
|
if value && !parse
|
158
158
|
concat_merged_text("#{value}</#{t[:name]}>#{t[:nuke_outer_whitespace] ? "" : "\n"}")
|
159
|
-
|
160
|
-
@to_merge << [:text, '', 1]
|
159
|
+
else
|
160
|
+
@to_merge << [:text, '', 1] unless t[:nuke_inner_whitespace]
|
161
161
|
end
|
162
162
|
|
163
163
|
@dont_indent_next_line = dont_indent_next_line
|
@@ -251,9 +251,8 @@ END
|
|
251
251
|
def push_silent(text, can_suppress = false)
|
252
252
|
flush_merged_text
|
253
253
|
return if can_suppress && options[:suppress_eval]
|
254
|
-
|
255
|
-
@
|
256
|
-
@output_line += (text + newline).count("\n")
|
254
|
+
@precompiled << "#{resolve_newlines}#{text}\n"
|
255
|
+
@output_line += text.count("\n") + 1
|
257
256
|
end
|
258
257
|
|
259
258
|
# Adds `text` to `@buffer` with appropriate tabulation
|
@@ -373,14 +372,14 @@ END
|
|
373
372
|
if escape_attrs == :once
|
374
373
|
Haml::Helpers.escape_once(value.to_s)
|
375
374
|
elsif escape_attrs
|
376
|
-
|
375
|
+
CGI.escapeHTML(value.to_s)
|
377
376
|
else
|
378
377
|
value.to_s
|
379
378
|
end
|
380
379
|
value = Haml::Helpers.preserve(escaped)
|
381
380
|
if escape_attrs
|
382
381
|
# We want to decide whether or not to escape quotes
|
383
|
-
value
|
382
|
+
value.gsub!('"', '"')
|
384
383
|
this_attr_wrapper = attr_wrapper
|
385
384
|
if value.include? attr_wrapper
|
386
385
|
if value.include? other_quote_char
|
data/lib/haml/exec.rb
CHANGED
data/lib/haml/helpers.rb
CHANGED
@@ -107,9 +107,7 @@ MESSAGE
|
|
107
107
|
# @yield The block within which to escape newlines
|
108
108
|
def find_and_preserve(input = nil, tags = haml_buffer.options[:preserve], &block)
|
109
109
|
return find_and_preserve(capture_haml(&block), input || tags) if block
|
110
|
-
|
111
|
-
input.to_s.gsub(re) do |s|
|
112
|
-
s =~ re # Can't rely on $1, etc. existing since Rails' SafeBuffer#gsub is incompatible
|
110
|
+
input.to_s.gsub(/<(#{tags.map(&Regexp.method(:escape)).join('|')})([^>]*)>(.*?)(<\/\1>)/im) do
|
113
111
|
"<#{$1}#{$2}>#{preserve($3)}</#{$1}>"
|
114
112
|
end
|
115
113
|
end
|
@@ -172,10 +170,10 @@ MESSAGE
|
|
172
170
|
result = capture_haml(i, &block)
|
173
171
|
|
174
172
|
if result.count("\n") > 1
|
175
|
-
result
|
173
|
+
result.gsub!("\n", "\n ")
|
176
174
|
result = "\n #{result.strip}\n"
|
177
175
|
else
|
178
|
-
result
|
176
|
+
result.strip!
|
179
177
|
end
|
180
178
|
|
181
179
|
"<li>#{result}</li>"
|
@@ -51,10 +51,7 @@ module ActionView
|
|
51
51
|
# We've got to do the same thing for compatibility.
|
52
52
|
|
53
53
|
if is_haml? && block_is_haml?(block)
|
54
|
-
|
55
|
-
buffer = capture_haml(*args) { value = yield(*args) }
|
56
|
-
return buffer unless buffer.empty?
|
57
|
-
return value if value.is_a?(String)
|
54
|
+
capture_haml(*args, &block)
|
58
55
|
else
|
59
56
|
capture_without_haml(*args, &block)
|
60
57
|
end
|
@@ -88,17 +85,7 @@ module ActionView
|
|
88
85
|
module CaptureHelper
|
89
86
|
def capture_with_haml(*args, &block)
|
90
87
|
if Haml::Helpers.block_is_haml?(block)
|
91
|
-
|
92
|
-
value = nil
|
93
|
-
buffer = capture_haml(*args) { value = yield(*args) }
|
94
|
-
str =
|
95
|
-
if !buffer.empty?
|
96
|
-
buffer
|
97
|
-
elsif value.is_a?(String)
|
98
|
-
value
|
99
|
-
else
|
100
|
-
''
|
101
|
-
end
|
88
|
+
str = capture_haml(*args, &block)
|
102
89
|
return ActionView::NonConcattingString.new(str) if defined?(ActionView::NonConcattingString)
|
103
90
|
return str
|
104
91
|
else
|
@@ -130,8 +117,7 @@ module ActionView
|
|
130
117
|
end
|
131
118
|
|
132
119
|
class InstanceTag
|
133
|
-
#
|
134
|
-
include Haml::Helpers
|
120
|
+
# Includes TagHelper
|
135
121
|
|
136
122
|
def haml_buffer
|
137
123
|
@template_object.send :haml_buffer
|
@@ -141,8 +127,8 @@ module ActionView
|
|
141
127
|
@template_object.send :is_haml?
|
142
128
|
end
|
143
129
|
|
144
|
-
def content_tag(*args
|
145
|
-
html_tag = content_tag_with_haml(*args
|
130
|
+
def content_tag(*args)
|
131
|
+
html_tag = content_tag_with_haml(*args)
|
146
132
|
return html_tag unless respond_to?(:error_wrapping)
|
147
133
|
return error_wrapping(html_tag) if method(:error_wrapping).arity == 1
|
148
134
|
return html_tag unless object.respond_to?(:errors) && object.errors.respond_to?(:on)
|
@@ -256,5 +242,3 @@ module ActionView
|
|
256
242
|
end
|
257
243
|
end
|
258
244
|
end
|
259
|
-
|
260
|
-
require "haml/helpers/rails_323_textarea_fix" if Haml::Util.ap_geq?("3.2.3")
|
data/lib/haml/parser.rb
CHANGED
@@ -146,7 +146,7 @@ END
|
|
146
146
|
|
147
147
|
@tab_up = nil
|
148
148
|
process_line(@line.text, @line.index) unless @line.text.empty? || @haml_comment
|
149
|
-
if
|
149
|
+
if block_opened? || @tab_up
|
150
150
|
@template_tabs += 1
|
151
151
|
@parent = @parent.children.last
|
152
152
|
end
|
data/lib/haml/template.rb
CHANGED
@@ -54,9 +54,7 @@ end
|
|
54
54
|
# Patching was necessary for versions <= 2.0.1,
|
55
55
|
# but we can make it a normal handler for higher versions.
|
56
56
|
if defined?(ActionView::TemplateHandler) ||
|
57
|
-
(defined?(ActionView::Template) && defined?(ActionView::Template::Handler))
|
58
|
-
# Rails >= 3.2.0 uses Handlers instead of Handler
|
59
|
-
(defined?(ActionView::Template) && defined?(ActionView::Template::Handlers))
|
57
|
+
(defined?(ActionView::Template) && defined?(ActionView::Template::Handler))
|
60
58
|
require 'haml/template/plugin'
|
61
59
|
else
|
62
60
|
require 'haml/template/patch'
|
data/lib/haml/util.rb
CHANGED
@@ -347,7 +347,7 @@ module Haml
|
|
347
347
|
require 'sass/version'
|
348
348
|
loaded = Sass.respond_to?(:version) && Sass.version[:major] &&
|
349
349
|
Sass.version[:minor] && ((Sass.version[:major] > 3 && Sass.version[:minor] > 1) ||
|
350
|
-
((Sass.version[:major] == 3 && Sass.version[:minor]
|
350
|
+
((Sass.version[:major] == 3 && Sass.version[:minor] == 1) &&
|
351
351
|
(Sass.version[:prerelease] || Sass.version[:name] != "Bleeding Edge")))
|
352
352
|
rescue LoadError => e
|
353
353
|
loaded = false
|
data/test/haml/engine_test.rb
CHANGED
@@ -87,9 +87,6 @@ MESSAGE
|
|
87
87
|
"foo\n:plain\n 1\n 2\n \#{raise 'foo'}" => ["foo", 5],
|
88
88
|
"= raise 'foo'\nfoo\nbar\nbaz\nbang" => ["foo", 1],
|
89
89
|
"- case 1\n\n- when 1\n - raise 'foo'" => ["foo", 4],
|
90
|
-
"- tap do\n - tap do\n text\n- raise 'foo'" => ["foo", 4],
|
91
|
-
"- tap do\n - tap do\n text\n - raise 'foo'" => ["foo", 4],
|
92
|
-
"- tap do\n - tap do\n text\n text\n- raise 'foo'" => ["foo", 5],
|
93
90
|
}
|
94
91
|
|
95
92
|
User = Struct.new('User', :id)
|
@@ -191,11 +188,11 @@ MESSAGE
|
|
191
188
|
def test_dynamic_attributes_with_no_content
|
192
189
|
assert_equal(<<HTML, render(<<HAML))
|
193
190
|
<p>
|
194
|
-
<a href='http://haml.
|
191
|
+
<a href='http://haml-lang.com'></a>
|
195
192
|
</p>
|
196
193
|
HTML
|
197
194
|
%p
|
198
|
-
%a{:href => "http://" + "haml.
|
195
|
+
%a{:href => "http://" + "haml-lang.com"}
|
199
196
|
HAML
|
200
197
|
end
|
201
198
|
|
@@ -385,41 +382,8 @@ SOURCE
|
|
385
382
|
assert_equal("<p foo='bar'></p>\n", render('%p{:foo => "bar"}', :attr_wrapper => nil))
|
386
383
|
end
|
387
384
|
|
388
|
-
def test_comment_with_crazy_nesting
|
389
|
-
assert_equal(<<HTML, render(<<HAML))
|
390
|
-
foo
|
391
|
-
bar
|
392
|
-
HTML
|
393
|
-
foo
|
394
|
-
-#
|
395
|
-
ul
|
396
|
-
%li{
|
397
|
-
foo
|
398
|
-
bar
|
399
|
-
HAML
|
400
|
-
end
|
401
|
-
|
402
385
|
# Regression tests
|
403
386
|
|
404
|
-
unless Haml::Util.ruby1_8?
|
405
|
-
def test_indentation_after_dynamic_attr_hash
|
406
|
-
assert_equal(<<HTML, render(<<HAML))
|
407
|
-
<html>
|
408
|
-
<body>
|
409
|
-
<img src='test' />
|
410
|
-
foo
|
411
|
-
bar
|
412
|
-
</body>
|
413
|
-
</html>
|
414
|
-
HTML
|
415
|
-
%html
|
416
|
-
%body
|
417
|
-
%img{:src => 'te'+'st'}
|
418
|
-
= "foo\\nbar"
|
419
|
-
HAML
|
420
|
-
end
|
421
|
-
end
|
422
|
-
|
423
387
|
def test_whitespace_nuke_with_both_newlines
|
424
388
|
assert_equal("<p>foo</p>\n", render('%p<= "\nfoo\n"'))
|
425
389
|
assert_equal(<<HTML, render(<<HAML))
|
@@ -1215,20 +1179,17 @@ HAML
|
|
1215
1179
|
assert_equal(expected_message, err.message, "Line: #{key}")
|
1216
1180
|
end
|
1217
1181
|
|
1218
|
-
if
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
bt
|
1182
|
+
if Haml::Util.ruby1_8?
|
1183
|
+
# Sometimes, the first backtrace entry is *only* in the message.
|
1184
|
+
# No idea why.
|
1185
|
+
bt =
|
1186
|
+
if expected_message == :compile && err.message.include?("\n")
|
1187
|
+
err.message.split("\n", 2)[1]
|
1188
|
+
else
|
1189
|
+
err.backtrace[0]
|
1190
|
+
end
|
1191
|
+
assert_match(/^#{Regexp.escape(__FILE__)}:#{line_no}/, bt, "Line: #{key}")
|
1228
1192
|
end
|
1229
|
-
|
1230
|
-
source_location = bt.split(":", 3).first(2).join(":")
|
1231
|
-
assert_equal("#{__FILE__}:#{line_no}", source_location, "Line: #{key}")
|
1232
1193
|
else
|
1233
1194
|
assert(false, "Exception not raised for\n#{key}")
|
1234
1195
|
end
|
data/test/haml/helper_test.rb
CHANGED
@@ -133,30 +133,17 @@ HTML
|
|
133
133
|
HAML
|
134
134
|
end
|
135
135
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
render('= text_area_tag "body", "Foo\nBar\n Baz\n Boom"', :action_view))
|
136
|
+
def test_text_area
|
137
|
+
assert_equal(%(<textarea id="body" name="body">Foo
Bar
 Baz
 Boom</textarea>\n),
|
138
|
+
render('= text_area_tag "body", "Foo\nBar\n Baz\n Boom"', :action_view))
|
140
139
|
|
141
|
-
|
142
|
-
|
140
|
+
assert_equal(%(<textarea cols="40" id="post_body" name="post[body]" rows="20">Foo bar
baz</textarea>\n),
|
141
|
+
render('= text_area :post, :body', :action_view))
|
143
142
|
|
144
|
-
|
145
|
-
|
146
|
-
end
|
147
|
-
else
|
148
|
-
def test_text_area
|
149
|
-
assert_equal(%(<textarea id="body" name="body">Foo
Bar
 Baz
 Boom</textarea>\n),
|
150
|
-
render('= text_area_tag "body", "Foo\nBar\n Baz\n Boom"', :action_view))
|
151
|
-
|
152
|
-
assert_equal(%(<textarea cols="40" id="post_body" name="post[body]" rows="20">Foo bar
baz</textarea>\n),
|
153
|
-
render('= text_area :post, :body', :action_view))
|
154
|
-
|
155
|
-
assert_equal(%(<pre>Foo bar
 baz</pre>\n),
|
156
|
-
render('= content_tag "pre", "Foo bar\n baz"', :action_view))
|
157
|
-
end
|
143
|
+
assert_equal(%(<pre>Foo bar
 baz</pre>\n),
|
144
|
+
render('= content_tag "pre", "Foo bar\n baz"', :action_view))
|
158
145
|
end
|
159
|
-
|
146
|
+
|
160
147
|
def test_capture_haml
|
161
148
|
assert_equal(<<HTML, render(<<HAML))
|
162
149
|
"<p>13</p>\\n"
|
@@ -370,10 +357,6 @@ HAML
|
|
370
357
|
assert_equal("1\n\n2\n\n3\n\n", render("- trc([1, 2, 3]) do |i|\n = i.inspect"))
|
371
358
|
end
|
372
359
|
|
373
|
-
def test_capture_with_string_block
|
374
|
-
assert_equal("foo\n", render("= capture { 'foo' }", :action_view))
|
375
|
-
end
|
376
|
-
|
377
360
|
def test_find_and_preserve_with_block
|
378
361
|
assert_equal("<pre>Foo
Bar</pre>\nFoo\nBar\n",
|
379
362
|
render("= find_and_preserve do\n %pre\n Foo\n Bar\n Foo\n Bar"))
|