haml 3.0.12 → 3.0.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/Rakefile +1 -1
- data/VERSION +1 -1
- data/extra/haml-mode.el +1 -1
- data/extra/sass-mode.el +10 -9
- data/lib/haml/exec.rb +3 -0
- data/lib/haml/railtie.rb +13 -21
- data/lib/haml/util.rb +1 -0
- data/lib/sass/engine.rb +27 -10
- data/lib/sass/plugin.rb +7 -2
- data/lib/sass/plugin/configuration.rb +4 -7
- data/lib/sass/plugin/generic.rb +15 -0
- data/lib/sass/plugin/rails.rb +1 -20
- data/lib/sass/script/lexer.rb +2 -2
- data/lib/sass/scss/parser.rb +17 -6
- data/lib/sass/scss/rx.rb +1 -0
- data/lib/sass/scss/static_parser.rb +1 -7
- data/lib/sass/selector.rb +15 -7
- data/lib/sass/selector/comma_sequence.rb +7 -0
- data/lib/sass/selector/simple.rb +2 -2
- data/test/haml/helper_test.rb +2 -2
- data/test/sass/conversion_test.rb +8 -1
- data/test/sass/engine_test.rb +15 -2
- data/test/sass/script_test.rb +12 -0
- data/test/sass/scss/css_test.rb +16 -1
- data/test/sass/scss/scss_test.rb +15 -2
- data/test/sass/templates/import.sass +1 -1
- data/test/test_helper.rb +1 -1
- metadata +4 -3
data/Rakefile
CHANGED
@@ -97,7 +97,7 @@ task :release_elpa do
|
|
97
97
|
haml_unchanged = mode_unchanged?(:haml, version)
|
98
98
|
sass_unchanged = mode_unchanged?(:sass, version)
|
99
99
|
next if haml_unchanged && sass_unchanged
|
100
|
-
raise "haml-mode.el and sass-mode.el are out of sync." if haml_unchanged ^ sass_unchanged
|
100
|
+
raise "haml-mode.el and sass-mode.el are out of sync." if (!!haml_unchanged) ^ (!!sass_unchanged)
|
101
101
|
|
102
102
|
if sass_unchanged && File.read(scope("extra/sass-mode.el")).
|
103
103
|
include?(";; Package-Requires: ((haml-mode #{sass_unchanged.inspect}))")
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.13
|
data/extra/haml-mode.el
CHANGED
data/extra/sass-mode.el
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
|
5
5
|
;; Author: Nathan Weizenbaum
|
6
6
|
;; URL: http://github.com/nex3/haml/tree/master
|
7
|
-
;; Version: 3.0.
|
7
|
+
;; Version: 3.0.13
|
8
8
|
;; Created: 2007-03-15
|
9
9
|
;; By: Nathan Weizenbaum
|
10
10
|
;; Keywords: markup, language, css
|
11
|
-
;; Package-Requires: ((haml-mode "3.0.
|
11
|
+
;; Package-Requires: ((haml-mode "3.0.13"))
|
12
12
|
|
13
13
|
;;; Commentary:
|
14
14
|
|
@@ -43,11 +43,12 @@
|
|
43
43
|
:group 'sass)
|
44
44
|
|
45
45
|
(defvar sass-non-block-openers
|
46
|
-
'("
|
47
|
-
"^
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
'("^.*,$" ;; Continued selectors
|
47
|
+
"^ *@\\(extend\\|debug\\|warn\\|include\\|import\\)" ;; Single-line mixins
|
48
|
+
"^ *[$!]" ;; Variables
|
49
|
+
)
|
50
|
+
"A list of regexps that match lines of Sass that couldn't have
|
51
|
+
text nested beneath them.")
|
51
52
|
|
52
53
|
;; Font lock
|
53
54
|
|
@@ -195,8 +196,8 @@ LIMIT is the limit of the search."
|
|
195
196
|
(defun sass-indent-p ()
|
196
197
|
"Return non-nil if the current line can have lines nested beneath it."
|
197
198
|
(loop for opener in sass-non-block-openers
|
198
|
-
|
199
|
-
return
|
199
|
+
if (looking-at opener) return nil
|
200
|
+
finally return t))
|
200
201
|
|
201
202
|
;;;###autoload
|
202
203
|
(add-to-list 'auto-mode-alist '("\\.sass$" . sass-mode))
|
data/lib/haml/exec.rb
CHANGED
@@ -317,6 +317,9 @@ END
|
|
317
317
|
opts.on('-I', '--load-path PATH', 'Add a sass import path.') do |path|
|
318
318
|
@options[:for_engine][:load_paths] << path
|
319
319
|
end
|
320
|
+
opts.on('-r', '--require LIB', 'Require a Ruby library before running Sass.') do |lib|
|
321
|
+
require lib
|
322
|
+
end
|
320
323
|
opts.on('--cache-location PATH', 'The path to put cached Sass files. Defaults to .sass-cache.') do |loc|
|
321
324
|
@options[:for_engine][:cache_location] = loc
|
322
325
|
end
|
data/lib/haml/railtie.rb
CHANGED
@@ -1,29 +1,21 @@
|
|
1
|
+
if Haml::Util.ap_geq_3? && !Haml::Util.ap_geq?("3.0.0.beta4")
|
2
|
+
raise <<ERROR
|
3
|
+
Haml and Sass no longer support Rails 3 versions before beta 4.
|
4
|
+
Please upgrade to Rails 3.0.0.beta4 or later.
|
5
|
+
ERROR
|
6
|
+
end
|
7
|
+
|
1
8
|
# Rails 3.0.0.beta.2+
|
2
9
|
if defined?(ActiveSupport) && Haml::Util.has?(:public_method, ActiveSupport, :on_load)
|
3
10
|
require 'haml/template/options'
|
4
11
|
require 'sass/plugin/configuration'
|
5
|
-
ActiveSupport.on_load(:
|
6
|
-
|
12
|
+
ActiveSupport.on_load(:before_initialize) do
|
13
|
+
require 'sass'
|
14
|
+
require 'sass/plugin'
|
15
|
+
|
16
|
+
# Haml requires AV, but Sass doesn't
|
17
|
+
ActiveSupport.on_load(:action_view) do
|
7
18
|
Haml.init_rails(binding)
|
8
|
-
else
|
9
|
-
# I can't believe we have to do this, but we do.
|
10
|
-
# Rails 3's lovely lazy-loading means that it's possible to load ActionView
|
11
|
-
# before the application has even begin loading.
|
12
|
-
# This means that Rails.root doesn't exist yet.
|
13
|
-
# So if the application isn't loaded, we use this arcane initializer stuff
|
14
|
-
# to load Haml/Sass *after* the application loads.
|
15
|
-
#
|
16
|
-
# Of course, it's also possible that the application is loaded before ActionView,
|
17
|
-
# so we can't *just* rely on this method of loading.
|
18
|
-
#
|
19
|
-
# Ugh.
|
20
|
-
module Haml
|
21
|
-
class Railtie < Rails::Railtie
|
22
|
-
initializer :haml do
|
23
|
-
Haml.init_rails(binding)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
19
|
end
|
28
20
|
end
|
29
21
|
end
|
data/lib/haml/util.rb
CHANGED
@@ -441,6 +441,7 @@ MSG
|
|
441
441
|
# @raise [ArgumentError] if the document declares an unknown encoding
|
442
442
|
def check_haml_encoding(str, &block)
|
443
443
|
return check_encoding(str, &block) if ruby1_8?
|
444
|
+
str = str.dup if str.frozen?
|
444
445
|
|
445
446
|
bom, encoding = parse_haml_magic_comment(str)
|
446
447
|
if encoding; str.force_encoding(encoding)
|
data/lib/sass/engine.rb
CHANGED
@@ -509,16 +509,7 @@ WARNING
|
|
509
509
|
# If value begins with url( or ",
|
510
510
|
# it's a CSS @import rule and we don't want to touch it.
|
511
511
|
if directive == "import"
|
512
|
-
|
513
|
-
:line => @line + 1) unless line.children.empty?
|
514
|
-
if (match = value.match(Sass::SCSS::RX::STRING) || value.match(Sass::SCSS::RX::URI)) &&
|
515
|
-
!match.post_match.strip.empty? && match.post_match.strip[0] != ?,
|
516
|
-
return Tree::DirectiveNode.new("@import #{value}")
|
517
|
-
end
|
518
|
-
value.split(/,\s*/).map do |f|
|
519
|
-
f = $1 || $2 || $3 if f =~ Sass::SCSS::RX::STRING || f =~ Sass::SCSS::RX::URI
|
520
|
-
Tree::ImportNode.new(f)
|
521
|
-
end
|
512
|
+
parse_import(line, value)
|
522
513
|
elsif directive == "mixin"
|
523
514
|
parse_mixin_definition(line)
|
524
515
|
elsif directive == "include"
|
@@ -597,6 +588,32 @@ WARNING
|
|
597
588
|
nil
|
598
589
|
end
|
599
590
|
|
591
|
+
def parse_import(line, value)
|
592
|
+
raise SyntaxError.new("Illegal nesting: Nothing may be nested beneath import directives.",
|
593
|
+
:line => @line + 1) unless line.children.empty?
|
594
|
+
|
595
|
+
if (match = value.match(Sass::SCSS::RX::STRING) || value.match(Sass::SCSS::RX::URI)) &&
|
596
|
+
match.offset(0).first == 0 && !match.post_match.strip.empty? &&
|
597
|
+
match.post_match.strip[0] != ?,
|
598
|
+
# @import "filename" media-type
|
599
|
+
return Tree::DirectiveNode.new("@import #{value}")
|
600
|
+
end
|
601
|
+
|
602
|
+
value.split(/,\s*/).map do |f|
|
603
|
+
if f =~ Sass::SCSS::RX::URI
|
604
|
+
# All url()s are literal CSS @imports
|
605
|
+
next Tree::DirectiveNode.new("@import #{f}")
|
606
|
+
elsif f =~ Sass::SCSS::RX::STRING
|
607
|
+
f = $1 || $2
|
608
|
+
end
|
609
|
+
|
610
|
+
# http:// URLs are always literal CSS imports
|
611
|
+
next Tree::DirectiveNode.new("@import url(#{f})") if f =~ /^http:\/\//
|
612
|
+
|
613
|
+
Tree::ImportNode.new(f)
|
614
|
+
end
|
615
|
+
end
|
616
|
+
|
600
617
|
MIXIN_DEF_RE = /^(?:=|@mixin)\s*(#{Sass::SCSS::RX::IDENT})(.*)$/
|
601
618
|
def parse_mixin_definition(line)
|
602
619
|
name, arg_string = line.text.scan(MIXIN_DEF_RE).first
|
data/lib/sass/plugin.rb
CHANGED
@@ -265,5 +265,10 @@ module Sass
|
|
265
265
|
end
|
266
266
|
end
|
267
267
|
|
268
|
-
|
269
|
-
require 'sass/plugin/
|
268
|
+
if defined?(ActionController)
|
269
|
+
require 'sass/plugin/rails'
|
270
|
+
elsif defined?(Merb::Plugins)
|
271
|
+
require 'sass/plugin/merb'
|
272
|
+
else
|
273
|
+
require 'sass/plugin/generic'
|
274
|
+
end
|
@@ -117,12 +117,7 @@ module Sass
|
|
117
117
|
# The location of the CSS file that was deleted.
|
118
118
|
define_callback :deleting_css
|
119
119
|
|
120
|
-
@options = {
|
121
|
-
:css_location => './public/stylesheets',
|
122
|
-
:always_update => false,
|
123
|
-
:always_check => true,
|
124
|
-
:full_exception => true
|
125
|
-
}
|
120
|
+
@options = {:full_exception => true}
|
126
121
|
|
127
122
|
# An options hash.
|
128
123
|
# See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.
|
@@ -215,7 +210,9 @@ module Sass
|
|
215
210
|
return if options[:template_location].is_a?(Array)
|
216
211
|
options[:template_location] =
|
217
212
|
case options[:template_location]
|
218
|
-
when nil
|
213
|
+
when nil
|
214
|
+
css_location = options[:css_location] || './public/stylesheets'
|
215
|
+
[[File.join(css_location, 'sass'), css_location]]
|
219
216
|
when String; [[options[:template_location], options[:css_location]]]
|
220
217
|
else; options[:template_location].to_a
|
221
218
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# The reason some options are declared here rather than in sass/plugin/configuration.rb
|
2
|
+
# is that otherwise they'd clobber the Rails-specific options.
|
3
|
+
# Since Rails' options are lazy-loaded in Rails 3,
|
4
|
+
# they're reverse-merged with the default options
|
5
|
+
# so that user configuration is preserved.
|
6
|
+
# This means that defaults that differ from Rails'
|
7
|
+
# must be declared here.
|
8
|
+
|
9
|
+
unless defined?(Sass::GENERIC_LOADED)
|
10
|
+
Sass::GENERIC_LOADED = true
|
11
|
+
|
12
|
+
Sass::Plugin.options.merge!(:css_location => './public/stylesheets',
|
13
|
+
:always_update => false,
|
14
|
+
:always_check => true)
|
15
|
+
end
|
data/lib/sass/plugin/rails.rb
CHANGED
@@ -1,13 +1,4 @@
|
|
1
1
|
unless defined?(Sass::RAILS_LOADED)
|
2
|
-
if Haml::Util.ap_geq_3? && !Haml::Util.ap_geq?("3.0.0.beta4")
|
3
|
-
Haml::Util.haml_warn(<<WARNING)
|
4
|
-
DEPRECATION WARNING:
|
5
|
-
Haml/Sass support for Rails 3 versions before beta 4 is deprecated,
|
6
|
-
and will be removed in Haml/Sass 3.0.13.
|
7
|
-
Please upgrade to Rails 3.0.0.beta4 or later.
|
8
|
-
WARNING
|
9
|
-
end
|
10
|
-
|
11
2
|
Sass::RAILS_LOADED = true
|
12
3
|
|
13
4
|
# Reverse-merging (we're in Rails, anyway) so we dont' clobber what's already been defined further up-stream
|
@@ -21,17 +12,7 @@ WARNING
|
|
21
12
|
if defined?(ActionController::Metal)
|
22
13
|
# Rails >= 3.0
|
23
14
|
require 'sass/plugin/rack'
|
24
|
-
|
25
|
-
# The application has already been built,
|
26
|
-
# so we need to hack the middleware in
|
27
|
-
Rails.application.instance_variable_set('@app',
|
28
|
-
Sass::Plugin::Rack.new(Rails.application.app))
|
29
|
-
else
|
30
|
-
# The application hasn't been built yet,
|
31
|
-
# so we can just add Sass::Plugin::Rack
|
32
|
-
# to the pending middleware stack.
|
33
|
-
Rails.configuration.middleware.use(Sass::Plugin::Rack)
|
34
|
-
end
|
15
|
+
Rails.configuration.middleware.use(Sass::Plugin::Rack)
|
35
16
|
elsif defined?(ActionController::Dispatcher) &&
|
36
17
|
defined?(ActionController::Dispatcher.middleware)
|
37
18
|
# Rails >= 2.3
|
data/lib/sass/script/lexer.rb
CHANGED
@@ -92,7 +92,7 @@ module Sass
|
|
92
92
|
:number => /(-)?(?:(\d*\.\d+)|(\d+))([a-zA-Z%]+)?/,
|
93
93
|
:color => HEXCOLOR,
|
94
94
|
:bool => /(true|false)\b/,
|
95
|
-
:ident_op => %r{(#{Regexp.union(*IDENT_OP_NAMES.map{|s| Regexp.new(Regexp.escape(s) +
|
95
|
+
:ident_op => %r{(#{Regexp.union(*IDENT_OP_NAMES.map{|s| Regexp.new(Regexp.escape(s) + "(?!#{NMCHAR}|$)")})})},
|
96
96
|
:op => %r{(#{Regexp.union(*OP_NAMES)})},
|
97
97
|
}
|
98
98
|
|
@@ -292,7 +292,7 @@ MESSAGE
|
|
292
292
|
end
|
293
293
|
|
294
294
|
def special_fun
|
295
|
-
return unless str1 = scan(/(calc|expression|progid:[a-z\.]*)\(/i)
|
295
|
+
return unless str1 = scan(/((-[\w-]+-)?calc|expression|progid:[a-z\.]*)\(/i)
|
296
296
|
str2, _ = Haml::Shared.balance(@scanner, ?(, ?), 1)
|
297
297
|
c = str2.count("\n")
|
298
298
|
old_line = @line
|
data/lib/sass/scss/parser.rb
CHANGED
@@ -200,13 +200,13 @@ module Sass
|
|
200
200
|
|
201
201
|
def import_directive
|
202
202
|
@expected = "string or url()"
|
203
|
-
arg = tok(STRING) || tok!(URI)
|
203
|
+
arg = tok(STRING) || (uri = tok!(URI))
|
204
204
|
path = @scanner[1] || @scanner[2] || @scanner[3]
|
205
205
|
ss
|
206
206
|
|
207
207
|
media = str {media_query_list}.strip
|
208
208
|
|
209
|
-
if !media.strip.empty? || use_css_import?
|
209
|
+
if uri || path =~ /^http:\/\// || !media.strip.empty? || use_css_import?
|
210
210
|
return node(Sass::Tree::DirectiveNode.new("@import #{arg} #{media}".strip))
|
211
211
|
end
|
212
212
|
|
@@ -381,6 +381,17 @@ module Sass
|
|
381
381
|
sel.to_a
|
382
382
|
end
|
383
383
|
|
384
|
+
def selector_comma_sequence
|
385
|
+
return unless sel = _selector
|
386
|
+
selectors = [sel]
|
387
|
+
while tok(/,/)
|
388
|
+
ws = str{ss}
|
389
|
+
selectors << expr!(:_selector)
|
390
|
+
selectors[-1] = Selector::Sequence.new(["\n"] + selectors.last.members) if ws.include?("\n")
|
391
|
+
end
|
392
|
+
Selector::CommaSequence.new(selectors)
|
393
|
+
end
|
394
|
+
|
384
395
|
def _selector
|
385
396
|
# The combinator here allows the "> E" hack
|
386
397
|
return unless val = combinator || simple_selector_sequence
|
@@ -533,12 +544,12 @@ MESSAGE
|
|
533
544
|
end
|
534
545
|
|
535
546
|
def negation
|
536
|
-
return unless tok(NOT)
|
547
|
+
return unless name = tok(NOT) || tok(MOZ_ANY)
|
537
548
|
ss
|
538
549
|
@expected = "selector"
|
539
|
-
sel =
|
550
|
+
sel = selector_comma_sequence
|
540
551
|
tok!(/\)/)
|
541
|
-
Selector::
|
552
|
+
Selector::SelectorPseudoClass.new(name[1...-1], sel)
|
542
553
|
end
|
543
554
|
|
544
555
|
def declaration
|
@@ -722,7 +733,7 @@ MESSAGE
|
|
722
733
|
:interp_ident => "identifier",
|
723
734
|
:interp_name => "identifier",
|
724
735
|
:expr => "expression (e.g. 1px, bold)",
|
725
|
-
:
|
736
|
+
:selector_comma_sequence => "selector",
|
726
737
|
:simple_selector_sequence => "selector",
|
727
738
|
}
|
728
739
|
|
data/lib/sass/scss/rx.rb
CHANGED
@@ -109,6 +109,7 @@ module Sass
|
|
109
109
|
# Custom
|
110
110
|
HEXCOLOR = /\#[0-9a-fA-F]+/
|
111
111
|
INTERP_START = /#\{/
|
112
|
+
MOZ_ANY = quote(":-moz-any(", Regexp::IGNORECASE)
|
112
113
|
|
113
114
|
STRING1_NOINTERP = /\"((?:[^\n\r\f\\"#]|#(?!\{)|\\#{NL}|#{ESCAPE})*)\"/
|
114
115
|
STRING2_NOINTERP = /\'((?:[^\n\r\f\\'#]|#(?!\{)|\\#{NL}|#{ESCAPE})*)\'/
|
@@ -17,14 +17,8 @@ module Sass
|
|
17
17
|
# @raise [Sass::SyntaxError] if there's a syntax error in the selector
|
18
18
|
def parse_selector(filename)
|
19
19
|
init_scanner!
|
20
|
-
|
21
|
-
while tok(/,/)
|
22
|
-
ws = str{ss}
|
23
|
-
selectors << expr!(:_selector)
|
24
|
-
selectors[-1] = Selector::Sequence.new(["\n"] + selectors.last.members) if ws.include?("\n")
|
25
|
-
end
|
20
|
+
seq = expr!(:selector_comma_sequence)
|
26
21
|
expected("selector") unless @scanner.eos?
|
27
|
-
seq = Selector::CommaSequence.new(selectors)
|
28
22
|
seq.line = @line
|
29
23
|
seq.filename = filename
|
30
24
|
seq
|
data/lib/sass/selector.rb
CHANGED
@@ -332,21 +332,29 @@ module Sass
|
|
332
332
|
end
|
333
333
|
end
|
334
334
|
|
335
|
-
# A
|
336
|
-
|
337
|
-
|
335
|
+
# A pseudoclass selector whose argument is itself a selector
|
336
|
+
# (e.g. `:not(.foo)` or `:-moz-all(.foo, .bar)`).
|
337
|
+
class SelectorPseudoClass < Simple
|
338
|
+
# The name of the pseudoclass.
|
338
339
|
#
|
339
|
-
# @return [
|
340
|
+
# @return [String]
|
341
|
+
attr_reader :name
|
342
|
+
|
343
|
+
# The selector argument.
|
344
|
+
#
|
345
|
+
# @return [Selector::Sequence]
|
340
346
|
attr_reader :selector
|
341
347
|
|
342
|
-
# @param [
|
343
|
-
|
348
|
+
# @param [String] The name of the pseudoclass
|
349
|
+
# @param [Selector::Sequence] The selector argument
|
350
|
+
def initialize(name, selector)
|
351
|
+
@name = name
|
344
352
|
@selector = selector
|
345
353
|
end
|
346
354
|
|
347
355
|
# @see Selector#to_a
|
348
356
|
def to_a
|
349
|
-
[":
|
357
|
+
[":", @name, "("] + @selector.to_a + [")"]
|
350
358
|
end
|
351
359
|
end
|
352
360
|
end
|
data/lib/sass/selector/simple.rb
CHANGED
@@ -78,10 +78,10 @@ module Sass
|
|
78
78
|
return sels if sels.any? {|sel2| eql?(sel2)}
|
79
79
|
sels_with_ix = Haml::Util.enum_with_index(sels)
|
80
80
|
_, i =
|
81
|
-
if self.is_a?(Pseudo) || self.is_a?(
|
81
|
+
if self.is_a?(Pseudo) || self.is_a?(SelectorPseudoClass)
|
82
82
|
sels_with_ix.find {|sel, _| sel.is_a?(Pseudo) && sels.last.type == :element}
|
83
83
|
else
|
84
|
-
sels_with_ix.find {|sel, _| sel.is_a?(Pseudo) || sel.is_a?(
|
84
|
+
sels_with_ix.find {|sel, _| sel.is_a?(Pseudo) || sel.is_a?(SelectorPseudoClass)}
|
85
85
|
end
|
86
86
|
return sels + [self] unless i
|
87
87
|
return sels[0...i] + [self] + sels[i..-1]
|
data/test/haml/helper_test.rb
CHANGED
@@ -165,7 +165,7 @@ HAML
|
|
165
165
|
|
166
166
|
def test_content_tag_error_wrapping
|
167
167
|
def @base.protect_against_forgery?; false; end
|
168
|
-
error_class = Haml::Util.
|
168
|
+
error_class = Haml::Util.ap_geq_3? ? "field_with_errors" : "fieldWithErrors"
|
169
169
|
assert_equal(<<HTML, render(<<HAML, :action_view))
|
170
170
|
<form action="" method="post">
|
171
171
|
<div class="#{error_class}"><label for="post_error_field">Error field</label></div>
|
@@ -315,7 +315,7 @@ HAML
|
|
315
315
|
end
|
316
316
|
|
317
317
|
def test_indented_capture
|
318
|
-
prior = Haml::Util.
|
318
|
+
prior = Haml::Util.ap_geq_3? ? "" : " \n"
|
319
319
|
assert_equal("#{prior} Foo\n ", @base.render(:inline => " <% res = capture do %>\n Foo\n <% end %><%= res %>"))
|
320
320
|
end
|
321
321
|
|
@@ -671,11 +671,15 @@ SCSS
|
|
671
671
|
assert_renders <<SASS, <<SCSS
|
672
672
|
@import foo
|
673
673
|
|
674
|
+
@import url(bar.css)
|
675
|
+
|
674
676
|
foo
|
675
677
|
bar: baz
|
676
678
|
SASS
|
677
679
|
@import "foo";
|
678
680
|
|
681
|
+
@import url(bar.css);
|
682
|
+
|
679
683
|
foo {
|
680
684
|
bar: baz; }
|
681
685
|
SCSS
|
@@ -683,11 +687,15 @@ SCSS
|
|
683
687
|
assert_renders <<SASS, <<SCSS
|
684
688
|
@import foo.css
|
685
689
|
|
690
|
+
@import url(bar.css)
|
691
|
+
|
686
692
|
foo
|
687
693
|
bar: baz
|
688
694
|
SASS
|
689
695
|
@import "foo.css";
|
690
696
|
|
697
|
+
@import url(bar.css);
|
698
|
+
|
691
699
|
foo {
|
692
700
|
bar: baz; }
|
693
701
|
SCSS
|
@@ -695,7 +703,6 @@ SCSS
|
|
695
703
|
|
696
704
|
def test_import_as_directive_in_sass
|
697
705
|
assert_equal "@import foo.css\n", to_sass('@import "foo.css"')
|
698
|
-
assert_equal "@import foo.css\n", to_sass('@import url(foo.css)')
|
699
706
|
end
|
700
707
|
|
701
708
|
def test_import_as_directive_in_scss
|
data/test/sass/engine_test.rb
CHANGED
@@ -487,8 +487,21 @@ CSS
|
|
487
487
|
end
|
488
488
|
|
489
489
|
def test_css_import
|
490
|
-
assert_equal("@import url(./fonts.css)
|
491
|
-
|
490
|
+
assert_equal("@import url(./fonts.css);\n", render("@import \"./fonts.css\""))
|
491
|
+
end
|
492
|
+
|
493
|
+
def test_media_import
|
494
|
+
assert_equal("@import \"./fonts.sass\" all;\n",
|
495
|
+
render("@import \"./fonts.sass\" all"))
|
496
|
+
end
|
497
|
+
|
498
|
+
def test_http_import
|
499
|
+
assert_equal("@import url(http://fonts.googleapis.com/css?family=Droid+Sans);\n",
|
500
|
+
render("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\""))
|
501
|
+
end
|
502
|
+
|
503
|
+
def test_url_import
|
504
|
+
assert_equal("@import url(fonts.sass);\n", render("@import url(fonts.sass)"))
|
492
505
|
end
|
493
506
|
|
494
507
|
def test_sass_import
|
data/test/sass/script_test.rb
CHANGED
@@ -390,6 +390,18 @@ SASS
|
|
390
390
|
'Invalid CSS after "foo(bar, ": expected function argument, was ")"') {eval('foo(bar, )')}
|
391
391
|
end
|
392
392
|
|
393
|
+
def test_color_prefixed_identifier
|
394
|
+
assert_equal "tealbang", resolve("tealbang")
|
395
|
+
assert_equal "teal-bang", resolve("teal-bang")
|
396
|
+
end
|
397
|
+
|
398
|
+
def test_op_prefixed_identifier
|
399
|
+
assert_equal "notbang", resolve("notbang")
|
400
|
+
assert_equal "not-bang", resolve("not-bang")
|
401
|
+
assert_equal "or-bang", resolve("or-bang")
|
402
|
+
assert_equal "and-bang", resolve("and-bang")
|
403
|
+
end
|
404
|
+
|
393
405
|
private
|
394
406
|
|
395
407
|
def resolve(str, opts = {}, environment = env)
|
data/test/sass/scss/css_test.rb
CHANGED
@@ -382,7 +382,10 @@ SCSS
|
|
382
382
|
def test_calc_function
|
383
383
|
assert_parses <<SCSS
|
384
384
|
foo {
|
385
|
-
a: 12px calc(100%/3 - 2*1em - 2*1px);
|
385
|
+
a: 12px calc(100%/3 - 2*1em - 2*1px);
|
386
|
+
b: 12px -moz-calc(100%/3 - 2*1em - 2*1px);
|
387
|
+
b: 12px -webkit-calc(100%/3 - 2*1em - 2*1px);
|
388
|
+
b: 12px -foobar-calc(100%/3 - 2*1em - 2*1px); }
|
386
389
|
SCSS
|
387
390
|
end
|
388
391
|
|
@@ -703,6 +706,18 @@ SCSS
|
|
703
706
|
|
704
707
|
assert_selector_parses(':not(:hover)')
|
705
708
|
assert_selector_parses(':not(:nth-child(2n + 3))')
|
709
|
+
|
710
|
+
# Not technically allowed, but what the heck
|
711
|
+
assert_selector_parses(':not(:not(#foo))')
|
712
|
+
assert_selector_parses(':not(a#foo.bar)')
|
713
|
+
assert_selector_parses(':not(#foo .bar > baz)')
|
714
|
+
assert_selector_parses(':not(h1, h2, h3)')
|
715
|
+
end
|
716
|
+
|
717
|
+
def test_moz_any_selector
|
718
|
+
assert_selector_parses(':-moz-any(h1, h2, h3)')
|
719
|
+
assert_selector_parses(':-moz-any(.foo)')
|
720
|
+
assert_selector_parses(':-moz-any(foo bar, .baz > .bang)')
|
706
721
|
end
|
707
722
|
|
708
723
|
def test_namespaced_selectors
|
data/test/sass/scss/scss_test.rb
CHANGED
@@ -212,11 +212,24 @@ SCSS
|
|
212
212
|
def test_css_import_directive
|
213
213
|
assert_equal "@import url(foo.css);\n", render('@import "foo.css";')
|
214
214
|
assert_equal "@import url(foo.css);\n", render("@import 'foo.css';")
|
215
|
-
assert_equal "@import url(foo.css);\n", render('@import url("foo.css");')
|
216
|
-
assert_equal "@import url(foo.css);\n", render("@import url('foo.css');")
|
215
|
+
assert_equal "@import url(\"foo.css\");\n", render('@import url("foo.css");')
|
216
|
+
assert_equal "@import url('foo.css');\n", render("@import url('foo.css');")
|
217
217
|
assert_equal "@import url(foo.css);\n", render('@import url(foo.css);')
|
218
218
|
end
|
219
219
|
|
220
|
+
def test_media_import
|
221
|
+
assert_equal("@import \"./fonts.sass\" all;\n", render("@import \"./fonts.sass\" all;"))
|
222
|
+
end
|
223
|
+
|
224
|
+
def test_http_import
|
225
|
+
assert_equal("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\";\n",
|
226
|
+
render("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\";"))
|
227
|
+
end
|
228
|
+
|
229
|
+
def test_url_import
|
230
|
+
assert_equal("@import url(fonts.sass);\n", render("@import url(fonts.sass);"))
|
231
|
+
end
|
232
|
+
|
220
233
|
def test_block_comment_in_script
|
221
234
|
assert_equal <<CSS, render(<<SCSS)
|
222
235
|
foo {
|
data/test/test_helper.rb
CHANGED
@@ -65,7 +65,7 @@ class Test::Unit::TestCase
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def form_for_calling_convention(name)
|
68
|
-
return "@#{name}, :as => :#{name}, :html => {:class => nil, :id => nil}" if Haml::Util.
|
68
|
+
return "@#{name}, :as => :#{name}, :html => {:class => nil, :id => nil}" if Haml::Util.ap_geq_3?
|
69
69
|
return ":#{name}, @#{name}"
|
70
70
|
end
|
71
71
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 3
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 3.0.
|
8
|
+
- 13
|
9
|
+
version: 3.0.13
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Nathan Weizenbaum
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-06-
|
19
|
+
date: 2010-06-23 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- lib/sass/plugin/staleness_checker.rbc
|
147
147
|
- lib/sass/plugin/staleness_checker.rb
|
148
148
|
- lib/sass/plugin/configuration.rbc
|
149
|
+
- lib/sass/plugin/generic.rb
|
149
150
|
- lib/sass/environment.rb
|
150
151
|
- lib/sass/callbacks.rb
|
151
152
|
- lib/sass/selector/simple_sequence.rb
|