sassc 1.12.0 → 1.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab44abdb4f517313bbeca4618c3c5263c5a2ce18f80344b53cad2a13abca571c
4
- data.tar.gz: e3a28dae62d1fe1ea9c4f97ee67c8952081facad4816c80d0e55b72b414476a1
3
+ metadata.gz: '04176064892f9e9a76a5817dbcee82dbe97ed15550fce3079221c86093103670'
4
+ data.tar.gz: 48a3cb002d56556c76e520d873ec276c9d69bdae858b0586c9cee3cf4d5acc8c
5
5
  SHA512:
6
- metadata.gz: 6c564ec31e5a8f3e3d13390803acbe204f4033160f2881a5b69b200e1e6c24995e1b0f9e22959dd14c2481fd6b8ccc3f0c3fc692030cbe10c5e077614a1476e4
7
- data.tar.gz: '09be01e502cf20d52ced8e4e975c8a2327403b51b99c76a9121bc24d821158ff6f016e2779f632fa94f2db3fb7a71d40fcada1f8ecdbb39ae08f82ec4eaf3c10'
6
+ metadata.gz: d22d06995c99d8c72a7887a3c432689683a17987dbd60c682571be0f7f97ad7ca5cc6de83738a1c44e348da3fe98f87728594b633fc85a9d7907b31cf241e645
7
+ data.tar.gz: a61ebd11b851d986ac24bf9180cc3830082068da3b3e3096d12cc1ce8308ebf70d2f75a8224797e4c134576cdc67cd88824db97d39f4b30ef91c5bf3672a72c8
data/README.md CHANGED
@@ -6,7 +6,7 @@ This gem combines the speed of `libsass`, the [Sass C implementation](https://gi
6
6
 
7
7
  ### libsass Version
8
8
 
9
- [3.5.4](https://github.com/sass/libsass/releases/tag/3.5.4)
9
+ [3.5.2](https://github.com/sass/libsass/releases/tag/3.5.2)
10
10
 
11
11
  ## Installation
12
12
 
@@ -48,6 +48,8 @@ This gem is maintained by [Ryan Boland](https://ryanboland.com)
48
48
  and [awesome contributors](https://github.com/bolandrm/sassc-ruby/graphs/contributors).
49
49
 
50
50
  ## Changelog
51
+ - **1.12.1**
52
+ - [Downgrade to libsass 3.5.2 to fix css imports](https://github.com/sass/sassc-ruby/pull/81)
51
53
  - **1.12.0**
52
54
  - [Update Libsass to 3.5.4](https://github.com/sass/sassc-ruby/pull/78)
53
55
  - [bundler is a development dependency](https://github.com/sass/sassc-ruby/pull/51)
@@ -25,49 +25,63 @@ else
25
25
  AM_CXXFLAGS += -std=c++0x
26
26
  endif
27
27
 
28
- TEST_EXTENSIONS = .rb
29
-
30
28
  if ENABLE_TESTS
31
29
 
32
- SASS_SASSC_PATH ?= $(top_srcdir)/sassc
33
- SASS_SPEC_PATH ?= $(top_srcdir)/sass-spec
34
-
35
30
  noinst_PROGRAMS = tester
31
+
36
32
  tester_LDADD = src/libsass.la
33
+ tester_SOURCES = $(SASS_SASSC_PATH)/sassc.c
34
+ tester_VERSION ?= `cd "$(SASS_SASSC_PATH)" && ./version.sh`
35
+ tester_CFLAGS = $(AM_CFLAGS) -DSASSC_VERSION="\"$(tester_VERSION)\""
36
+ tester_CXXFLAGS = $(AM_CXXFLAGS) -DSASSC_VERSION="\"$(tester_VERSION)\""
37
37
  tester_LDFLAGS = $(AM_LDFLAGS)
38
- nodist_tester_SOURCES = $(SASS_SASSC_PATH)/sassc.c
39
- SASS_SASSC_VERSION ?= `cd "$(SASS_SASSC_PATH)" && ./version.sh`
40
- tester_CFLAGS = $(AM_CFLAGS) -DSASSC_VERSION="\"$(SASS_SASSC_VERSION)\""
41
- tester_CXXFLAGS = $(AM_CXXFLAGS) -DSASSC_VERSION="\"$(SASS_SASSC_VERSION)\""
42
38
 
43
39
  if ENABLE_COVERAGE
44
40
  nodist_EXTRA_tester_SOURCES = non-existent-file-to-force-CXX-linking.cxx
45
41
  endif
46
42
 
47
- TESTS = $(SASS_SPEC_PATH)/sass-spec.rb
48
- RB_LOG_COMPILER = ./script/tap-runner
49
- AM_RB_LOG_FLAGS = $(RUBY)
43
+ SASS_SASSC_PATH ?= $(top_srcdir)/sassc
44
+ SASS_SPEC_PATH ?= $(top_srcdir)/sass-spec
45
+
46
+ TESTS = \
47
+ $(SASS_SPEC_PATH)/spec/basic \
48
+ $(SASS_SPEC_PATH)/spec/css \
49
+ $(SASS_SPEC_PATH)/spec/extend-tests \
50
+ $(SASS_SPEC_PATH)/spec/extends \
51
+ $(SASS_SPEC_PATH)/spec/libsass \
52
+ $(SASS_SPEC_PATH)/spec/libsass-closed-issues \
53
+ $(SASS_SPEC_PATH)/spec/maps \
54
+ $(SASS_SPEC_PATH)/spec/misc \
55
+ $(SASS_SPEC_PATH)/spec/regressions \
56
+ $(SASS_SPEC_PATH)/spec/scss \
57
+ $(SASS_SPEC_PATH)/spec/scss-tests \
58
+ $(SASS_SPEC_PATH)/spec/types
50
59
 
51
60
  SASS_TEST_FLAGS = -V 3.5 --impl libsass
52
- SASS_TEST_FLAGS += -r $(SASS_SPEC_PATH)
53
- SASS_TEST_FLAGS += -c $(top_srcdir)/tester$(EXEEXT)
54
- AM_TESTS_ENVIRONMENT = TEST_FLAGS='$(SASS_TEST_FLAGS)'
61
+ LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) ./script/tap-driver
62
+ AM_LOG_FLAGS = -c ./tester $(LOG_FLAGS)
63
+ if USE_TAP
64
+ AM_LOG_FLAGS += -t
65
+ SASS_TEST_FLAGS += -t | tapout
66
+ LOG_COMPILER = ./script/tap-runner $(RUBY) $(SASS_SPEC_PATH)/sass-spec.rb
67
+ else
68
+ LOG_COMPILER = $(RUBY) $(SASS_SPEC_PATH)/sass-spec.rb
69
+ endif
55
70
 
56
71
  SASS_TESTER = $(RUBY) $(SASS_SPEC_PATH)/sass-spec.rb
72
+ SASS_TESTER += -c $(top_srcdir)/tester$(EXEEXT)
57
73
 
58
74
  test:
59
- $(SASS_TESTER) $(SASS_TEST_FLAGS)
75
+ $(SASS_TESTER) $(LOG_FLAGS) $(SASS_SPEC_PATH) $(SASS_TEST_FLAGS)
60
76
 
61
77
  test_build:
62
- $(SASS_TESTER) $(SASS_TEST_FLAGS)
78
+ $(SASS_TESTER) $(LOG_FLAGS) $(SASS_SPEC_PATH) $(SASS_TEST_FLAGS)
63
79
 
64
80
  test_full:
65
- $(SASS_TESTER) --run-todo $(SASS_TEST_FLAGS)
81
+ $(SASS_TESTER) --run-todo $(LOG_FLAGS) $(SASS_SPEC_PATH) $(SASS_TEST_FLAGS)
66
82
 
67
83
  test_probe:
68
- $(SASS_TESTER) --probe-todo $(SASS_TEST_FLAGS)
69
-
70
- .PHONY: test test_build test_full test_probe
84
+ $(SASS_TESTER) --probe-todo $(LOG_FLAGS) $(SASS_SPEC_PATH) $(SASS_TEST_FLAGS)
71
85
 
72
86
  endif
73
87
 
@@ -9,7 +9,6 @@ AC_CONFIG_MACRO_DIR([m4])
9
9
  AC_CONFIG_HEADERS([src/config.h])
10
10
  AC_CONFIG_FILES([include/sass/version.h])
11
11
  AC_CONFIG_AUX_DIR([script])
12
-
13
12
  # These are flags passed to automake
14
13
  # Though they look like gcc flags!
15
14
  AM_INIT_AUTOMAKE([foreign parallel-tests -Wall])
@@ -94,16 +93,21 @@ the --with-sass-spec-dir=<dir> argument.
94
93
  ;;
95
94
  esac
96
95
  AC_SUBST(SASS_SPEC_PATH)
97
- else
98
- # we do not really need these paths for non test build
99
- # but automake may error if we do not define them here
100
- SASS_SPEC_PATH=sass-spec
101
- SASS_SASSC_PATH=sassc
102
- AC_SUBST(SASS_SPEC_PATH)
103
- AC_SUBST(SASS_SASSC_PATH)
96
+
97
+ # TODO: Remove this when automake requirements are 1.12+
98
+ AC_MSG_CHECKING([whether we can use TAP mode])
99
+ tmp=`$AWK '/TEST_LOG_DRIVER/' $srcdir/GNUmakefile.in`
100
+ if test "x$tmp" != "x"; then
101
+ use_tap=yes
102
+ else
103
+ use_tap=no
104
+ fi
105
+ AC_MSG_RESULT([$use_tap])
106
+
104
107
  fi
105
108
 
106
109
  AM_CONDITIONAL(ENABLE_TESTS, test "x$enable_tests" = "xyes")
110
+ AM_CONDITIONAL(USE_TAP, test "x$use_tap" = "xyes")
107
111
 
108
112
  AC_ARG_ENABLE([coverage],
109
113
  [AS_HELP_STRING([--enable-coverage],
@@ -14,17 +14,6 @@ There are several implementations of `libsass` for a variety of languages. Here
14
14
  * [go_sass](https://github.com/suapapa/go_sass)
15
15
  * [go-sass](https://github.com/SamWhited/go-sass)
16
16
 
17
- ### Haskell
18
- * [hLibsass](https://github.com/jakubfijalkowski/hlibsass)
19
- * [hSass](https://github.com/jakubfijalkowski/hsass)
20
-
21
- ### Java
22
- * [libsass-maven-plugin](https://github.com/warmuuh/libsass-maven-plugin)
23
- * [jsass](https://github.com/bit3/jsass)
24
-
25
- ### JavaScript
26
- * [sass.js](https://github.com/medialize/sass.js)
27
-
28
17
  ### Lua
29
18
  * [lua-sass](https://github.com/craigbarnes/lua-sass)
30
19
 
@@ -32,14 +21,16 @@ There are several implementations of `libsass` for a variety of languages. Here
32
21
  * [libsass-net](https://github.com/darrenkopp/libsass-net)
33
22
  * [NSass](https://github.com/TBAPI-0KA/NSass)
34
23
  * [Sass.Net](https://github.com/andyalm/Sass.Net)
35
- * [SharpScss](https://github.com/xoofx/SharpScss)
36
- * [LibSassHost](https://github.com/Taritsyn/LibSassHost)
37
-
38
- ### Nim
39
- * [nim-sass](https://github.com/zacharycarter/nim-sass)
40
24
 
41
25
  ### node.js
42
- * [node-sass](https://github.com/sass/node-sass)
26
+ * [node-sass](https://github.com/andrew/node-sass)
27
+
28
+ ### Java
29
+ * [libsass-maven-plugin](https://github.com/warmuuh/libsass-maven-plugin)
30
+ * [jsass](https://github.com/bit3/jsass)
31
+
32
+ ### JavaScript
33
+ * [sass.js](https://github.com/medialize/sass.js)
43
34
 
44
35
  ### Perl
45
36
  * [CSS::Sass](https://github.com/caldwell/CSS-Sass)
@@ -1,33 +1,27 @@
1
- LibSass currently expects all input to be utf8 encoded (and outputs only utf8), if you actually have any unicode characters at all. We do not support conversion between encodings, even if you declare it with a `@charset` rule. The text below was originally posted as an [issue](https://github.com/sass/libsass/issues/381) on the LibSass tracker. Since then the status is outdated as LibSass now expects your
2
- input to be utf8/ascii compatible, as it has been proven that reading ANSI (e.g. single byte encodings) as utf8 can lead to unexpected
3
- behavior, which can in the worst case lead to buffer overruns/segfaults. Therefore LibSass now checks your input to be valid utf8 encoded!
1
+ LibSass currently expects all input to be utf8 encoded (and outputs only utf8), if you actually have any unicode characters at all. We do not support conversion between encodings, even if you declare it with a `@charset` rule. The text below was originally posted as an [issue](https://github.com/sass/libsass/issues/381) on the LibSass tracker.
4
2
 
5
3
  ### [Declaring character encodings in CSS](http://www.w3.org/International/questions/qa-css-charset.en)
6
4
 
7
- This [explains](http://www.w3.org/International/questions/qa-css-charset.en) how the character encoding of a css file is determined. Since we are only dealing with local files, we never have a HTTP header. So the precedence should be 'charset' rule, byte-order mark (BOM) or auto-detection (finally falling back to system default/UTF-8). This may not sound too hard to implement, but what about import rules? The CSS specs do not forbid the mixing of different encodings! I [solved that](https://github.com/mgreter/webmerge/) by converting all files to UTF-8 internally. On writing there is an option to tell the tool what encoding it should be (UTF-8 by default). One can also define if it should write a BOM or not and if it should add the charset declaration.
5
+ This [explains](http://www.w3.org/International/questions/qa-css-charset.en) how the character encoding of a css file is determined. Since we are only dealing with local files, we never have a HTTP header. So the precedence should be 'charset' rule, byte-order mark (BOM) or auto-detection (finally falling back to system default/UTF-8). This may not sound too hard to implement, but what about import rules? The CSS specs do not forbid the mixing of different encodings! I solved that by converting all files to UTF-8 internally. On writing there is an option to tell the tool what encoding it should be (UTF-8 by default). One can also define if it should write a BOM or not and if it should add the charset declaration.
8
6
 
9
- Since my [tool]((https://github.com/mgreter/webmerge/)) is written in perl, I have a lot of utilities at hand to deal with different unicode charsets. I'm pretty sure that most OSS uses [ICU](http://site.icu-project.org/) or [libiconv](https://www.gnu.org/software/libiconv/) to convert between different encodings. But I have now idea how easy/hard this would be to integrate platform independent (it seems doable). ANSII (single byte encoding) to utf8 is basically just a conversion table (for every supported code-page).
7
+ Since my tool is written in perl, I have a lot of utilities at hand to deal with different unicode charsets. I'm pretty sure that most OSS uses [libiconv](https://www.gnu.org/software/libiconv/) to convert between different encodings. But I have now idea how easy/hard this would be to integrate platform independent (it seems doable).
10
8
 
11
9
  ### Current status on LibSass unicode support
12
10
 
13
- LibSass should/is fully UTF (and therefore plain ASCII) compatible.
14
-
15
- ~~Currently LibSass seems to handle the common UTF-8 case pretty well. I believe it should correctly support all ASCII compatible encodings (like UTF-8 or Latin-1). If all includes use the same encoding, the output should be correct (in the same encoding). It should also handle unicode chars in [selectors, variable names and other identifiers](https://github.com/hcatlin/libsass/issues/244#issuecomment-34681227). This is true for all ASCII compatible encodings. So the main incompatible encodings (I'm aware of) are UTF-16/UTF-32 (which could be converted to UTF-8 with libiconv).~~
16
-
17
- LibSass 3.5 will enforce that your input is either plain ASCII (chars below 127) or utf8. It does not handle anything else, but therefore ensures that the output is in a valid form. Before version 3.5 you were able to mix different code-pages, which yielded unexpected behavior.
11
+ Currently LibSass seems to handle the common UTF-8 case pretty well. I believe it should correctly support all ASCII compatible encodings (like UTF-8 or Latin-1). If all includes use the same encoding, the output should be correct (in the same encoding). It should also handle unicode chars in [selectors, variable names and other identifiers](https://github.com/hcatlin/libsass/issues/244#issuecomment-34681227). This is true for all ASCII compatible encodings. So the main incompatible encodings (I'm aware of) are UTF-16/UTF-32 (which could be converted to UTF-8 with libiconv).
18
12
 
19
13
  ### Current encoding auto detection
20
14
 
21
- LibSass currently reads all kind of BOMs and will error out if it finds something it doesn't know how to handle! It seems that it throws away the optional UTF-8 BOM (if any is found). IMO it would be nice if users could configure that (also if a charset rule should be added to the output). But it does not really take any `@charset` into account, it always assumes your input is utf8 and ignores any given `@charset`!
15
+ LibSass currently reads all kind of BOMs and will error out if it finds something it doesn't know how to handle! It seems that it throws away the optional UTF-8 BOM (if any is found). IMO it would be nice if users could configure that (also if a charset rule should be added to the output).
22
16
 
23
17
  ### What is currently not supported
24
18
 
25
- - Using non ASCII compatible encodings (like UTF-16, Latin-1 etc.)
19
+ - Using non ASCII compatible encodings (like UTF-16)
26
20
  - Using non ASCII characters in different encodings in different includes
27
21
 
28
22
  ### What is missing to support the above cases
29
23
 
30
- - A way to convert between encodings (like libiconv/ICU)
24
+ - A way to convert between encodings (like libiconv)
31
25
  - Sniffing the charset inside the file (source is available)
32
26
  - Handling the conversion on import (and export)
33
27
  - Optional: Make output encoding configurable
@@ -37,9 +31,9 @@ LibSass currently reads all kind of BOMs and will error out if it finds somethin
37
31
 
38
32
  I guess the current implementation should handle more than 99% of all real world use cases.
39
33
  A) Unicode characters are still seldomly seen (as they can be written escaped)
40
- ~~B) It will still work if it's UTF-8 or in any of the most common known western ISO codepages.
41
- Although I'm not sure how this applies to asian and other "exotic" codepages!~~
34
+ B) It will still work if it's UTF-8 or in any of the most common known western ISO codepages.
35
+ Although I'm not sure how this applies to asian and other "exotic" codepages!
42
36
 
43
- I guess the biggest Problem is to have libiconv/ICU (or some other) library as a dependency. Since it contains a lot of rules for the conversions, I see it as the only way to handle this correctly. Once that is sorted out it should be pretty much straight forward to implement the missing pieces (in parser.cpp - Parser::parse should return encoding and add Parser::sniff_charset, then convert the source byte stream to UTF-8).
37
+ I guess the biggest Problem is to have libiconv (or some other) library as a dependency. Since it contains a lot of rules for the conversions, I see it as the only way to handle this correctly. Once that is sorted out it should be pretty much straight forward to implement the missing pieces (in parser.cpp - Parser::parse should return encoding and add Parser::sniff_charset, then convert the source byte stream to UTF-8).
44
38
 
45
39
  I hope the statements above all hold true. Unicode is really not the easiest topic to wrap your head around. But since I did all the above recently in Perl, I wanted to document it here. Feel free to extend or criticize.
@@ -149,9 +149,6 @@ ADDAPI size_t ADDCALL sass_compiler_get_callee_stack_size(struct Sass_Compiler*
149
149
  ADDAPI Sass_Callee_Entry ADDCALL sass_compiler_get_last_callee(struct Sass_Compiler* compiler);
150
150
  ADDAPI Sass_Callee_Entry ADDCALL sass_compiler_get_callee_entry(struct Sass_Compiler* compiler, size_t idx);
151
151
 
152
- // Push function for import extenions
153
- ADDAPI void ADDCALL sass_option_push_import_extension (struct Sass_Options* options, const char* ext);
154
-
155
152
  // Push function for paths (no manipulation support for now)
156
153
  ADDAPI void ADDCALL sass_option_push_plugin_path (struct Sass_Options* options, const char* path);
157
154
  ADDAPI void ADDCALL sass_option_push_include_path (struct Sass_Options* options, const char* path);
@@ -1 +1 @@
1
- $@ $TEST_FLAGS --tap --silent | tapout tap
1
+ $@ | tapout tap
@@ -96,8 +96,6 @@ namespace Sass {
96
96
  // include_paths.push_back(CWD);
97
97
 
98
98
  // collect more paths from different options
99
- collect_extensions(c_options.extension);
100
- collect_extensions(c_options.extensions);
101
99
  collect_include_paths(c_options.include_path);
102
100
  collect_include_paths(c_options.include_paths);
103
101
  collect_plugin_paths(c_options.plugin_path);
@@ -168,37 +166,6 @@ namespace Sass {
168
166
  {
169
167
  }
170
168
 
171
- void Context::collect_extensions(const char* exts_str)
172
- {
173
- if (exts_str) {
174
- const char* beg = exts_str;
175
- const char* end = Prelexer::find_first<PATH_SEP>(beg);
176
-
177
- while (end) {
178
- std::string ext(beg, end - beg);
179
- if (!ext.empty()) {
180
- extensions.push_back(ext);
181
- }
182
- beg = end + 1;
183
- end = Prelexer::find_first<PATH_SEP>(beg);
184
- }
185
-
186
- std::string ext(beg);
187
- if (!ext.empty()) {
188
- extensions.push_back(ext);
189
- }
190
- }
191
- }
192
-
193
- void Context::collect_extensions(string_list* paths_array)
194
- {
195
- while (paths_array)
196
- {
197
- collect_extensions(paths_array->string);
198
- paths_array = paths_array->next;
199
- }
200
- }
201
-
202
169
  void Context::collect_include_paths(const char* paths_str)
203
170
  {
204
171
  if (paths_str) {
@@ -269,20 +236,15 @@ namespace Sass {
269
236
  // looks for alternatives and returns a list from one directory
270
237
  std::vector<Include> Context::find_includes(const Importer& import)
271
238
  {
272
- // include configured extensions
273
- std::vector<std::string> exts(File::defaultExtensions);
274
- if (extensions.size() > 0) {
275
- exts.insert(exts.end(), extensions.begin(), extensions.end());
276
- }
277
239
  // make sure we resolve against an absolute path
278
240
  std::string base_path(rel2abs(import.base_path));
279
241
  // first try to resolve the load path relative to the base path
280
- std::vector<Include> vec(resolve_includes(base_path, import.imp_path, exts));
242
+ std::vector<Include> vec(resolve_includes(base_path, import.imp_path));
281
243
  // then search in every include path (but only if nothing found yet)
282
244
  for (size_t i = 0, S = include_paths.size(); vec.size() == 0 && i < S; ++i)
283
245
  {
284
246
  // call resolve_includes and individual base path and append all results
285
- std::vector<Include> resolved(resolve_includes(include_paths[i], import.imp_path, exts));
247
+ std::vector<Include> resolved(resolve_includes(include_paths[i], import.imp_path));
286
248
  if (resolved.size()) vec.insert(vec.end(), resolved.begin(), resolved.end());
287
249
  }
288
250
  // return vector
@@ -403,14 +365,6 @@ namespace Sass {
403
365
  // process the resolved entry
404
366
  else if (resolved.size() == 1) {
405
367
  bool use_cache = c_importers.size() == 0;
406
- if (resolved[0].deprecated) {
407
- // emit deprecation warning when import resolves to a .css file
408
- deprecated(
409
- "Including .css files with @import is non-standard behaviour which will be removed in future versions of LibSass.",
410
- "Use a custom importer to maintain this behaviour. Check your implementations documentation on how to create a custom importer.",
411
- true, pstate
412
- );
413
- }
414
368
  // use cache for the resource loading
415
369
  if (use_cache && sheets.count(resolved[0].abs_path)) return resolved[0];
416
370
  // try to read the content of the resolved file entry
@@ -67,7 +67,6 @@ namespace Sass {
67
67
 
68
68
  std::vector<std::string> plugin_paths; // relative paths to load plugins
69
69
  std::vector<std::string> include_paths; // lookup paths for includes
70
- std::vector<std::string> extensions; // lookup extensions for imports`
71
70
 
72
71
 
73
72
 
@@ -110,8 +109,6 @@ namespace Sass {
110
109
  void collect_plugin_paths(string_list* paths_array);
111
110
  void collect_include_paths(const char* paths_str);
112
111
  void collect_include_paths(string_list* paths_array);
113
- void collect_extensions(const char* extensions_str);
114
- void collect_extensions(string_list* extensions_array);
115
112
  std::string format_embedded_source_map();
116
113
  std::string format_source_mapping_url(const std::string& out_path);
117
114
 
@@ -559,7 +559,7 @@ namespace Sass {
559
559
 
560
560
  std::string m1 = std::string(mq1->is_restricted() ? "only" : mq1->is_negated() ? "not" : "");
561
561
  std::string t1 = mq1->media_type() ? mq1->media_type()->to_string(ctx.c_options) : "";
562
- std::string m2 = std::string(mq2->is_restricted() ? "only" : mq2->is_negated() ? "not" : "");
562
+ std::string m2 = std::string(mq2->is_restricted() ? "only" : mq1->is_negated() ? "not" : "");
563
563
  std::string t2 = mq2->media_type() ? mq2->media_type()->to_string(ctx.c_options) : "";
564
564
 
565
565
 
@@ -627,7 +627,6 @@ inline void debug_ast(AST_Node_Ptr node, std::string ind, Env* env)
627
627
  Number_Ptr expression = Cast<Number>(node);
628
628
  std::cerr << ind << "Number " << expression;
629
629
  std::cerr << " (" << pstate_source_position(node) << ")";
630
- std::cerr << " [delayed: " << expression->is_delayed() << "] ";
631
630
  std::cerr << " [interpolant: " << expression->is_interpolant() << "] ";
632
631
  std::cerr << " [" << expression->value() << expression->unit() << "]" <<
633
632
  " [hash: " << expression->hash() << "] " <<
@@ -599,6 +599,10 @@ namespace Sass {
599
599
  switch (op_type) {
600
600
  case Sass_OP::EQ: return *l_n == *r_c ? bool_true : bool_false;
601
601
  case Sass_OP::NEQ: return *l_n == *r_c ? bool_false : bool_true;
602
+ case Sass_OP::LT: return *l_n < *r_c ? bool_true : bool_false;
603
+ case Sass_OP::GTE: return *l_n < *r_c ? bool_false : bool_true;
604
+ case Sass_OP::LTE: return *l_n < *r_c || *l_n == *r_c ? bool_true : bool_false;
605
+ case Sass_OP::GT: return *l_n < *r_c || *l_n == *r_c ? bool_false : bool_true;
602
606
  case Sass_OP::ADD: case Sass_OP::SUB: case Sass_OP::MUL: case Sass_OP::DIV: case Sass_OP::MOD:
603
607
  return Operators::op_number_color(op_type, *l_n, *r_c, ctx.c_options, b_in->pstate());
604
608
  default: break;
@@ -639,6 +643,10 @@ namespace Sass {
639
643
  switch (op_type) {
640
644
  case Sass_OP::EQ: return *l_c == *r_n ? bool_true : bool_false;
641
645
  case Sass_OP::NEQ: return *l_c == *r_n ? bool_false : bool_true;
646
+ case Sass_OP::LT: return *l_c < *r_n ? bool_true : bool_false;
647
+ case Sass_OP::GTE: return *l_c < *r_n ? bool_false : bool_true;
648
+ case Sass_OP::LTE: return *l_c < *r_n || *l_c == *r_n ? bool_true : bool_false;
649
+ case Sass_OP::GT: return *l_c < *r_n || *l_c == *r_n ? bool_false : bool_true;
642
650
  case Sass_OP::ADD: case Sass_OP::SUB: case Sass_OP::MUL: case Sass_OP::DIV: case Sass_OP::MOD:
643
651
  return Operators::op_color_number(op_type, *l_c, *r_n, ctx.c_options, b_in->pstate());
644
652
  default: break;
@@ -1257,6 +1265,13 @@ namespace Sass {
1257
1265
 
1258
1266
  Expression_Ptr Eval::operator()(String_Constant_Ptr s)
1259
1267
  {
1268
+ if (!s->is_delayed() && name_to_color(s->value())) {
1269
+ Color_Ptr c = SASS_MEMORY_COPY(name_to_color(s->value())); // copy
1270
+ c->pstate(s->pstate());
1271
+ c->disp(s->value());
1272
+ c->is_delayed(true);
1273
+ return c;
1274
+ }
1260
1275
  return s;
1261
1276
  }
1262
1277
 
@@ -246,8 +246,7 @@ namespace Sass {
246
246
  std::string str(prop->to_string(ctx.c_options));
247
247
  new_p = SASS_MEMORY_NEW(String_Constant, old_p->pstate(), str);
248
248
  }
249
- Expression_Obj value = d->value();
250
- if (value) value = value->perform(&eval);
249
+ Expression_Obj value = d->value()->perform(&eval);
251
250
  Block_Obj bb = ab ? operator()(ab) : NULL;
252
251
  if (!bb) {
253
252
  if (!value || (value->is_invisible() && !d->is_important())) return 0;
@@ -342,13 +342,13 @@ namespace Sass {
342
342
  for(auto ext : exts) {
343
343
  rel_path = join_paths(base, "_" + name + ext);
344
344
  abs_path = join_paths(root, rel_path);
345
- if (file_exists(abs_path)) includes.push_back({{ rel_path, root }, abs_path, ext == ".css" });
345
+ if (file_exists(abs_path)) includes.push_back({{ rel_path, root }, abs_path });
346
346
  }
347
347
  // next test plain name with exts
348
348
  for(auto ext : exts) {
349
349
  rel_path = join_paths(base, name + ext);
350
350
  abs_path = join_paths(root, rel_path);
351
- if (file_exists(abs_path)) includes.push_back({{ rel_path, root }, abs_path, ext == ".css" });
351
+ if (file_exists(abs_path)) includes.push_back({{ rel_path, root }, abs_path });
352
352
  }
353
353
  // nothing found
354
354
  return includes;
@@ -89,14 +89,9 @@ namespace Sass {
89
89
  public:
90
90
  // resolved absolute path
91
91
  std::string abs_path;
92
- // is a deprecated file type
93
- bool deprecated;
94
92
  public:
95
- Include(const Importer& imp, std::string abs_path, bool deprecated)
96
- : Importer(imp), abs_path(abs_path), deprecated(deprecated)
97
- { }
98
93
  Include(const Importer& imp, std::string abs_path)
99
- : Importer(imp), abs_path(abs_path), deprecated(false)
94
+ : Importer(imp), abs_path(abs_path)
100
95
  { }
101
96
  };
102
97
 
@@ -126,12 +121,11 @@ namespace Sass {
126
121
 
127
122
  namespace File {
128
123
 
129
- static std::vector<std::string> defaultExtensions = { ".scss", ".sass" };
124
+ static std::vector<std::string> defaultExtensions = { ".scss", ".sass", ".css" };
130
125
 
131
126
  std::vector<Include> resolve_includes(const std::string& root, const std::string& file,
132
127
  const std::vector<std::string>& exts = defaultExtensions);
133
128
 
134
-
135
129
  }
136
130
 
137
131
  }
@@ -467,7 +467,7 @@ namespace Sass {
467
467
  double s;
468
468
  double l = (max + min) / 2.0;
469
469
 
470
- if (NEAR_EQUAL(max, min)) {
470
+ if (max == min) {
471
471
  h = s = 0; // achromatic
472
472
  }
473
473
  else {
@@ -658,9 +658,6 @@ namespace Sass {
658
658
  }
659
659
 
660
660
  std::stringstream hexlet;
661
- // dart sass compressed all colors in regular css always
662
- // ruby sass and libsass does it only when not delayed
663
- // since color math is going to be removed, this can go too
664
661
  bool compressed = opt.output_style == COMPRESSED;
665
662
  hexlet << '#' << std::setw(1) << std::setfill('0');
666
663
  // create a short color hexlet if there is any need for it
@@ -684,6 +681,9 @@ namespace Sass {
684
681
  if (name != "") {
685
682
  ss << name;
686
683
  }
684
+ else if (r == 0 && g == 0 && b == 0 && a == 0) {
685
+ ss << "transparent";
686
+ }
687
687
  else if (a >= 1) {
688
688
  if (res_name != "") {
689
689
  if (compressed && hexlet.str().size() < res_name.size()) {
@@ -127,15 +127,15 @@ namespace Sass {
127
127
  double lval = lhs.value();
128
128
  double rval = rhs.value();
129
129
 
130
- if (op == Sass_OP::MOD && rval == 0) {
131
- return SASS_MEMORY_NEW(String_Quoted, pstate, "NaN");
132
- }
133
-
134
130
  if (op == Sass_OP::DIV && rval == 0) {
135
131
  std::string result(lval ? "Infinity" : "NaN");
136
132
  return SASS_MEMORY_NEW(String_Quoted, pstate, result);
137
133
  }
138
134
 
135
+ if (op == Sass_OP::MOD && rval == 0) {
136
+ throw Exception::ZeroDivisionError(lhs, rhs);
137
+ }
138
+
139
139
  size_t l_n_units = lhs.numerators.size();
140
140
  size_t l_d_units = lhs.numerators.size();
141
141
  size_t r_n_units = rhs.denominators.size();
@@ -1578,7 +1578,7 @@ namespace Sass {
1578
1578
  return nr;
1579
1579
  }
1580
1580
 
1581
- Value_Ptr Parser::lexed_hex_color(const ParserState& pstate, const std::string& parsed)
1581
+ Expression_Ptr Parser::lexed_hex_color(const ParserState& pstate, const std::string& parsed)
1582
1582
  {
1583
1583
  Color_Ptr color = NULL;
1584
1584
  if (parsed[0] != '#') {
@@ -1628,19 +1628,6 @@ namespace Sass {
1628
1628
  return color;
1629
1629
  }
1630
1630
 
1631
- Value_Ptr Parser::color_or_string(const std::string& lexed) const
1632
- {
1633
- if (auto color = name_to_color(lexed)) {
1634
- auto c = SASS_MEMORY_NEW(Color, color);
1635
- c->is_delayed(true);
1636
- c->pstate(pstate);
1637
- c->disp(lexed);
1638
- return c;
1639
- } else {
1640
- return SASS_MEMORY_NEW(String_Constant, pstate, lexed);
1641
- }
1642
- }
1643
-
1644
1631
  // parse one value for a list
1645
1632
  Expression_Obj Parser::parse_value()
1646
1633
  {
@@ -1683,7 +1670,7 @@ namespace Sass {
1683
1670
  { return SASS_MEMORY_NEW(Null, pstate); }
1684
1671
 
1685
1672
  if (lex< identifier >()) {
1686
- return color_or_string(lexed);
1673
+ return SASS_MEMORY_NEW(String_Constant, pstate, lexed);
1687
1674
  }
1688
1675
 
1689
1676
  if (lex< percentage >())
@@ -1854,7 +1841,7 @@ namespace Sass {
1854
1841
  return schema->length() > 0 ? schema.detach() : NULL;
1855
1842
  }
1856
1843
 
1857
- Value_Obj Parser::parse_static_value()
1844
+ String_Constant_Obj Parser::parse_static_value()
1858
1845
  {
1859
1846
  lex< static_value >();
1860
1847
  Token str(lexed);
@@ -1865,7 +1852,8 @@ namespace Sass {
1865
1852
  --str.end;
1866
1853
  --position;
1867
1854
 
1868
- return color_or_string(str.time_wspace());;
1855
+ String_Constant_Ptr str_node = SASS_MEMORY_NEW(String_Constant, pstate, str.time_wspace());
1856
+ return str_node;
1869
1857
  }
1870
1858
 
1871
1859
  String_Obj Parser::parse_string()
@@ -1974,7 +1962,7 @@ namespace Sass {
1974
1962
  if (lex< re_static_expression >()) {
1975
1963
  ex = SASS_MEMORY_NEW(String_Constant, pstate, lexed);
1976
1964
  } else {
1977
- ex = parse_list(true);
1965
+ ex = parse_list();
1978
1966
  }
1979
1967
  ex->is_interpolant(true);
1980
1968
  schema->append(ex);
@@ -1998,7 +1986,7 @@ namespace Sass {
1998
1986
  }
1999
1987
  if (peek < exactly < '-' > >()) break;
2000
1988
  }
2001
- else if (lex< identifier >()) {
1989
+ else if (lex< sequence < identifier > >()) {
2002
1990
  schema->append(SASS_MEMORY_NEW(String_Constant, pstate, lexed));
2003
1991
  if ((*position == '"' || *position == '\'') || peek < alternatives < alpha > >()) {
2004
1992
  // need_space = true;
@@ -2703,9 +2691,7 @@ namespace Sass {
2703
2691
  if ((rv = lex_interp_string())) return rv;
2704
2692
  if ((rv = lex_interp_uri())) return rv;
2705
2693
  if ((rv = lex_interpolation())) return rv;
2706
- if (lex< alternatives< hex, hex0 > >())
2707
- { return lexed_hex_color(lexed); }
2708
- return rv;
2694
+ return rv;
2709
2695
  }
2710
2696
 
2711
2697
  String_Schema_Obj Parser::parse_almost_any_value()
@@ -2791,7 +2777,6 @@ namespace Sass {
2791
2777
  >(p)
2792
2778
  ) {
2793
2779
  bool could_be_property = peek< sequence< exactly<'-'>, exactly<'-'> > >(p) != 0;
2794
- bool could_be_escaped = false;
2795
2780
  while (p < q) {
2796
2781
  // did we have interpolations?
2797
2782
  if (*p == '#' && *(p+1) == '{') {
@@ -2800,10 +2785,9 @@ namespace Sass {
2800
2785
  }
2801
2786
  // A property that's ambiguous with a nested selector is interpreted as a
2802
2787
  // custom property.
2803
- if (*p == ':' && !could_be_escaped) {
2788
+ if (*p == ':') {
2804
2789
  rv.is_custom_property = could_be_property || p+1 == q || peek< space >(p+1);
2805
2790
  }
2806
- could_be_escaped = *p == '\\';
2807
2791
  ++ p;
2808
2792
  }
2809
2793
  // store anyway }
@@ -290,7 +290,7 @@ namespace Sass {
290
290
  String_Obj parse_url_function_argument();
291
291
  String_Obj parse_interpolated_chunk(Token, bool constant = false, bool css = true);
292
292
  String_Obj parse_string();
293
- Value_Obj parse_static_value();
293
+ String_Constant_Obj parse_static_value();
294
294
  String_Schema_Obj parse_css_variable_value(bool top_level = true);
295
295
  String_Schema_Obj parse_css_variable_value_token(bool top_level = true);
296
296
  String_Obj parse_ie_property();
@@ -325,8 +325,6 @@ namespace Sass {
325
325
  Error_Obj parse_error();
326
326
  Debug_Obj parse_debug();
327
327
 
328
- Value_Ptr color_or_string(const std::string& lexed) const;
329
-
330
328
  // be more like ruby sass
331
329
  Expression_Obj lex_almost_any_value_token();
332
330
  Expression_Obj lex_almost_any_value_chars();
@@ -382,12 +380,12 @@ namespace Sass {
382
380
  static Number_Ptr lexed_number(const ParserState& pstate, const std::string& parsed);
383
381
  static Number_Ptr lexed_dimension(const ParserState& pstate, const std::string& parsed);
384
382
  static Number_Ptr lexed_percentage(const ParserState& pstate, const std::string& parsed);
385
- static Value_Ptr lexed_hex_color(const ParserState& pstate, const std::string& parsed);
383
+ static Expression_Ptr lexed_hex_color(const ParserState& pstate, const std::string& parsed);
386
384
  private:
387
385
  Number_Ptr lexed_number(const std::string& parsed) { return lexed_number(pstate, parsed); };
388
386
  Number_Ptr lexed_dimension(const std::string& parsed) { return lexed_dimension(pstate, parsed); };
389
387
  Number_Ptr lexed_percentage(const std::string& parsed) { return lexed_percentage(pstate, parsed); };
390
- Value_Ptr lexed_hex_color(const std::string& parsed) { return lexed_hex_color(pstate, parsed); };
388
+ Expression_Ptr lexed_hex_color(const std::string& parsed) { return lexed_hex_color(pstate, parsed); };
391
389
 
392
390
  static const char* re_attr_sensitive_close(const char* src);
393
391
  static const char* re_attr_insensitive_close(const char* src);
@@ -1606,7 +1606,7 @@ namespace Sass {
1606
1606
  >(src);
1607
1607
  }
1608
1608
 
1609
- extern const char css_variable_url_top_level_negates[] = "()[]{}\"'#/;";
1609
+ extern const char css_variable_url_top_level_negates[] = "()[]{}\"'#/;!";
1610
1610
  const char* css_variable_top_level_value(const char* src) {
1611
1611
  return sequence<
1612
1612
  alternatives<
@@ -33,10 +33,8 @@ extern "C" {
33
33
  void* ADDCALL sass_alloc_memory(size_t size)
34
34
  {
35
35
  void* ptr = malloc(size);
36
- if (ptr == NULL) {
37
- std::cerr << "Out of memory.\n";
38
- exit(EXIT_FAILURE);
39
- }
36
+ if (ptr == NULL)
37
+ out_of_memory();
40
38
  return ptr;
41
39
  }
42
40
 
@@ -74,14 +74,14 @@ namespace Sass {
74
74
  // move line_beg pointer to line start
75
75
  while (line_beg && *line_beg && lines != 0) {
76
76
  if (*line_beg == '\n') --lines;
77
- utf8::unchecked::next(line_beg);
77
+ utf8::unchecked::next(line_beg);
78
78
  }
79
79
  const char* line_end = line_beg;
80
80
  // move line_end before next newline character
81
81
  while (line_end && *line_end && *line_end != '\n') {
82
82
  if (*line_end == '\n') break;
83
83
  if (*line_end == '\r') break;
84
- utf8::unchecked::next(line_end);
84
+ utf8::unchecked::next(line_end);
85
85
  }
86
86
  if (line_end && *line_end != 0) ++ line_end;
87
87
  size_t line_len = line_end - line_beg;
@@ -524,7 +524,6 @@ extern "C" {
524
524
  options->c_headers = 0;
525
525
  options->plugin_paths = 0;
526
526
  options->include_paths = 0;
527
- options->extensions = 0;
528
527
  }
529
528
 
530
529
  // helper function, not exported, only accessible locally
@@ -559,18 +558,6 @@ extern "C" {
559
558
  cur = next;
560
559
  }
561
560
  }
562
- // Deallocate extension
563
- if (options->extensions) {
564
- struct string_list* cur;
565
- struct string_list* next;
566
- cur = options->extensions;
567
- while (cur) {
568
- next = cur->next;
569
- free(cur->string);
570
- free(cur);
571
- cur = next;
572
- }
573
- }
574
561
  // Free options strings
575
562
  free(options->input_path);
576
563
  free(options->output_path);
@@ -590,7 +577,6 @@ extern "C" {
590
577
  options->c_headers = 0;
591
578
  options->plugin_paths = 0;
592
579
  options->include_paths = 0;
593
- options->extensions = 0;
594
580
  }
595
581
 
596
582
  // helper function, not exported, only accessible locally
@@ -727,22 +713,6 @@ extern "C" {
727
713
  IMPLEMENT_SASS_CONTEXT_TAKER(char*, source_map_string);
728
714
  IMPLEMENT_SASS_CONTEXT_TAKER(char**, included_files);
729
715
 
730
- // Push function for import extenions
731
- void ADDCALL sass_option_push_import_extension(struct Sass_Options* options, const char* ext)
732
- {
733
- struct string_list* extension = (struct string_list*) calloc(1, sizeof(struct string_list));
734
- if (extension == 0) return;
735
- extension->string = ext ? sass_copy_c_string(ext) : 0;
736
- struct string_list* last = options->extensions;
737
- if (!options->extensions) {
738
- options->extensions = extension;
739
- } else {
740
- while (last->next)
741
- last = last->next;
742
- last->next = extension;
743
- }
744
- }
745
-
746
716
  // Push function for include paths (no manipulation support for now)
747
717
  void ADDCALL sass_option_push_include_path(struct Sass_Options* options, const char* path)
748
718
  {
@@ -40,12 +40,9 @@ struct Sass_Options : Sass_Output_Options {
40
40
  // Colon-separated list of paths
41
41
  // Semicolon-separated on Windows
42
42
  // Maybe use array interface instead?
43
- char* extension;
44
43
  char* include_path;
45
44
  char* plugin_path;
46
45
 
47
- // Extensions (linked string list)
48
- struct string_list* extensions;
49
46
  // Include paths (linked string list)
50
47
  struct string_list* include_paths;
51
48
  // Plugin paths (linked string list)
@@ -129,4 +126,4 @@ struct Sass_Compiler {
129
126
  Sass::Block_Obj root;
130
127
  };
131
128
 
132
- #endif
129
+ #endif
@@ -12,6 +12,11 @@
12
12
 
13
13
  namespace Sass {
14
14
 
15
+ #define out_of_memory() do { \
16
+ std::cerr << "Out of memory.\n"; \
17
+ exit(EXIT_FAILURE); \
18
+ } while (0)
19
+
15
20
  double round(double val, size_t precision = 0);
16
21
  double sass_strtod(const char* str);
17
22
  const char* safe_str(const char *, const char* = "");
@@ -1,3 +1,3 @@
1
1
  module SassC
2
- VERSION = "1.12.0"
2
+ VERSION = "1.12.1"
3
3
  end
@@ -267,5 +267,16 @@ CSS
267
267
  output = Engine.new(input).render
268
268
  assert_equal input.encoding, output.encoding
269
269
  end
270
+
271
+ def test_import_plain_css
272
+ temp_file("test.css", ".something{color: red}")
273
+ expected_output = <<-CSS
274
+ .something {
275
+ color: red; }
276
+ CSS
277
+
278
+ output = Engine.new("@import 'test'").render
279
+ assert_equal expected_output, output
280
+ end
270
281
  end
271
282
  end
@@ -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.5.4", Native.version
12
+ assert_equal "3.5.2", Native.version
13
13
  end
14
14
  end
15
15
 
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.12.0
4
+ version: 1.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Boland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-02 00:00:00.000000000 Z
11
+ date: 2018-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake