sassc 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/ext/libsass/util.cpp CHANGED
@@ -262,21 +262,15 @@ namespace Sass {
262
262
  {
263
263
  bool ws = false;
264
264
  bool esc = false;
265
- char inside_str = 0;
266
265
  string text = "";
267
- for(auto i : str) {
266
+ for(const char& i : str) {
268
267
  if (!esc && i == '\\') {
269
268
  esc = true;
269
+ ws = false;
270
270
  text += i;
271
271
  } else if (esc) {
272
272
  esc = false;
273
- text += i;
274
- } else if (!inside_str && (i == '"' || i == '\'')) {
275
- inside_str = i;
276
- text += i;
277
- } else if (inside_str) {
278
- if (i == inside_str)
279
- inside_str = false;
273
+ ws = false;
280
274
  text += i;
281
275
  } else if (
282
276
  i == ' ' ||
@@ -401,7 +395,7 @@ namespace Sass {
401
395
 
402
396
  }
403
397
 
404
- string quote(const string& s, char q)
398
+ string quote(const string& s, char q, bool keep_linefeed_whitespace)
405
399
  {
406
400
 
407
401
  // autodetect with fallback to given quote
@@ -430,6 +424,10 @@ namespace Sass {
430
424
  if (cp == 10) {
431
425
  quoted.push_back('\\');
432
426
  quoted.push_back('a');
427
+ // we hope we can remove this flag once we figure out
428
+ // why ruby sass has these different output behaviors
429
+ if (keep_linefeed_whitespace)
430
+ quoted.push_back(' ');
433
431
  } else if (cp < 127) {
434
432
  quoted.push_back((char) cp);
435
433
  } else {
data/ext/libsass/util.hpp CHANGED
@@ -21,7 +21,7 @@ namespace Sass {
21
21
  string comment_to_string(const string& text);
22
22
  string normalize_wspace(const string& str);
23
23
 
24
- string quote(const string&, char q = 0);
24
+ string quote(const string&, char q = 0, bool keep_linefeed_whitespace = false);
25
25
  string unquote(const string&, char* q = 0);
26
26
  char detect_best_quotemark(const char* s, char qm = '"');
27
27
 
data/lib/sassc/engine.rb CHANGED
@@ -77,9 +77,13 @@ module SassC
77
77
  end
78
78
 
79
79
  def output_style
80
- style = @options.fetch(:style, :sass_style_nested).to_sym
81
- raise InvalidStyleError unless Native::SassOutputStyle.symbols.include?(style)
82
- style
80
+ @output_style ||= begin
81
+ style = @options.fetch(:style, :sass_style_nested).to_s
82
+ style = "sass_style_#{style}" unless style.include?("sass_style_")
83
+ style = style.to_sym
84
+ raise InvalidStyleError unless Native::SassOutputStyle.symbols.include?(style)
85
+ style
86
+ end
83
87
  end
84
88
 
85
89
  def load_paths
data/lib/sassc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SassC
2
- VERSION = "1.1.2"
2
+ VERSION = "1.2.0"
3
3
  end
data/test/native_test.rb CHANGED
@@ -9,7 +9,7 @@ module SassC
9
9
 
10
10
  class General < MiniTest::Test
11
11
  def test_it_reports_the_libsass_version
12
- assert_equal "3.2.2", Native.version
12
+ assert_equal "3.2.4", Native.version
13
13
  end
14
14
  end
15
15
 
@@ -91,6 +91,13 @@ CSS
91
91
  def test_compressed_output
92
92
  engine = Engine.new(input_scss, style: :sass_style_compressed)
93
93
  assert_equal <<-CSS, engine.render
94
+ #main{color:#fff;background-color:#000}#main p{width:10em}.huge{font-size:10em;font-weight:bold;text-decoration:underline}
95
+ CSS
96
+ end
97
+
98
+ def test_short_output_style_names
99
+ engine = Engine.new(input_scss, style: :compressed)
100
+ assert_equal <<-CSS, engine.render
94
101
  #main{color:#fff;background-color:#000}#main p{width:10em}.huge{font-size:10em;font-weight:bold;text-decoration:underline}
95
102
  CSS
96
103
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sassc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Boland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-03 00:00:00.000000000 Z
11
+ date: 2015-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake