Permalink
Browse files

Merge branch 'stable'

  • Loading branch information...
2 parents 7899068 + 850e3bf commit 4ede29bf282a6a571057cd52ca7cde5825aad2bf @nex3 nex3 committed Apr 26, 2011
View
@@ -5,5 +5,6 @@
/test/rails
/.sass-cache
/.haml
+/.sass
/site
*.rbc
@@ -3,7 +3,11 @@
* Table of contents
{:toc}
-## 3.1.0 (Unreleased)
+## 3.1.1 (Unreleased)
+
+* Make sure `Sass::Plugin` is loaded at the correct time in Rails 3.
+
+## 3.1.0
* Add an {Sass::Script::Functions#invert `invert` function} that takes the inverse of colors.
View
@@ -581,15 +581,9 @@ def parse_property(name, parsed_name, value, prop, line)
if value.strip.empty?
expr = Sass::Script::String.new("")
else
- important = false
- if value =~ Sass::SCSS::RX::IMPORTANT
- important = true
- value = value.gsub(Sass::SCSS::RX::IMPORTANT,"")
- end
expr = parse_script(value, :offset => line.offset + line.text.index(value))
-
end
- Tree::PropNode.new(parse_interp(name), expr, important, prop)
+ Tree::PropNode.new(parse_interp(name), expr, prop)
end
def parse_variable(line)
View
@@ -225,7 +225,7 @@ def to_sass_tree
class Property
def to_sass_tree
return if hide_in_sass
- Sass::Tree::PropNode.new([self], @value.to_sass_tree, false, :new)
+ Sass::Tree::PropNode.new([self], @value.to_sass_tree, :new)
end
end
View
@@ -2,7 +2,7 @@
if defined?(ActiveSupport) && Sass::Util.has?(:public_method, ActiveSupport, :on_load) &&
!Sass::Util.ap_geq?('3.1.0.beta')
require 'sass/plugin/configuration'
- ActiveSupport.on_load(:before_initialize) do
+ ActiveSupport.on_load(:before_configuration) do
require 'sass'
require 'sass/plugin'
end
@@ -231,7 +231,7 @@ def token
variable || string(:double, false) || string(:single, false) || number ||
color || bool || string(:uri, false) || raw(UNICODERANGE) ||
- special_fun || ident_op || ident || op
+ special_fun || special_val || ident_op || ident || op
end
def variable
@@ -302,6 +302,11 @@ def special_fun
str1.size + str2.size]
end
+ def special_val
+ return unless scan(/!important/i)
+ [:string, Script::String.new("!important")]
+ end
+
def ident_op
return unless op = scan(REGULAR_EXPRESSIONS[:ident_op])
[OPERATORS[op]]
@@ -638,11 +638,9 @@ def declaration
tok!(/:/)
space, value = value!
ss
- important = tok(IMPORTANT)
- ss
require_block = tok?(/\{/)
- node = node(Sass::Tree::PropNode.new(name.flatten.compact, value, !!important, :new))
+ node = node(Sass::Tree::PropNode.new(name.flatten.compact, value, :new))
return node unless require_block
nested_properties! node, space
View
@@ -119,7 +119,7 @@ def self.quote(str, flags = 0)
# We could use it for 1.9 only, but I don't want to introduce a cross-version
# behavior difference.
# In any case, almost all CSS idents will be matched by this.
- STATIC_VALUE = /(-?#{NMSTART}|#{STRING_NOINTERP}|\s(?!%)|#[a-f0-9]|[,%]|#{NUM})+(?=[;}])/i
+ STATIC_VALUE = /(-?#{NMSTART}|#{STRING_NOINTERP}|\s(?!%)|#[a-f0-9]|[,%]|#{NUM}|\!important)+(?=[;}])/i
STATIC_SELECTOR = /(#{NMCHAR}|\s|[,>+*]|[:#.]#{NMSTART})+(?=[{])/i
end
@@ -23,11 +23,6 @@ class PropNode < Node
# @return [Sass::Script::Node]
attr_accessor :value
- # Whether the property was marked as !important.
- #
- # @return [Boolean]
- attr_accessor :important
-
# The value of the property
# after any interpolated SassScript has been resolved.
# Only set once \{Tree::Visitors::Perform} has been run.
@@ -49,16 +44,14 @@ class PropNode < Node
# @param name [Array<String, Sass::Script::Node>] See \{#name}
# @param value [Sass::Script::Node] See \{#value}
- # @param important [Boolean] whether this is an !important property
# @param prop_syntax [Symbol] `:new` if this property uses `a: b`-style syntax,
# `:old` if it uses `:a b`-style syntax
- def initialize(name, value, important, prop_syntax)
+ def initialize(name, value, prop_syntax)
@name = Sass::Util.strip_string_array(
Sass::Util.merge_adjacent_strings(name))
@value = value
@tabs = 0
@prop_syntax = prop_syntax
- @important = important
super()
end
@@ -96,7 +89,7 @@ def declaration(opts = {:old => @prop_syntax == :old}, fmt = :sass)
old = opts[:old] && fmt == :sass
initial = old ? ':' : ''
mid = old ? '' : ':'
- "#{initial}#{name}#{mid} #{self.class.val_to_sass(value, opts)}#{' !important' if important}".rstrip
+ "#{initial}#{name}#{mid} #{self.class.val_to_sass(value, opts)}".rstrip
end
private
@@ -122,9 +122,9 @@ def visit_media(node)
def visit_prop(node)
tab_str = ' ' * (@tabs + node.tabs)
if node.style == :compressed
- "#{tab_str}#{node.resolved_name}:#{node.resolved_value}#{'!important' if node.important}"
+ "#{tab_str}#{node.resolved_name}:#{node.resolved_value}"
else
- "#{tab_str}#{node.resolved_name}: #{node.resolved_value}#{' !important' if node.important};"
+ "#{tab_str}#{node.resolved_name}: #{node.resolved_value};"
end
end
@@ -204,7 +204,7 @@ def debug_info_rule(debug_info, options)
[Sass::Selector::Element.new(k.to_s.gsub(/[^\w-]/, "\\\\\\0"), nil)])
])
])
- prop = Sass::Tree::PropNode.new([""], "", false, :new)
+ prop = Sass::Tree::PropNode.new([""], "", :new)
prop.resolved_name = "font-family"
prop.resolved_value = Sass::SCSS::RX.escape_ident(v.to_s)
rule << prop
@@ -2148,6 +2148,16 @@ def test_import_with_commas_in_url
SASS
end
+ def test_silent_comment_in_prop_val_after_important
+ assert_equal(<<CSS, render(<<SASS))
+.advanced {
+ display: none !important; }
+CSS
+.advanced
+ display: none !important // yeah, yeah. it's not really a style anyway.
+SASS
+ end
+
def test_mixin_with_keyword_args
assert_equal <<CSS, render(<<SASS)
.mixed {

0 comments on commit 4ede29b

Please sign in to comment.