Skip to content

Commit daf44b6

Browse files
committed
Merge branch 'stable'
Conflicts: lib/sass/selector/sequence.rb test/sass/scss/scss_test.rb
2 parents 4b0ad09 + 2798d48 commit daf44b6

File tree

6 files changed

+55
-5
lines changed

6 files changed

+55
-5
lines changed

Rakefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ end
2424
# Don't use Rake::GemPackageTast because we want prerequisites to run
2525
# before we load the gemspec.
2626
desc "Build all the packages."
27-
task :package => [:revision_file, :submodules, :permissions] do
27+
task :package => [:revision_file, :date_file, :submodules, :permissions] do
2828
version = get_version
2929
File.open(scope('VERSION'), 'w') {|f| f.puts(version)}
3030
load scope('sass.gemspec')
@@ -63,8 +63,17 @@ task :revision_file do
6363
end
6464
end
6565

66+
task :date_file do
67+
File.open(scope('VERSION_DATE'), 'w') do |f|
68+
f.puts Time.now.utc.strftime('%d %B %Y %T %Z')
69+
end
70+
end
71+
6672
# We also need to get rid of this file after packaging.
67-
at_exit { File.delete(scope('REVISION')) rescue nil }
73+
at_exit do
74+
File.delete(scope('REVISION')) rescue nil
75+
File.delete(scope('VERSION_DATE')) rescue nil
76+
end
6877

6978
desc "Install Sass as a gem. Use SUDO=1 to install with sudo."
7079
task :install => [:package] do

doc-src/SASS_CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ This will not print a warning.
185185

186186
* Preserve single-line comments that are embedded within multi-line comments.
187187

188+
* Preserve newlines in nested selectors when those selectors are used multiple
189+
times in the same document.
190+
191+
* Allow tests to be run without the `LANG` environment variable set.
192+
188193
* Update the bundled version of [Listen](https://github.com/guard/listen) to
189194
0.4.7.
190195

lib/sass/selector/sequence.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ def initialize(seqs_and_ops)
4646
# @return [Sequence] This selector, with parent references resolved
4747
# @raise [Sass::SyntaxError] If a parent selector is invalid
4848
def resolve_parent_refs(super_seq)
49-
members = @members
49+
members = @members.dup
5050
nl = (members.first == "\n" && members.shift)
5151
unless members.any? do |seq_or_op|
5252
seq_or_op.is_a?(SimpleSequence) && seq_or_op.members.first.is_a?(Parent)
5353
end
54-
members = []
54+
old_members, members = members, []
5555
members << nl if nl
5656
members << SimpleSequence.new([Parent.new], false)
57-
members += @members
57+
members += old_members
5858
end
5959

6060
Sequence.new(

lib/sass/version.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'date'
2+
13
# This is necessary for loading Sass when Haml is required in Rails 3.
24
# Once the split is complete, we can remove it.
35
require File.dirname(__FILE__) + '/../sass'
@@ -16,13 +18,15 @@ module Version
1618
# The `:name` key has the name of the version.
1719
# The `:string` key contains a human-readable string representation of the version.
1820
# The `:number` key is the major, minor, and teeny keys separated by periods.
21+
# The `:date` key, which is not guaranteed to be defined, is the [DateTime] at which this release was cut.
1922
# If Sass is checked out from Git, the `:rev` key will have the revision hash.
2023
# For example:
2124
#
2225
# {
2326
# :string => "2.1.0.9616393",
2427
# :rev => "9616393b8924ef36639c7e82aa88a51a24d16949",
2528
# :number => "2.1.0",
29+
# :date => DateTime.parse("Apr 30 13:52:01 2009 -0700"),
2630
# :major => 2, :minor => 1, :teeny => 0
2731
# }
2832
#
@@ -36,6 +40,7 @@ module Version
3640
# {
3741
# :string => "3.0.beta.1",
3842
# :number => "3.0.beta.1",
43+
# :date => DateTime.parse("Mar 31 00:38:04 2010 -0700"),
3944
# :major => 3, :minor => 0, :teeny => -1,
4045
# :prerelease => "beta",
4146
# :prerelease_number => 1
@@ -55,6 +60,10 @@ def version
5560
:name => name
5661
}
5762

63+
if date = version_date
64+
@@version[:date] = date
65+
end
66+
5867
if numbers[3].is_a?(String)
5968
@@version[:teeny] = -1
6069
@@version[:prerelease] = numbers[3]
@@ -101,6 +110,11 @@ def revision_number
101110
end
102111
return nil
103112
end
113+
114+
def version_date
115+
return unless File.exists?(scope('VERSION_DATE'))
116+
return DateTime.parse(File.read(scope('VERSION_DATE')).strip)
117+
end
104118
end
105119

106120
extend Sass::Version

test/sass/scss/scss_test.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,27 @@ def test_reference_combinator_with_parent_ref
13571357
SCSS
13581358
end
13591359

1360+
def test_newline_selector_rendered_multiple_times
1361+
assert_equal <<CSS, render(<<SCSS)
1362+
form input,
1363+
form select {
1364+
color: white; }
1365+
1366+
form input,
1367+
form select {
1368+
color: white; }
1369+
CSS
1370+
@for $i from 1 through 2 {
1371+
form {
1372+
input,
1373+
select {
1374+
color: white;
1375+
}
1376+
}
1377+
}
1378+
SCSS
1379+
end
1380+
13601381
def test_prop_name_interpolation_after_hyphen
13611382
assert_equal <<CSS, render(<<SCSS)
13621383
a {

test/test_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
require 'mathn' if ENV['MATHN'] == 'true'
88

99
Sass::RAILS_LOADED = true unless defined?(Sass::RAILS_LOADED)
10+
Encoding.default_external = 'UTF-8' if defined?(Encoding)
1011

1112
module Sass::Script::Functions
1213
def option(name)

0 commit comments

Comments
 (0)