Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: sass/sass
...
head fork: sass/sass
Checking mergeability… Don't worry, you can still create the pull request.
  • 13 commits
  • 18 files changed
  • 0 commit comments
  • 2 contributors
View
6 lib/sass/engine.rb
@@ -353,7 +353,7 @@ def _render_with_sourcemap(sourcemap_uri)
rendered << "\n" if rendered[-1] != ?\n
rendered << "\n" unless compressed
rendered << "/*@ sourceMappingURL="
- rendered << URI.encode(sourcemap_uri)
+ rendered << Sass::Util.escape_uri(sourcemap_uri)
rendered << " */"
rendered = encode_and_set_charset(rendered)
return rendered, sourcemap
@@ -673,9 +673,7 @@ def parse_property_or_rule(line)
property
else
res.pop if comment
- scanner_start_pos = scanner.pos
interp_parsed = parse_interp(scanner.rest)
- scanned_size = scanner.pos - scanner_start_pos
selector_range = Sass::Source::Range.new(
ident_range.start_pos,
Sass::Source::Position.new(@line, to_parser_offset(line.offset) + line.text.length),
@@ -911,7 +909,7 @@ def parse_import(line, value, offset)
def parse_import_arg(scanner, offset)
return if scanner.eos?
- if match_length = scanner.match?(/url\(/i)
+ if scanner.match?(/url\(/i)
script_parser = Sass::Script::Parser.new(scanner, @line, to_parser_offset(offset), @options)
str = script_parser.parse_string
View
5 lib/sass/script/literal.rb
@@ -5,11 +5,6 @@ module Sass::Script
# are designed to be overridden by subclasses which may change the semantics somewhat.
# The operations listed here are just the defaults.
class Literal < Node
- require 'sass/script/string'
- require 'sass/script/number'
- require 'sass/script/color'
- require 'sass/script/bool'
- require 'sass/script/null'
require 'sass/script/list'
require 'sass/script/arg_list'
View
4 lib/sass/script/operation.rb
@@ -1,7 +1,10 @@
require 'set'
+require 'sass/script/literal'
require 'sass/script/string'
require 'sass/script/number'
require 'sass/script/color'
+require 'sass/script/bool'
+require 'sass/script/null'
require 'sass/script/functions'
require 'sass/script/unary_operation'
require 'sass/script/interpolation'
@@ -35,7 +38,6 @@ def inspect
# @see Node#to_sass
def to_sass(opts = {})
- pred = Sass::Script::Parser.precedence_of(@operator)
o1 = operand_to_sass @operand1, :left, opts
o2 = operand_to_sass @operand2, :right, opts
sep =
View
2  lib/sass/selector/sequence.rb
@@ -255,7 +255,7 @@ def merge_final_ops(seq1, seq2, res = [])
# is a supersequence of the other, use that, otherwise give up.
lcs = Sass::Util.lcs(ops1, ops2)
return unless lcs == ops1 || lcs == ops2
- res.unshift *(ops1.size > ops2.size ? ops1 : ops2).reverse
+ res.unshift(*(ops1.size > ops2.size ? ops1 : ops2).reverse)
return res
end
View
6 lib/sass/selector/simple_sequence.rb
@@ -135,9 +135,9 @@ def do_extend(extends, parent_directives, seen = Set.new)
# by the time extension and unification happen,
# this exception will only ever be raised as a result of programmer error
def unify(sels, other_subject)
- return unless sseq = members.inject(sels) do |sseq, sel|
- return unless sseq
- sel.unify(sseq)
+ return unless sseq = members.inject(sels) do |member, sel|
+ return unless member
+ sel.unify(member)
end
SimpleSequence.new(sseq, other_subject || subject?)
end
View
2  lib/sass/tree/node.rb
@@ -32,7 +32,7 @@ class Node
# The child nodes of this node.
#
# @return [Array<Tree::Node>]
- attr_accessor :children
+ attr_reader :children
# Whether or not this node has child nodes.
# This may be true even when \{#children} is empty,
View
3  lib/sass/tree/rule_node.rb
@@ -1,5 +1,4 @@
require 'pathname'
-require 'uri'
module Sass::Tree
# A static node reprenting a CSS rule.
@@ -115,7 +114,7 @@ def continued?
#
# @return [{#to_s => #to_s}]
def debug_info
- {:filename => filename && ("file://" + URI.escape(File.expand_path(filename))),
+ {:filename => filename && ("file://" + Sass::Util.escape_uri(File.expand_path(filename))),
:line => self.line}
end
View
6 lib/sass/tree/visitors/cssize.rb
@@ -124,12 +124,12 @@ def visit_extend(node)
end
sel = sseq.members
- parent.resolved_rules.members.each do |seq|
- if !seq.members.last.is_a?(Sass::Selector::SimpleSequence)
+ parent.resolved_rules.members.each do |member|
+ if !member.members.last.is_a?(Sass::Selector::SimpleSequence)
raise Sass::SyntaxError.new("#{seq} can't extend: invalid selector")
end
- @extends[sel] = Extend.new(seq, sel, node, @parent_directives.dup, :not_found)
+ @extends[sel] = Extend.new(member, sel, node, @parent_directives.dup, :not_found)
end
end
View
1  lib/sass/tree/visitors/to_css.rb
@@ -274,7 +274,6 @@ def visit_rule(node)
joined_rules.gsub!(/\s*\n\s*/, "#{line_separator}#{per_rule_indent}")
old_spaces = ' ' * @tabs
- spaces = ' ' * (@tabs + 1)
if node.style != :compressed
if node.options[:debug_info] && !@in_directive
visit(debug_info_rule(node.debug_info, node.options))
View
10 lib/sass/util.rb
@@ -3,6 +3,7 @@
require 'enumerator'
require 'stringio'
require 'rbconfig'
+require 'uri'
require 'sass/root'
require 'sass/util/subset_map'
@@ -962,6 +963,15 @@ def method_missing(name, *args, &block)
end
end
+
+ URI_ESCAPE = URI.const_defined?(:DEFAULT_PARSER) ?
+ URI::DEFAULT_PARSER :
+ URI
+
+ def escape_uri(uri)
+ URI_ESCAPE.escape uri
+ end
+
private
# Calculates the memoization table for the Least Common Subsequence algorithm.
View
4 lib/sass/version.rb
@@ -1,8 +1,4 @@
require 'date'
-
-# This is necessary for loading Sass when Haml is required in Rails 3.
-# Once the split is complete, we can remove it.
-require File.dirname(__FILE__) + '/../sass'
require 'sass/util'
module Sass
View
2  test/sass/conversion_test.rb
@@ -1347,7 +1347,7 @@ def test_dasherize
SASS
end
- def test_loud_comment_conversion
+ def test_loud_comment_conversion
assert_renders(<<SASS, <<SCSS)
/*! \#{"interpolated"}
SASS
View
18 test/sass/extend_test.rb
@@ -489,7 +489,7 @@ def test_nested_extender_with_child_selector_unifies
SCSS
end
- def test_nested_extender_with_early_child_selectors_doesnt_subseq_them
+ def test_nested_extender_with_early_child_selector
assert_equal <<CSS, render(<<SCSS)
.foo .bar, .foo .bip > .baz {
a: b; }
@@ -1061,7 +1061,7 @@ def test_extend_with_subject_fails_with_conflicting_subject
x! .bar {a: b}
y! .bap {@extend .bar}
SCSS
-end
+ end
def test_extend_warns_when_extendee_doesnt_exist
assert_raise_message(Sass::SyntaxError, <<ERR) {render(<<SCSS)}
@@ -1098,20 +1098,6 @@ def test_extend_succeeds_when_one_extension_fails_but_others_dont
SCSS
end
- def test_extend_succeeds_when_one_extension_fails_but_others_dont
- assert_equal(<<CSS, render(<<SCSS))
-a.bar {
- a: b; }
-
-.bar, b.foo {
- c: d; }
-CSS
-a.bar {a: b}
-.bar {c: d}
-b.foo {@extend .bar}
-SCSS
- end
-
def test_optional_extend_succeeds_when_extendee_doesnt_exist
assert_equal("", render(<<SCSS))
.foo {@extend .bar !optional}
View
8 test/sass/importer_test.rb
@@ -200,7 +200,7 @@ def test_source_map_with_only_css_uri_supports_public_url_imports
}
SCSS
- rendered, sourcemap = engine.render_with_sourcemap('sourcemap_uri')
+ _, sourcemap = engine.render_with_sourcemap('sourcemap_uri')
assert_equal <<JSON.strip, sourcemap.to_json(:css_uri => 'css_uri')
{
"version": "3",
@@ -223,7 +223,7 @@ def test_source_map_with_only_css_uri_doesnt_support_filesystem_importer
.foo {a: b}
SCSS
- rendered, sourcemap = engine.render_with_sourcemap('http://1.example.com/style.map')
+ _, sourcemap = engine.render_with_sourcemap('http://1.example.com/style.map')
assert_warning(<<WARNING) {sourcemap.to_json(:css_uri => 'css_uri')}
WARNING: Couldn't determine public URL for "#{filename_for_test(:scss)}" while generating sourcemap.
@@ -244,7 +244,7 @@ def test_source_map_with_css_uri_and_css_path_doesnt_support_filesystem_importer
.foo {a: b}
SCSS
- rendered, sourcemap = engine.render_with_sourcemap('http://1.example.com/style.map')
+ _, sourcemap = engine.render_with_sourcemap('http://1.example.com/style.map')
assert_warning(<<WARNING) {sourcemap.to_json(:css_uri => 'css_uri', :css_path => 'css_path')}
WARNING: Couldn't determine public URL for "#{filename_for_test(:scss)}" while generating sourcemap.
@@ -293,7 +293,7 @@ def test_source_map_with_css_path_and_sourcemap_path_supports_file_system_import
.foo {a: b}
SCSS
- rendered, sourcemap = engine.render_with_sourcemap('http://map.example.com/map/style.map')
+ _, sourcemap = engine.render_with_sourcemap('http://map.example.com/map/style.map')
css_path = 'static/style.css'
sourcemap_path = 'map/style.map'
assert_equal <<JSON.strip, sourcemap.to_json(:css_path => css_path, :sourcemap_path => sourcemap_path)
View
2  test/sass/scss/css_test.rb
@@ -651,7 +651,7 @@ def test_supports
## Selectors
# Taken from http://dev.w3.org/csswg/selectors4/#overview
- def test_summarized_selectors
+ def test_summarized_selectors_with_element
assert_selector_parses('*')
assert_selector_parses('E')
assert_selector_parses('E:not(s)')
View
11 test/sass/source_map_test.rb
@@ -5,7 +5,7 @@
class SourcemapTest < Test::Unit::TestCase
def test_to_json_requires_args
- rendered, sourcemap = render_with_sourcemap('')
+ _, sourcemap = render_with_sourcemap('')
assert_raise(ArgumentError) {sourcemap.to_json({})}
assert_raise(ArgumentError) {sourcemap.to_json({:css_path => 'foo'})}
assert_raise(ArgumentError) {sourcemap.to_json({:sourcemap_path => 'foo'})}
@@ -474,7 +474,7 @@ def test_while_sourcemap_scss
CSS
end
-def test_while_sourcemap_sass
+ def test_while_sourcemap_sass
assert_parses_with_mapping <<'SASS', <<'CSS', :syntax => :sass
$i: 6
@while $i > 0
@@ -723,7 +723,6 @@ def build_ranges(text, file_name = nil)
start_positions = {}
text.split("\n").each_with_index do |line_text, line|
line += 1 # lines shoud be 1-based
- match_start = 0
while match = line_text.match(ANNOTATION_REGEX)
closing = !match[1].empty?
name = match[2]
@@ -750,13 +749,13 @@ def build_mapping_from_annotations(source, css, source_file_name)
source_ranges = build_ranges(source, source_file_name)
target_ranges = build_ranges(css)
map = Sass::Source::Map.new
- mappings = Sass::Util.flatten(source_ranges.map do |(name, sources)|
+ Sass::Util.flatten(source_ranges.map do |(name, sources)|
assert(sources.length == 1, "#{sources.length} source ranges encountered for annotation #{name}")
assert(target_ranges[name], "No target ranges for annotation #{name}")
target_ranges[name].map {|target_range| [sources.first, target_range]}
end, 1).
- sort_by {|(source, target)| [target.start_pos.line, target.start_pos.offset]}.
- each {|(source, target)| map.add(source, target)}
+ sort_by {|(_, target)| [target.start_pos.line, target.start_pos.offset]}.
+ each {|(s2, target)| map.add(s2, target)}
map
end
View
2  test/sass/util_test.rb
@@ -324,7 +324,7 @@ def assert_json_string(source, target)
def test_json_value_of
assert_json_value 0, "0"
- assert_json_value -42, "-42"
+ assert_json_value(-42, "-42")
assert_json_value 42, "42"
assert_json_value true, "true"
assert_json_value false, "false"
View
7 test/test_helper.rb
@@ -7,7 +7,12 @@
require 'mathn' if ENV['MATHN'] == 'true'
Sass::RAILS_LOADED = true unless defined?(Sass::RAILS_LOADED)
-Encoding.default_external = 'UTF-8' if defined?(Encoding)
+
+if defined?(Encoding)
+ $-w, w = false, $-w
+ Encoding.default_external = 'UTF-8'
+ $-w = w
+end
module Sass::Script::Functions
def option(name)

No commit comments for this range

Something went wrong with that request. Please try again.