[Compass Core] Fixed the append_selector function to allow comma-delimited selectors for both arguments instead of just the first.

This commit is contained in:
Chris Eppstein 2009-08-16 16:55:04 -07:00
parent f27e184c7f
commit c9454190e7
3 changed files with 28 additions and 1 deletions

2
TODO.md Normal file
View File

@ -0,0 +1,2 @@
* vendored plugins should override default plugins.

View File

@ -0,0 +1,22 @@
module Compass
module Installers
class TemplateContext
def self.ctx(*arguments)
new(*arguments).get_binding
end
def initialize(locals = {})
@locals = locals
end
def get_binding
@locals.each do |k, v|
eval("#{k} = v")
end
binding
end
def config
Compass.configuration
end
alias configuration config
end
end
end

View File

@ -33,7 +33,10 @@ module Compass::SassExtensions::Functions::Selectors
# #{append_selector(!selector, !to_append)} # #{append_selector(!selector, !to_append)}
# width: 2px # width: 2px
def append_selector(selector, to_append) def append_selector(selector, to_append)
Sass::Script::String.new(selector.value.split(COMMA_SEPARATOR).map{|s| "#{s}#{to_append}"}.join(", ")) ancestors = selector.value.split(COMMA_SEPARATOR)
descendants = to_append.value.split(COMMA_SEPARATOR)
nested = ancestors.map{|a| descendants.map{|d| "#{a}#{d}"}.join(", ")}.join(", ")
Sass::Script::String.new(nested)
end end
end end