[Compass Core] Fix a bug that caused quotes strings passed to url() to be wrapped in another set of single quotes. Closes GH-125.

This commit is contained in:
Chris Eppstein 2010-05-04 18:36:52 -07:00
parent 684f127bc5
commit 89442c93b1

View File

@ -11,7 +11,7 @@ module Compass::SassExtensions::Functions::Urls
Compass.configuration.http_root_relative(Compass.configuration.css_dir) Compass.configuration.http_root_relative(Compass.configuration.css_dir)
end end
url("#{http_stylesheets_path}/#{path}") clean_url("#{http_stylesheets_path}/#{path}")
end end
def font_url(path) def font_url(path)
@ -30,7 +30,7 @@ module Compass::SassExtensions::Functions::Urls
Compass.configuration.http_fonts_path Compass.configuration.http_fonts_path
end end
url("#{http_fonts_path}/#{path}") clean_url("#{http_fonts_path}/#{path}")
end end
def image_url(path) def image_url(path)
@ -75,18 +75,18 @@ module Compass::SassExtensions::Functions::Urls
# prepend the asset host if there is one. # prepend the asset host if there is one.
path = "#{asset_host}#{'/' unless path[0..0] == "/"}#{path}" if asset_host path = "#{asset_host}#{'/' unless path[0..0] == "/"}#{path}" if asset_host
url(path) clean_url(path)
end end
private
# Emits a url, taking off any leading "./" # Emits a url, taking off any leading "./"
def url(url) def clean_url(url)
url = url.to_s url = url.to_s
url = url[0..1] == "./" ? url[2..-1] : url url = url[0..1] == "./" ? url[2..-1] : url
Sass::Script::String.new("url('#{url}')") Sass::Script::String.new("url('#{url}')")
end end
private
def relative? def relative?
Compass.configuration.relative_assets? Compass.configuration.relative_assets?
end end