sass 3.4.21 → 3.4.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +122 -0
- data/MIT-LICENSE +1 -1
- data/README.md +15 -9
- data/Rakefile +71 -18
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/lib/sass.rb +7 -0
- data/lib/sass/callbacks.rb +2 -2
- data/lib/sass/css.rb +9 -8
- data/lib/sass/engine.rb +14 -8
- data/lib/sass/environment.rb +8 -1
- data/lib/sass/error.rb +5 -5
- data/lib/sass/exec/sass_convert.rb +14 -2
- data/lib/sass/exec/sass_scss.rb +2 -25
- data/lib/sass/features.rb +2 -2
- data/lib/sass/importers/filesystem.rb +6 -3
- data/lib/sass/plugin/compiler.rb +15 -7
- data/lib/sass/script/css_variable_warning.rb +52 -0
- data/lib/sass/script/functions.rb +5 -5
- data/lib/sass/script/lexer.rb +3 -1
- data/lib/sass/script/parser.rb +67 -15
- data/lib/sass/script/tree/funcall.rb +10 -3
- data/lib/sass/script/tree/node.rb +8 -0
- data/lib/sass/script/tree/operation.rb +7 -0
- data/lib/sass/script/value/base.rb +1 -0
- data/lib/sass/script/value/color.rb +6 -4
- data/lib/sass/script/value/helpers.rb +2 -2
- data/lib/sass/script/value/number.rb +5 -5
- data/lib/sass/scss.rb +0 -2
- data/lib/sass/scss/css_parser.rb +1 -2
- data/lib/sass/scss/parser.rb +20 -10
- data/lib/sass/scss/rx.rb +2 -2
- data/lib/sass/scss/static_parser.rb +11 -13
- data/lib/sass/selector/pseudo.rb +1 -1
- data/lib/sass/selector/sequence.rb +2 -2
- data/lib/sass/selector/simple_sequence.rb +4 -4
- data/lib/sass/stack.rb +2 -2
- data/lib/sass/tree/function_node.rb +1 -1
- data/lib/sass/tree/node.rb +2 -0
- data/lib/sass/tree/visitors/check_nesting.rb +2 -0
- data/lib/sass/tree/visitors/convert.rb +8 -7
- data/lib/sass/tree/visitors/perform.rb +4 -2
- data/lib/sass/tree/visitors/to_css.rb +10 -10
- data/lib/sass/util.rb +8 -7
- data/test/sass-spec.yml +3 -0
- data/test/sass/compiler_test.rb +1 -1
- data/test/sass/css_variable_test.rb +132 -0
- data/test/sass/exec_test.rb +10 -0
- data/test/sass/script_test.rb +1 -1
- data/test/sass/scss/scss_test.rb +10 -0
- metadata +79 -77
- data/lib/sass/scss/script_lexer.rb +0 -15
- data/lib/sass/scss/script_parser.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 414603b66564f231de620f9baff16563174a4b72
|
4
|
+
data.tar.gz: 4f09c7d1af56afa99f42b2c5922144774befd481
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40de104dabb794e5fd4fb20bdfcf0c2d57444d4b2f283312d4698482c3117fc5093b7e65daaacbae1b4ccd93989d0e6c3a3c0f3548a3c5710de74563d9ee6b96
|
7
|
+
data.tar.gz: 738319bc6f7d3b10e4ec16e0e5c5b9ed7b7c21f6c09d7bc244cbd5d0fab785778ccf4b2270ba86eb68597a8b1eb4836ef4f7460c7063381a7cfa2c9017b73c15
|
data/CONTRIBUTING.md
CHANGED
@@ -1,3 +1,125 @@
|
|
1
1
|
Contributions are welcomed. Please see the following site for guidelines:
|
2
2
|
|
3
3
|
[http://sass-lang.com/community#Contribute](http://sass-lang.com/community#Contribute)
|
4
|
+
|
5
|
+
* [Branches](#main-development-branches)
|
6
|
+
* [Feature Branches](#feature-branches)
|
7
|
+
* [Experimental Branches](#experimental-branches)
|
8
|
+
* [Old Stable Branches](#old-stable-branches)
|
9
|
+
* [Versioning](#versioning)
|
10
|
+
* [Making Breaking Changes](#making-breaking-changes)
|
11
|
+
* [Exceptional Breakages](#exceptional-breakages)
|
12
|
+
|
13
|
+
## Branches
|
14
|
+
|
15
|
+
The Sass repository has three primary development branches, each of which tracks
|
16
|
+
a different line of releases (see [versioning](#versioning) below). Each branch
|
17
|
+
is regularly merged into the one below: `stable` into `next`, `next` into
|
18
|
+
`master`.
|
19
|
+
|
20
|
+
* The `stable` branch is the default—it's what GitHub shows if you go to
|
21
|
+
[sass/sass](https://github.com/sass/sass), and it's the default place for pull
|
22
|
+
requests to go. This branch is where we work on the next patch release. Bug
|
23
|
+
fixes and documentation improvements belong here, but not new features.
|
24
|
+
|
25
|
+
* The `next` branch is where we work on the next minor release. It's where most
|
26
|
+
new features go, as long as they're not breaking changes. Very occasionally
|
27
|
+
breaking changes will go here as well—see
|
28
|
+
[exceptional breakages](#exceptional-breakages) below for details.
|
29
|
+
|
30
|
+
* The `master` branch is where we work on the next major release. It's where
|
31
|
+
breaking changes go. We also occasionally decide that a non-breaking feature
|
32
|
+
is big enough to warrant saving until the next major release, in which case it
|
33
|
+
will also be developed here.
|
34
|
+
|
35
|
+
Ideally, pull requests would be made against the appropriate
|
36
|
+
branch, but don't worry about it too much; if you make a request against the
|
37
|
+
wrong branch, the maintainer will take responsibility for rebasing it before
|
38
|
+
merging.
|
39
|
+
|
40
|
+
### Feature Branches
|
41
|
+
|
42
|
+
Sometimes it won't be possible to merge a new feature into `next` or `master`
|
43
|
+
immediately. It may require longer-term work before it's complete, or we may not
|
44
|
+
want to release it as part of any alpha releases of the branch in question.
|
45
|
+
Branches like this are labeled `feature.#{name}` and stay on GitHub until
|
46
|
+
they're ready to be merged.
|
47
|
+
|
48
|
+
### Experimental Branches
|
49
|
+
|
50
|
+
Not all features pan out, and not all code is a good fit for merging into the
|
51
|
+
main codebase. Usually when this happens the code is just discarded, but every
|
52
|
+
so often it's interesting or promising enough that it's worth keeping around.
|
53
|
+
This is what experimental branches (labeled `experimental.#{name}`) are for.
|
54
|
+
While they're not currently in use, they contain code that might be useful in
|
55
|
+
the future.
|
56
|
+
|
57
|
+
### Old Stable Branches
|
58
|
+
|
59
|
+
Usually Sass doesn't have the development time to do long-term maintenance of
|
60
|
+
old release. But occasionally, very rarely, it becomes necessary. In cases like
|
61
|
+
that, a branch named `stable_#{version}` will be created, starting from the last
|
62
|
+
tag in that version series.
|
63
|
+
|
64
|
+
## Versioning
|
65
|
+
|
66
|
+
Starting with version 3.5.0, Sass uses [semantic versioning](http://semver.org/)
|
67
|
+
to indicate the evolution of its language semantics as much as possible. This
|
68
|
+
means that patch releases (such as 3.5.3) contain only bug fixes, minor releases
|
69
|
+
(such as 3.6.0) contain backwards-compatible features, and only major releases
|
70
|
+
(such as 4.0.0) are allowed to have backwards-incompatible behavior. There are
|
71
|
+
[exceptions](#exceptional-breakages), but we try to follow this rule as closely
|
72
|
+
as possible.
|
73
|
+
|
74
|
+
Note, however, that the semantic versioning applies only to the language's
|
75
|
+
semantics, not to the Ruby APIs. Although we try hard to keep widely-used APIs
|
76
|
+
like [`Sass::Engine`][Sass::Engine] stable, we don't have a strong distinction
|
77
|
+
between public and private APIs and we need to be able to freely refactor our
|
78
|
+
code.
|
79
|
+
|
80
|
+
[Sass::Engine]: http://sass-lang.com/documentation/Sass/Engine.html
|
81
|
+
|
82
|
+
### Making Breaking Changes
|
83
|
+
|
84
|
+
Sometimes the old way of doing something just isn't going to work anymore, and
|
85
|
+
the new way just can't be made backwards-compatible. In that case, a breaking
|
86
|
+
change is necessary. These changes are rarely pleasant, but they contribute to
|
87
|
+
making the language better in the long term.
|
88
|
+
|
89
|
+
Our breaking change process tries to make such changes as clear to users and as
|
90
|
+
easy to adapt to as possible. We want to ensure that there's a clear path
|
91
|
+
forward for users using functionality that will no longer exist, and that they
|
92
|
+
are able to understand what's changing and what they need to do. We've developed
|
93
|
+
the following process for this:
|
94
|
+
|
95
|
+
1. Deprecate the old behavior [in `stable`](#branches). At minimum, deprecating
|
96
|
+
some behavior involves printing a warning when that behavior is used
|
97
|
+
explaining that it's going to go away in the future. Ideally, this message
|
98
|
+
will also include code that will do the same thing in a non-deprecated way.
|
99
|
+
If there's a thorough prose explanation of the change available online, the
|
100
|
+
message should link to that as well.
|
101
|
+
|
102
|
+
2. If possible, make `sass-convert` (also in `stable`) convert the deprecated
|
103
|
+
behavior into a non-deprecated form. This allows users to run `sass-convert
|
104
|
+
-R -i` to automatically update their stylesheets.
|
105
|
+
|
106
|
+
3. Implement the new behavior in `master`. The sooner this happens, the better:
|
107
|
+
it may be unclear exactly what needs to be deprecated until the new
|
108
|
+
implementation exists.
|
109
|
+
|
110
|
+
4. Release an alpha version of `master` that includes the new behavior. This
|
111
|
+
allows users who are dissatisfied with the workaround to use the new
|
112
|
+
behavior early. Normally a maintainer will take care of this.
|
113
|
+
|
114
|
+
### Exceptional Breakages
|
115
|
+
|
116
|
+
Because Sass's syntax and semantics are closely tied to those of CSS, there are
|
117
|
+
occasionally times when CSS syntax is introduced that overlaps with
|
118
|
+
previously-valid Sass. In this case in particular, we may introduce a breaking
|
119
|
+
change in a minor version to get back to CSS compatibility as soon as possible.
|
120
|
+
|
121
|
+
Exceptional breakages still require the full deprecation process; the only
|
122
|
+
change is that the new behavior is implemented in `next` rather than `master`.
|
123
|
+
Because there are no minor releases between the deprecation and the removal of
|
124
|
+
the old behavior, the deprecation warning should be introduced soon as it
|
125
|
+
becomes clear that an exceptional breakage is necessary.
|
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2006-
|
1
|
+
Copyright (c) 2006-2016 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -206,16 +206,22 @@ documentation, implementing new features, and getting Hampton coffee (a fitting
|
|
206
206
|
task for a girl genius). Natalie lives in Seattle, Washington and works on
|
207
207
|
[Dart](http://dartlang.org) application libraries at Google.
|
208
208
|
|
209
|
-
[Chris Eppstein](http://
|
210
|
-
Sass and the creator of Compass, the first Sass-based framework
|
209
|
+
[Chris Eppstein](http://twitter.com/chriseppstein) is a core contributor to
|
210
|
+
Sass and the creator of [Compass](http://compass-style.org/), the first Sass-based framework, and
|
211
|
+
[Eyeglass](http://github.com/sass-eyeglass/eyeglass), a node-sass plugin ecosystem for NPM. Chris focuses
|
211
212
|
on making Sass more powerful, easy to use, and on ways to speed its adoption
|
212
213
|
through the web development community. Chris lives in San Jose, California with
|
213
|
-
his wife and
|
214
|
-
[LinkedIn.com](http://linkedin.com), where
|
215
|
-
maintain Sass
|
214
|
+
his wife and two children. He is an Engineer for
|
215
|
+
[LinkedIn.com](http://linkedin.com), where his primary responsibility is to
|
216
|
+
maintain Sass and many other Sass-related open source projects.
|
216
217
|
|
217
|
-
If you use this software,
|
218
|
-
|
218
|
+
If you use this software, we'd be truly honored if you'd make a
|
219
|
+
tax-deductible donation to a non-profit organization and then
|
220
|
+
[let us know on twitter](http://twitter.com/SassCSS), so that we can
|
221
|
+
thank you. Here's a few that we endorse:
|
219
222
|
|
220
|
-
|
221
|
-
|
223
|
+
* [Trans Justice Funding Project](http://www.transjusticefundingproject.org/)
|
224
|
+
* [United Mitochondrial Disease Foundation](http://umdf.org/compass)
|
225
|
+
* [Girl Develop It](https://www.girldevelopit.com/donate)
|
226
|
+
|
227
|
+
Sass is licensed under the MIT License.
|
data/Rakefile
CHANGED
@@ -12,38 +12,92 @@ task :default => :test
|
|
12
12
|
|
13
13
|
require 'rake/testtask'
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
desc "Run all tests"
|
16
|
+
task :test => ["test:ruby", "test:spec"]
|
17
|
+
|
18
|
+
namespace :test do
|
19
|
+
desc "Run the ruby tests (without sass-spec)"
|
20
|
+
Rake::TestTask.new("ruby") do |t|
|
21
|
+
t.libs << 'test'
|
22
|
+
test_files = FileList[scope('test/**/*_test.rb')]
|
23
|
+
test_files.exclude(scope('test/rails/*'))
|
24
|
+
test_files.exclude(scope('test/plugins/*'))
|
25
|
+
t.test_files = test_files
|
26
|
+
t.warning = true
|
27
|
+
t.verbose = true
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "Run sass-spec tests against the local code."
|
31
|
+
task :spec do
|
32
|
+
require "yaml"
|
33
|
+
sass_spec_options = YAML.load_file(scope("test/sass-spec.yml"))
|
34
|
+
enabled = sass_spec_options.delete(:enabled)
|
35
|
+
unless enabled
|
36
|
+
puts "SassSpec tests are disabled."
|
37
|
+
next
|
38
|
+
end
|
39
|
+
if ruby_version_at_least?("1.9.2")
|
40
|
+
old_load_path = $:.dup
|
41
|
+
begin
|
42
|
+
$:.unshift(File.join(File.dirname(__FILE__), "lib"))
|
43
|
+
begin
|
44
|
+
require 'sass_spec'
|
45
|
+
rescue LoadError
|
46
|
+
puts "You probably forgot to run: bundle exec rake"
|
47
|
+
raise
|
48
|
+
end
|
49
|
+
default_options = {
|
50
|
+
:spec_directory => SassSpec::SPEC_DIR,
|
51
|
+
:engine_adapter => SassEngineAdapter.new("sass"),
|
52
|
+
:generate => [],
|
53
|
+
:tap => false,
|
54
|
+
:skip => false,
|
55
|
+
:verbose => false,
|
56
|
+
:filter => "",
|
57
|
+
:limit => -1,
|
58
|
+
:unexpected_pass => false,
|
59
|
+
:nuke => false,
|
60
|
+
|
61
|
+
# Constants
|
62
|
+
:output_styles => ["nested"],
|
63
|
+
:input_files => ["input.scss", "input.sass"],
|
64
|
+
:nested_output_file => 'expected_output',
|
65
|
+
:compressed_output_file => 'expected.compressed',
|
66
|
+
:expanded_output_file => 'expected.expanded',
|
67
|
+
:compact_output_file => 'expected.compact'
|
68
|
+
}
|
69
|
+
SassSpec::Runner.new(default_options.merge(sass_spec_options)).run || exit(1)
|
70
|
+
ensure
|
71
|
+
$:.replace(old_load_path)
|
72
|
+
end
|
73
|
+
else
|
74
|
+
"Skipping sass-spec on ruby versions less than 1.9.2"
|
75
|
+
end
|
76
|
+
end
|
22
77
|
end
|
23
78
|
|
24
79
|
# ----- Code Style Enforcement -----
|
25
80
|
|
26
|
-
|
81
|
+
def ruby_version_at_least?(version_string)
|
82
|
+
ruby_version = Gem::Version.new(RUBY_VERSION.dup)
|
83
|
+
version = Gem::Version.new(version_string)
|
84
|
+
ruby_version >= version
|
85
|
+
end
|
27
86
|
|
28
|
-
|
29
|
-
# https://github.com/sass/sass/pull/1805.
|
30
|
-
if (version[0] > 1 || (version[0] == 1 && version[1] > 8)) &&
|
31
|
-
(version[0] < 2 || (version[0] == 2 && version[1] < 2)) &&
|
87
|
+
if ruby_version_at_least?("2.2.0") &&
|
32
88
|
(ENV.has_key?("RUBOCOP") && ENV["RUBOCOP"] == "true" ||
|
33
89
|
!(ENV.has_key?("RUBOCOP") || ENV.has_key?("TEST")))
|
34
90
|
require 'rubocop/rake_task'
|
35
91
|
RuboCop = Rubocop unless defined?(RuboCop)
|
36
92
|
RuboCop::RakeTask.new do |t|
|
37
|
-
t.options = ['-c', '.rubocop_0.18.0.yml'] if RUBY_VERSION < '1.9.3'
|
38
93
|
t.patterns = FileList["lib/**/*"]
|
39
94
|
end
|
40
95
|
else
|
41
96
|
task :rubocop do
|
42
97
|
puts "Skipping rubocop style check."
|
43
|
-
if
|
44
|
-
|
45
|
-
|
46
|
-
end
|
98
|
+
next if ENV.has_key?("RUBOCOP") && ENV["RUBOCOP"] != "true"
|
99
|
+
puts "Passing this check is required in order for your patch to be accepted."
|
100
|
+
puts "Use Ruby 2.2 or greater and then run the style check with: rake rubocop"
|
47
101
|
end
|
48
102
|
end
|
49
103
|
|
@@ -113,7 +167,6 @@ end
|
|
113
167
|
|
114
168
|
desc "Release a new Sass package to RubyGems.org."
|
115
169
|
task :release => [:check_release, :package] do
|
116
|
-
name = File.read(scope("VERSION_NAME")).strip
|
117
170
|
version = File.read(scope("VERSION")).strip
|
118
171
|
sh %{gem push pkg/sass-#{version}.gem}
|
119
172
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.4.
|
1
|
+
3.4.22
|
data/VERSION_DATE
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
28 March 2016 23:31:39 UTC
|
data/lib/sass.rb
CHANGED
@@ -100,3 +100,10 @@ require 'sass/engine'
|
|
100
100
|
require 'sass/plugin' if defined?(Merb::Plugins)
|
101
101
|
require 'sass/railtie'
|
102
102
|
require 'sass/features'
|
103
|
+
|
104
|
+
if Sass::Util.ruby1?
|
105
|
+
Sass::Util.sass_warn(
|
106
|
+
"DEPRECATION WARNING:\n" +
|
107
|
+
"Sass 3.5 will no longer support Ruby #{RUBY_VERSION}.\n" +
|
108
|
+
"Please upgrade to Ruby 2.0.0 or greater as soon as possible.\n")
|
109
|
+
end
|
data/lib/sass/callbacks.rb
CHANGED
@@ -51,12 +51,12 @@ module Sass
|
|
51
51
|
def define_callback(name)
|
52
52
|
class_eval <<RUBY, __FILE__, __LINE__ + 1
|
53
53
|
def on_#{name}(&block)
|
54
|
-
@_sass_callbacks
|
54
|
+
@_sass_callbacks = {} unless defined? @_sass_callbacks
|
55
55
|
(@_sass_callbacks[#{name.inspect}] ||= []) << block
|
56
56
|
end
|
57
57
|
|
58
58
|
def run_#{name}(*args)
|
59
|
-
return unless @_sass_callbacks
|
59
|
+
return unless defined? @_sass_callbacks
|
60
60
|
return unless @_sass_callbacks[#{name.inspect}]
|
61
61
|
@_sass_callbacks[#{name.inspect}].each {|c| c[*args]}
|
62
62
|
end
|
data/lib/sass/css.rb
CHANGED
@@ -35,6 +35,7 @@ module Sass
|
|
35
35
|
# Backwards compatibility
|
36
36
|
@options[:old] = true if @options[:alternate] == false
|
37
37
|
@template = template
|
38
|
+
@checked_encoding = false
|
38
39
|
end
|
39
40
|
|
40
41
|
# Converts the CSS template into Sass or SCSS code.
|
@@ -75,14 +76,14 @@ module Sass
|
|
75
76
|
# @return [Tree::Node] The root node of the parsed tree
|
76
77
|
def build_tree
|
77
78
|
root = Sass::SCSS::CssParser.new(@template, @options[:filename], nil).parse
|
78
|
-
parse_selectors
|
79
|
-
expand_commas
|
80
|
-
nest_seqs
|
81
|
-
parent_ref_rules
|
82
|
-
flatten_rules
|
83
|
-
bubble_subject
|
84
|
-
fold_commas
|
85
|
-
dump_selectors
|
79
|
+
parse_selectors(root)
|
80
|
+
expand_commas(root)
|
81
|
+
nest_seqs(root)
|
82
|
+
parent_ref_rules(root)
|
83
|
+
flatten_rules(root)
|
84
|
+
bubble_subject(root)
|
85
|
+
fold_commas(root)
|
86
|
+
dump_selectors(root)
|
86
87
|
root
|
87
88
|
end
|
88
89
|
|
data/lib/sass/engine.rb
CHANGED
@@ -265,6 +265,9 @@ module Sass
|
|
265
265
|
def initialize(template, options = {})
|
266
266
|
@options = self.class.normalize_options(options)
|
267
267
|
@template = template
|
268
|
+
@checked_encoding = false
|
269
|
+
@filename = nil
|
270
|
+
@line = nil
|
268
271
|
end
|
269
272
|
|
270
273
|
# Render the template to CSS.
|
@@ -572,8 +575,8 @@ MSG
|
|
572
575
|
if continued_comment &&
|
573
576
|
child.line == continued_comment.line +
|
574
577
|
continued_comment.lines + 1
|
575
|
-
continued_comment.value.last.sub!(
|
576
|
-
child.value.first.gsub!(
|
578
|
+
continued_comment.value.last.sub!(%r{ \*/\Z}, '')
|
579
|
+
child.value.first.gsub!(%r{\A/\*}, ' *')
|
577
580
|
continued_comment.value += ["\n"] + child.value
|
578
581
|
next
|
579
582
|
end
|
@@ -715,9 +718,12 @@ WARNING
|
|
715
718
|
expr = Sass::Script::Tree::Literal.new(Sass::Script::Value::String.new(""))
|
716
719
|
end_offset = start_offset
|
717
720
|
else
|
718
|
-
expr = parse_script(value,
|
721
|
+
expr = parse_script(value,
|
722
|
+
:offset => to_parser_offset(start_offset),
|
723
|
+
:css_variable => name.start_with?("--"))
|
719
724
|
end_offset = expr.source_range.end_pos.offset - 1
|
720
725
|
end
|
726
|
+
|
721
727
|
node = Tree::PropNode.new(parse_interp(name), expr, prop)
|
722
728
|
node.value_source_range = Sass::Source::Range.new(
|
723
729
|
Sass::Source::Position.new(line.index, to_parser_offset(start_offset)),
|
@@ -1140,9 +1146,9 @@ WARNING
|
|
1140
1146
|
end
|
1141
1147
|
|
1142
1148
|
def parse_script(script, options = {})
|
1143
|
-
line = options
|
1144
|
-
offset = options
|
1145
|
-
Script.parse(script, line, offset, @options)
|
1149
|
+
line = options.delete(:line) || @line
|
1150
|
+
offset = options.delete(:offset) || @offset + 1
|
1151
|
+
Script.parse(script, line, offset, @options.merge(options))
|
1146
1152
|
end
|
1147
1153
|
|
1148
1154
|
def format_comment_text(text, silent)
|
@@ -1154,7 +1160,7 @@ WARNING
|
|
1154
1160
|
end
|
1155
1161
|
|
1156
1162
|
return "/* */" if content.empty?
|
1157
|
-
content.last.gsub!(
|
1163
|
+
content.last.gsub!(%r{ ?\*/ *$}, '')
|
1158
1164
|
first = content.shift unless removed_first
|
1159
1165
|
content.map! {|l| l.gsub!(/^\*( ?)/, '\1') || (l.empty? ? "" : " ") + l}
|
1160
1166
|
content.unshift first unless removed_first
|
@@ -1196,7 +1202,7 @@ WARNING
|
|
1196
1202
|
else
|
1197
1203
|
res << "\\" * [0, escapes - 1].max
|
1198
1204
|
if scan[1].include?("\n")
|
1199
|
-
line
|
1205
|
+
line += scan[1].count("\n")
|
1200
1206
|
offset = scan.matched_size - scan[1].rindex("\n")
|
1201
1207
|
else
|
1202
1208
|
offset += scan.matched_size
|
data/lib/sass/environment.rb
CHANGED
@@ -86,7 +86,14 @@ module Sass
|
|
86
86
|
def initialize(parent = nil, options = nil)
|
87
87
|
@parent = parent
|
88
88
|
@options = options || (parent && parent.options) || {}
|
89
|
-
@stack = Sass::Stack.new
|
89
|
+
@stack = @parent.nil? ? Sass::Stack.new : nil
|
90
|
+
@caller = nil
|
91
|
+
@content = nil
|
92
|
+
@filename = nil
|
93
|
+
@functions = nil
|
94
|
+
@mixins = nil
|
95
|
+
@selector = nil
|
96
|
+
@vars = nil
|
90
97
|
end
|
91
98
|
|
92
99
|
# Returns whether this is the global environment.
|
data/lib/sass/error.rb
CHANGED
@@ -127,7 +127,7 @@ module Sass
|
|
127
127
|
return nil if super.nil?
|
128
128
|
return super if sass_backtrace.all? {|h| h.empty?}
|
129
129
|
sass_backtrace.map do |h|
|
130
|
-
"#{h[:filename] ||
|
130
|
+
"#{h[:filename] || '(sass)'}:#{h[:line]}" +
|
131
131
|
(h[:mixin] ? ":in `#{h[:mixin]}'" : "")
|
132
132
|
end + super
|
133
133
|
end
|
@@ -143,7 +143,7 @@ module Sass
|
|
143
143
|
map {|l| "\n" + (" " * "Error: ".size) + l}.join
|
144
144
|
"Error: #{msg}" +
|
145
145
|
Sass::Util.enum_with_index(sass_backtrace).map do |entry, i|
|
146
|
-
"\n #{i == 0 ?
|
146
|
+
"\n #{i == 0 ? 'on' : 'from'} line #{entry[:line]}" +
|
147
147
|
" of #{entry[:filename] || default_filename}" +
|
148
148
|
(entry[:mixin] ? ", in `#{entry[:mixin]}'" : "")
|
149
149
|
end.join
|
@@ -163,9 +163,9 @@ module Sass
|
|
163
163
|
|
164
164
|
<<END
|
165
165
|
/*
|
166
|
-
#{header.gsub(
|
166
|
+
#{header.gsub('*/', '*\\/')}
|
167
167
|
|
168
|
-
Backtrace:\n#{e.backtrace.join("\n").gsub(
|
168
|
+
Backtrace:\n#{e.backtrace.join("\n").gsub('*/', '*\\/')}
|
169
169
|
*/
|
170
170
|
body:before {
|
171
171
|
white-space: pre;
|
@@ -183,7 +183,7 @@ END
|
|
183
183
|
|
184
184
|
line_num = e.sass_line + 1 - line_offset
|
185
185
|
min = [line_num - 6, 0].max
|
186
|
-
section = e.sass_template.rstrip.split("\n")[min
|
186
|
+
section = e.sass_template.rstrip.split("\n")[min...line_num + 5]
|
187
187
|
return e.sass_backtrace_str if section.nil? || section.empty?
|
188
188
|
|
189
189
|
e.sass_backtrace_str + "\n\n" + Sass::Util.enum_with_index(section).
|