sassc 1.8.0 → 1.8.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
  SHA1:
3
- metadata.gz: f13097a5a3ad307a313cbe5e042460b96cc56d02
4
- data.tar.gz: 5ebc6f97d3066bfecd7c8334a2e1b1b6d51e90d0
3
+ metadata.gz: 91b3f5152e03b21d9b101c9ee37e998565a900fe
4
+ data.tar.gz: a872b4b0599925f217186897efa68c68e536837c
5
5
  SHA512:
6
- metadata.gz: de32bd0766e935adce472e86769b7a8c71aae7e5ed81af6a810d8cd3dcbc08df44b2e4db4e8bca01e45a179a4f203f0c0fa7622e5dab307d36e1fcd21606a130
7
- data.tar.gz: fbc161e22ee1159e5b118687199bc6289b0b8eb1e981e807eb576e4ce1d571cf4f39751d6cb3be0cc02652272e192c87434ac21f19f7cd515b37b9b89b379f1b
6
+ metadata.gz: f81496b861e719e6aad4efb4fa392ced9503967a155e405680d278b5d10c8add33f1a4bcc2bd97d3bbce847d447ce9171e9c6762776ec0fd0d6ac217d64a6ec7
7
+ data.tar.gz: c3093d1aae7a2f0ffd6c192d5e6d198f75be5e2a6d8b9d094e33bd167b23ccbc6346858dd922bf4a17620cb890cf4ac7e246c660eea82fb8daaa79581717f22c
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.3.0](https://github.com/sass/libsass/releases/tag/3.3.0)
9
+ [3.3.1](https://github.com/sass/libsass/releases/tag/3.3.1)
10
10
 
11
11
  ## Usage
12
12
 
@@ -25,6 +25,8 @@ and [awesome contributors](https://github.com/bolandrm/sassc-ruby/graphs/contrib
25
25
 
26
26
  ## Changelog
27
27
 
28
+ - **1.8.1**
29
+ - Update to Libsass 3.3.1
28
30
  - **1.8.0**
29
31
  - Update to Libsass 3.3.0
30
32
  - **1.8.0.pre2**
@@ -1,3 +1,9 @@
1
+ /**
2
+ * sass2scss
3
+ * Licensed under the MIT License
4
+ * Copyright (c) Marcel Greter
5
+ */
6
+
1
7
  #ifndef SASS2SCSS_H
2
8
  #define SASS2SCSS_H
3
9
 
@@ -29,11 +35,11 @@
29
35
  #include <iostream>
30
36
 
31
37
  #ifndef SASS2SCSS_VERSION
32
- #define SASS2SCSS_VERSION "1.0.3"
38
+ // Hardcode once the file is copied from
39
+ // https://github.com/mgreter/sass2scss
40
+ #define SASS2SCSS_VERSION "1.0.5"
33
41
  #endif
34
42
 
35
- // using std::string
36
-
37
43
  // add namespace for c++
38
44
  namespace Sass
39
45
  {
@@ -111,4 +117,4 @@ extern "C" {
111
117
  } // __cplusplus defined.
112
118
  #endif
113
119
 
114
- #endif
120
+ #endif
@@ -125,7 +125,7 @@ namespace Sass {
125
125
  // maybe we have another list as argument
126
126
  List* ls = dynamic_cast<List*>(a->value());
127
127
  // skip any list completely if empty
128
- if (ls && ls->empty()) continue;
128
+ if (ls && ls->empty() && a->is_rest_argument()) continue;
129
129
  // flatten all nested arglists
130
130
  if (ls && ls->is_arglist()) {
131
131
  for (size_t i = 0, L = ls->size(); i < L; ++i) {
@@ -127,7 +127,6 @@ namespace Sass {
127
127
  extern const char hyphen[] = "-";
128
128
  extern const char ellipsis[] = "...";
129
129
  // extern const char url_space_chars[] = " \t\r\n\f";
130
- extern const char escape_chars[] = " -~"; // need to include unicode spaces too
131
130
  // type names
132
131
  extern const char numeric_name[] = "numeric value";
133
132
  extern const char number_name[] = "number";
@@ -129,7 +129,6 @@ namespace Sass {
129
129
  extern const char hyphen[];
130
130
  extern const char ellipsis[];
131
131
  // extern const char url_space_chars[];
132
- extern const char escape_chars[];
133
132
 
134
133
  // type names
135
134
  extern const char numeric_name[];
@@ -1325,6 +1325,12 @@ namespace Sass {
1325
1325
  if (ltype == Expression::NULL_VAL) error("Invalid null operation: \"null plus "+quote(unquote(rstr), '"')+"\".", lhs.pstate());
1326
1326
  if (rtype == Expression::NULL_VAL) error("Invalid null operation: \""+quote(unquote(lstr), '"')+" plus null\".", rhs.pstate());
1327
1327
 
1328
+ if (ltype == Expression::NUMBER && sep == "/" && rtype == Expression::STRING)
1329
+ {
1330
+ return SASS_MEMORY_NEW(mem, String_Constant, lhs.pstate(),
1331
+ lhs.to_string() + sep + rhs.to_string());
1332
+ }
1333
+
1328
1334
  if ( (ltype == Expression::STRING || sep == "") &&
1329
1335
  (sep != "/" || !rqstr || !rqstr->quote_mark())
1330
1336
  ) {
@@ -1439,7 +1445,8 @@ namespace Sass {
1439
1445
  {
1440
1446
  To_String to_string;
1441
1447
  // the parser will look for a brace to end the selector
1442
- std::string result_str(s->contents()->perform(this)->perform(&to_string) + "{");
1448
+ std::string result_str(s->contents()->perform(this)->perform(&to_string));
1449
+ result_str = unquote(Util::rtrim(result_str)) + "{";
1443
1450
  Parser p = Parser::from_c_str(result_str.c_str(), ctx, s->pstate());
1444
1451
  return operator()(p.parse_selector_list(exp.block_stack.back()->is_root()));
1445
1452
  }
@@ -1588,17 +1588,17 @@ namespace Sass {
1588
1588
  List* arglist = SASS_MEMORY_NEW(ctx.mem, List, *ARG("$args", List));
1589
1589
 
1590
1590
  Arguments* args = SASS_MEMORY_NEW(ctx.mem, Arguments, pstate);
1591
- std::string full_name(name + "[f]");
1592
- Definition* def = d_env.has(full_name) ? static_cast<Definition*>((d_env)[full_name]) : 0;
1593
- Parameters* params = def ? def->parameters() : 0;
1594
- size_t param_size = params ? params->length() : 0;
1591
+ // std::string full_name(name + "[f]");
1592
+ // Definition* def = d_env.has(full_name) ? static_cast<Definition*>((d_env)[full_name]) : 0;
1593
+ // Parameters* params = def ? def->parameters() : 0;
1594
+ // size_t param_size = params ? params->length() : 0;
1595
1595
  for (size_t i = 0, L = arglist->length(); i < L; ++i) {
1596
1596
  Expression* expr = arglist->value_at_index(i);
1597
- if (params && params->has_rest_parameter()) {
1598
- Parameter* p = param_size > i ? (*params)[i] : 0;
1599
- List* list = dynamic_cast<List*>(expr);
1600
- if (list && p && !p->is_rest_parameter()) expr = (*list)[0];
1601
- }
1597
+ // if (params && params->has_rest_parameter()) {
1598
+ // Parameter* p = param_size > i ? (*params)[i] : 0;
1599
+ // List* list = dynamic_cast<List*>(expr);
1600
+ // if (list && p && !p->is_rest_parameter()) expr = (*list)[0];
1601
+ // }
1602
1602
  if (arglist->is_arglist()) {
1603
1603
  Argument* arg = dynamic_cast<Argument*>((*arglist)[i]);
1604
1604
  *args << SASS_MEMORY_NEW(ctx.mem, Argument,
@@ -93,6 +93,13 @@ namespace Sass {
93
93
  return unsigned(chr) > 41 && unsigned(chr) < 127;
94
94
  }
95
95
 
96
+ // check if char is within a reduced ascii range
97
+ // valid for escaping (copied from Ruby Sass)
98
+ bool is_escapable_character(const char& chr)
99
+ {
100
+ return unsigned(chr) > 31 && unsigned(chr) < 127;
101
+ }
102
+
96
103
  // Match word character (look ahead)
97
104
  bool is_character(const char& chr)
98
105
  {
@@ -115,6 +122,7 @@ namespace Sass {
115
122
  const char* punct(const char* src) { return is_punct(*src) ? src + 1 : 0; }
116
123
  const char* character(const char* src) { return is_character(*src) ? src + 1 : 0; }
117
124
  const char* uri_character(const char* src) { return is_uri_character(*src) ? src + 1 : 0; }
125
+ const char* escapable_character(const char* src) { return is_escapable_character(*src) ? src + 1 : 0; }
118
126
 
119
127
  // Match multiple ctype characters.
120
128
  const char* spaces(const char* src) { return one_plus<space>(src); }
@@ -35,6 +35,7 @@ namespace Sass {
35
35
  bool is_nonascii(const char& src);
36
36
  bool is_character(const char& src);
37
37
  bool is_uri_character(const char& src);
38
+ bool escapable_character(const char& src);
38
39
 
39
40
  // Match a single ctype predicate.
40
41
  const char* space(const char* src);
@@ -47,6 +48,7 @@ namespace Sass {
47
48
  const char* nonascii(const char* src);
48
49
  const char* character(const char* src);
49
50
  const char* uri_character(const char* src);
51
+ const char* escapable_character(const char* src);
50
52
 
51
53
  // Match multiple ctype characters.
52
54
  const char* spaces(const char* src);
@@ -91,6 +91,8 @@ namespace Sass {
91
91
  unicode,
92
92
  exactly<'-'>,
93
93
  exactly<'_'>,
94
+ NONASCII,
95
+ ESCAPE,
94
96
  escape_seq
95
97
  >(src);
96
98
  }
@@ -104,6 +106,8 @@ namespace Sass {
104
106
  unicode,
105
107
  exactly<'-'>,
106
108
  exactly<'_'>,
109
+ NONASCII,
110
+ ESCAPE,
107
111
  escape_seq
108
112
  >(src);
109
113
  }
@@ -944,8 +948,10 @@ namespace Sass {
944
948
  UUNICODE,
945
949
  sequence<
946
950
  exactly<'\\'>,
947
- NONASCII,
948
- class_char< escape_chars >
951
+ alternatives<
952
+ NONASCII,
953
+ escapable_character
954
+ >
949
955
  >
950
956
  >(src);
951
957
  }
@@ -1,3 +1,9 @@
1
+ /**
2
+ * sass2scss
3
+ * Licensed under the MIT License
4
+ * Copyright (c) Marcel Greter
5
+ */
6
+
1
7
  #ifdef _MSC_VER
2
8
  #define _CRT_SECURE_NO_WARNINGS
3
9
  #define _CRT_NONSTDC_NO_DEPRECATE
@@ -26,8 +32,6 @@
26
32
  // our own header
27
33
  #include "sass2scss.h"
28
34
 
29
- // using std::string
30
-
31
35
  // add namespace for c++
32
36
  namespace Sass
33
37
  {
@@ -609,15 +613,16 @@ namespace Sass
609
613
  sass.substr(pos_left, 8) != "@content"
610
614
  ) {
611
615
 
612
- // try to find a colon in the current line, but only ...
613
- size_t pos_colon = sass.find_first_not_of(":", pos_left);
614
- // assertion for valid result
616
+ // probably a selector anyway
617
+ converter.selector = true;
618
+ // try to find first colon in the current line
619
+ size_t pos_colon = sass.find_first_of(":", pos_left);
620
+ // assertion that we have a colon
615
621
  if (pos_colon != std::string::npos)
616
622
  {
617
- // ... after the first word (skip begining colons)
618
- pos_colon = sass.find_first_of(":", pos_colon);
619
- // it is a selector if there was no colon found
620
- converter.selector = pos_colon == std::string::npos;
623
+ // it is not a selector if we have a space after a colon
624
+ if (sass[pos_colon+1] == ' ') converter.selector = false;
625
+ if (sass[pos_colon+1] == ' ') converter.selector = false;
621
626
  }
622
627
 
623
628
  }
@@ -1,3 +1,3 @@
1
1
  module SassC
2
- VERSION = "1.8.0"
2
+ VERSION = "1.8.1"
3
3
  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.3.0", Native.version
12
+ assert_equal "3.3.1", 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.8.0
4
+ version: 1.8.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: 2015-10-26 00:00:00.000000000 Z
11
+ date: 2015-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake