sassc 1.8.3 → 1.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/ext/libsass/.editorconfig +1 -1
- data/ext/libsass/.gitignore +1 -0
- data/ext/libsass/LICENSE +1 -1
- data/ext/libsass/Makefile +20 -14
- data/ext/libsass/Makefile.conf +0 -1
- data/ext/libsass/Readme.md +3 -1
- data/ext/libsass/appveyor.yml +19 -11
- data/ext/libsass/docs/api-importer-example.md +2 -1235
- data/ext/libsass/docs/build-with-autotools.md +10 -0
- data/ext/libsass/docs/build-with-makefiles.md +18 -0
- data/ext/libsass/include/sass/base.h +4 -1
- data/ext/libsass/include/sass/values.h +2 -1
- data/ext/libsass/src/ast.cpp +279 -346
- data/ext/libsass/src/ast.hpp +234 -60
- data/ext/libsass/src/base64vlq.cpp +1 -0
- data/ext/libsass/src/bind.cpp +35 -45
- data/ext/libsass/src/bind.hpp +1 -0
- data/ext/libsass/src/color_maps.cpp +1 -0
- data/ext/libsass/src/constants.cpp +4 -1
- data/ext/libsass/src/constants.hpp +2 -1
- data/ext/libsass/src/context.cpp +41 -31
- data/ext/libsass/src/context.hpp +10 -10
- data/ext/libsass/src/cssize.cpp +7 -4
- data/ext/libsass/src/cssize.hpp +1 -3
- data/ext/libsass/src/debugger.hpp +73 -14
- data/ext/libsass/src/emitter.cpp +37 -25
- data/ext/libsass/src/emitter.hpp +10 -9
- data/ext/libsass/src/environment.cpp +16 -5
- data/ext/libsass/src/environment.hpp +5 -3
- data/ext/libsass/src/error_handling.cpp +91 -14
- data/ext/libsass/src/error_handling.hpp +105 -4
- data/ext/libsass/src/eval.cpp +519 -330
- data/ext/libsass/src/eval.hpp +12 -13
- data/ext/libsass/src/expand.cpp +92 -56
- data/ext/libsass/src/expand.hpp +5 -3
- data/ext/libsass/src/extend.cpp +60 -51
- data/ext/libsass/src/extend.hpp +1 -3
- data/ext/libsass/src/file.cpp +37 -27
- data/ext/libsass/src/functions.cpp +78 -62
- data/ext/libsass/src/functions.hpp +1 -0
- data/ext/libsass/src/inspect.cpp +293 -64
- data/ext/libsass/src/inspect.hpp +2 -0
- data/ext/libsass/src/lexer.cpp +1 -0
- data/ext/libsass/src/listize.cpp +14 -15
- data/ext/libsass/src/listize.hpp +3 -5
- data/ext/libsass/src/memory_manager.cpp +1 -0
- data/ext/libsass/src/node.cpp +2 -3
- data/ext/libsass/src/operation.hpp +70 -71
- data/ext/libsass/src/output.cpp +28 -32
- data/ext/libsass/src/output.hpp +1 -2
- data/ext/libsass/src/parser.cpp +402 -183
- data/ext/libsass/src/parser.hpp +19 -9
- data/ext/libsass/src/plugins.cpp +1 -0
- data/ext/libsass/src/position.cpp +1 -0
- data/ext/libsass/src/prelexer.cpp +134 -56
- data/ext/libsass/src/prelexer.hpp +51 -3
- data/ext/libsass/src/remove_placeholders.cpp +35 -9
- data/ext/libsass/src/remove_placeholders.hpp +4 -3
- data/ext/libsass/src/sass.cpp +1 -0
- data/ext/libsass/src/sass.hpp +129 -0
- data/ext/libsass/src/sass_context.cpp +31 -14
- data/ext/libsass/src/sass_context.hpp +2 -31
- data/ext/libsass/src/sass_functions.cpp +1 -0
- data/ext/libsass/src/sass_interface.cpp +5 -6
- data/ext/libsass/src/sass_util.cpp +1 -2
- data/ext/libsass/src/sass_util.hpp +5 -5
- data/ext/libsass/src/sass_values.cpp +13 -10
- data/ext/libsass/src/source_map.cpp +4 -3
- data/ext/libsass/src/source_map.hpp +2 -2
- data/ext/libsass/src/subset_map.hpp +0 -1
- data/ext/libsass/src/to_c.cpp +1 -0
- data/ext/libsass/src/to_c.hpp +1 -3
- data/ext/libsass/src/to_value.cpp +3 -5
- data/ext/libsass/src/to_value.hpp +1 -1
- data/ext/libsass/src/units.cpp +96 -59
- data/ext/libsass/src/units.hpp +10 -8
- data/ext/libsass/src/utf8_string.cpp +5 -0
- data/ext/libsass/src/util.cpp +23 -156
- data/ext/libsass/src/util.hpp +10 -14
- data/ext/libsass/src/values.cpp +1 -0
- data/ext/libsass/test/test_node.cpp +2 -6
- data/ext/libsass/test/test_selector_difference.cpp +1 -3
- data/ext/libsass/test/test_specificity.cpp +0 -2
- data/ext/libsass/test/test_superselector.cpp +0 -2
- data/ext/libsass/test/test_unification.cpp +1 -3
- data/ext/libsass/win/libsass.targets +18 -5
- data/ext/libsass/win/libsass.vcxproj +9 -7
- data/ext/libsass/win/libsass.vcxproj.filters +148 -106
- data/lib/sassc/version.rb +1 -1
- data/test/engine_test.rb +12 -0
- data/test/native_test.rb +1 -1
- metadata +3 -4
- data/ext/libsass/src/to_string.cpp +0 -48
- data/ext/libsass/src/to_string.hpp +0 -38
data/ext/libsass/src/inspect.hpp
CHANGED
@@ -64,6 +64,8 @@ namespace Sass {
|
|
64
64
|
virtual void operator()(String_Schema*);
|
65
65
|
virtual void operator()(String_Constant*);
|
66
66
|
virtual void operator()(String_Quoted*);
|
67
|
+
virtual void operator()(Custom_Error*);
|
68
|
+
virtual void operator()(Custom_Warning*);
|
67
69
|
virtual void operator()(Supports_Operator*);
|
68
70
|
virtual void operator()(Supports_Negation*);
|
69
71
|
virtual void operator()(Supports_Declaration*);
|
data/ext/libsass/src/lexer.cpp
CHANGED
data/ext/libsass/src/listize.cpp
CHANGED
@@ -1,43 +1,43 @@
|
|
1
|
+
#include "sass.hpp"
|
1
2
|
#include <iostream>
|
2
3
|
#include <typeinfo>
|
3
4
|
#include <string>
|
4
5
|
|
5
6
|
#include "listize.hpp"
|
6
|
-
#include "to_string.hpp"
|
7
7
|
#include "context.hpp"
|
8
8
|
#include "backtrace.hpp"
|
9
9
|
#include "error_handling.hpp"
|
10
10
|
|
11
11
|
namespace Sass {
|
12
12
|
|
13
|
-
Listize::Listize(
|
14
|
-
:
|
13
|
+
Listize::Listize(Memory_Manager& mem)
|
14
|
+
: mem(mem)
|
15
15
|
{ }
|
16
16
|
|
17
17
|
Expression* Listize::operator()(Selector_List* sel)
|
18
18
|
{
|
19
|
-
List* l = SASS_MEMORY_NEW(
|
19
|
+
List* l = SASS_MEMORY_NEW(mem, List, sel->pstate(), sel->length(), SASS_COMMA);
|
20
20
|
for (size_t i = 0, L = sel->length(); i < L; ++i) {
|
21
21
|
if (!(*sel)[i]) continue;
|
22
22
|
*l << (*sel)[i]->perform(this);
|
23
23
|
}
|
24
|
-
return l;
|
24
|
+
if (l->length()) return l;
|
25
|
+
return SASS_MEMORY_NEW(mem, Null, l->pstate());
|
25
26
|
}
|
26
27
|
|
27
28
|
Expression* Listize::operator()(Compound_Selector* sel)
|
28
29
|
{
|
29
|
-
To_String to_string;
|
30
30
|
std::string str;
|
31
31
|
for (size_t i = 0, L = sel->length(); i < L; ++i) {
|
32
32
|
Expression* e = (*sel)[i]->perform(this);
|
33
|
-
if (e) str += e->
|
33
|
+
if (e) str += e->to_string();
|
34
34
|
}
|
35
|
-
return SASS_MEMORY_NEW(
|
35
|
+
return SASS_MEMORY_NEW(mem, String_Quoted, sel->pstate(), str);
|
36
36
|
}
|
37
37
|
|
38
38
|
Expression* Listize::operator()(Complex_Selector* sel)
|
39
39
|
{
|
40
|
-
List* l = SASS_MEMORY_NEW(
|
40
|
+
List* l = SASS_MEMORY_NEW(mem, List, sel->pstate(), 2);
|
41
41
|
|
42
42
|
Compound_Selector* head = sel->head();
|
43
43
|
if (head && !head->is_empty_reference())
|
@@ -46,22 +46,21 @@ namespace Sass {
|
|
46
46
|
if (hh) *l << hh;
|
47
47
|
}
|
48
48
|
|
49
|
-
To_String to_string;
|
50
49
|
std::string reference = ! sel->reference() ? ""
|
51
|
-
: sel->reference()->
|
50
|
+
: sel->reference()->to_string();
|
52
51
|
switch(sel->combinator())
|
53
52
|
{
|
54
53
|
case Complex_Selector::PARENT_OF:
|
55
|
-
*l << SASS_MEMORY_NEW(
|
54
|
+
*l << SASS_MEMORY_NEW(mem, String_Quoted, sel->pstate(), ">");
|
56
55
|
break;
|
57
56
|
case Complex_Selector::ADJACENT_TO:
|
58
|
-
*l << SASS_MEMORY_NEW(
|
57
|
+
*l << SASS_MEMORY_NEW(mem, String_Quoted, sel->pstate(), "+");
|
59
58
|
break;
|
60
59
|
case Complex_Selector::REFERENCE:
|
61
|
-
*l << SASS_MEMORY_NEW(
|
60
|
+
*l << SASS_MEMORY_NEW(mem, String_Quoted, sel->pstate(), "/" + reference + "/");
|
62
61
|
break;
|
63
62
|
case Complex_Selector::PRECEDES:
|
64
|
-
*l << SASS_MEMORY_NEW(
|
63
|
+
*l << SASS_MEMORY_NEW(mem, String_Quoted, sel->pstate(), "~");
|
65
64
|
break;
|
66
65
|
case Complex_Selector::ANCESTOR_OF:
|
67
66
|
break;
|
data/ext/libsass/src/listize.hpp
CHANGED
@@ -16,15 +16,13 @@ namespace Sass {
|
|
16
16
|
|
17
17
|
class Listize : public Operation_CRTP<Expression*, Listize> {
|
18
18
|
|
19
|
-
|
19
|
+
Memory_Manager& mem;
|
20
20
|
|
21
21
|
Expression* fallback_impl(AST_Node* n);
|
22
22
|
|
23
23
|
public:
|
24
|
-
Listize(
|
25
|
-
|
26
|
-
|
27
|
-
using Operation<Expression*>::operator();
|
24
|
+
Listize(Memory_Manager&);
|
25
|
+
~Listize() { }
|
28
26
|
|
29
27
|
Expression* operator()(Selector_List*);
|
30
28
|
Expression* operator()(Complex_Selector*);
|
data/ext/libsass/src/node.cpp
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
+
#include "sass.hpp"
|
1
2
|
#include <vector>
|
2
3
|
|
3
4
|
#include "node.hpp"
|
4
|
-
#include "to_string.hpp"
|
5
5
|
#include "context.hpp"
|
6
6
|
#include "parser.hpp"
|
7
7
|
|
@@ -153,8 +153,7 @@ namespace Sass {
|
|
153
153
|
|
154
154
|
} else if (node.isSelector()){
|
155
155
|
|
156
|
-
|
157
|
-
os << node.selector()->head()->perform(&to_string);
|
156
|
+
os << node.selector()->head()->to_string();
|
158
157
|
|
159
158
|
} else if (node.isCollection()) {
|
160
159
|
|
@@ -15,7 +15,7 @@ namespace Sass {
|
|
15
15
|
virtual T operator()(Ruleset* x) = 0;
|
16
16
|
virtual T operator()(Propset* x) = 0;
|
17
17
|
virtual T operator()(Bubble* x) = 0;
|
18
|
-
virtual T operator()(Supports_Block* x)
|
18
|
+
virtual T operator()(Supports_Block* x) = 0;
|
19
19
|
virtual T operator()(Media_Block* x) = 0;
|
20
20
|
virtual T operator()(At_Root_Block* x) = 0;
|
21
21
|
virtual T operator()(At_Rule* x) = 0;
|
@@ -88,84 +88,83 @@ namespace Sass {
|
|
88
88
|
template <typename T, typename D>
|
89
89
|
class Operation_CRTP : public Operation<T> {
|
90
90
|
public:
|
91
|
-
|
92
|
-
|
91
|
+
D& impl() { return static_cast<D&>(*this); }
|
92
|
+
public:
|
93
|
+
T operator()(AST_Node* x) { return static_cast<D*>(this)->fallback(x); }
|
93
94
|
// statements
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
95
|
+
T operator()(Block* x) { return static_cast<D*>(this)->fallback(x); }
|
96
|
+
T operator()(Ruleset* x) { return static_cast<D*>(this)->fallback(x); }
|
97
|
+
T operator()(Propset* x) { return static_cast<D*>(this)->fallback(x); }
|
98
|
+
T operator()(Bubble* x) { return static_cast<D*>(this)->fallback(x); }
|
99
|
+
T operator()(Supports_Block* x) { return static_cast<D*>(this)->fallback(x); }
|
100
|
+
T operator()(Media_Block* x) { return static_cast<D*>(this)->fallback(x); }
|
101
|
+
T operator()(At_Root_Block* x) { return static_cast<D*>(this)->fallback(x); }
|
102
|
+
T operator()(At_Rule* x) { return static_cast<D*>(this)->fallback(x); }
|
103
|
+
T operator()(Keyframe_Rule* x) { return static_cast<D*>(this)->fallback(x); }
|
104
|
+
T operator()(Declaration* x) { return static_cast<D*>(this)->fallback(x); }
|
105
|
+
T operator()(Assignment* x) { return static_cast<D*>(this)->fallback(x); }
|
106
|
+
T operator()(Import* x) { return static_cast<D*>(this)->fallback(x); }
|
107
|
+
T operator()(Import_Stub* x) { return static_cast<D*>(this)->fallback(x); }
|
108
|
+
T operator()(Warning* x) { return static_cast<D*>(this)->fallback(x); }
|
109
|
+
T operator()(Error* x) { return static_cast<D*>(this)->fallback(x); }
|
110
|
+
T operator()(Debug* x) { return static_cast<D*>(this)->fallback(x); }
|
111
|
+
T operator()(Comment* x) { return static_cast<D*>(this)->fallback(x); }
|
112
|
+
T operator()(If* x) { return static_cast<D*>(this)->fallback(x); }
|
113
|
+
T operator()(For* x) { return static_cast<D*>(this)->fallback(x); }
|
114
|
+
T operator()(Each* x) { return static_cast<D*>(this)->fallback(x); }
|
115
|
+
T operator()(While* x) { return static_cast<D*>(this)->fallback(x); }
|
116
|
+
T operator()(Return* x) { return static_cast<D*>(this)->fallback(x); }
|
117
|
+
T operator()(Content* x) { return static_cast<D*>(this)->fallback(x); }
|
118
|
+
T operator()(Extension* x) { return static_cast<D*>(this)->fallback(x); }
|
119
|
+
T operator()(Definition* x) { return static_cast<D*>(this)->fallback(x); }
|
120
|
+
T operator()(Mixin_Call* x) { return static_cast<D*>(this)->fallback(x); }
|
120
121
|
// expressions
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
122
|
+
T operator()(List* x) { return static_cast<D*>(this)->fallback(x); }
|
123
|
+
T operator()(Map* x) { return static_cast<D*>(this)->fallback(x); }
|
124
|
+
T operator()(Binary_Expression* x) { return static_cast<D*>(this)->fallback(x); }
|
125
|
+
T operator()(Unary_Expression* x) { return static_cast<D*>(this)->fallback(x); }
|
126
|
+
T operator()(Function_Call* x) { return static_cast<D*>(this)->fallback(x); }
|
127
|
+
T operator()(Function_Call_Schema* x) { return static_cast<D*>(this)->fallback(x); }
|
128
|
+
T operator()(Custom_Warning* x) { return static_cast<D*>(this)->fallback(x); }
|
129
|
+
T operator()(Custom_Error* x) { return static_cast<D*>(this)->fallback(x); }
|
130
|
+
T operator()(Variable* x) { return static_cast<D*>(this)->fallback(x); }
|
131
|
+
T operator()(Textual* x) { return static_cast<D*>(this)->fallback(x); }
|
132
|
+
T operator()(Number* x) { return static_cast<D*>(this)->fallback(x); }
|
133
|
+
T operator()(Color* x) { return static_cast<D*>(this)->fallback(x); }
|
134
|
+
T operator()(Boolean* x) { return static_cast<D*>(this)->fallback(x); }
|
135
|
+
T operator()(String_Schema* x) { return static_cast<D*>(this)->fallback(x); }
|
136
|
+
T operator()(String_Constant* x) { return static_cast<D*>(this)->fallback(x); }
|
137
|
+
T operator()(String_Quoted* x) { return static_cast<D*>(this)->fallback(x); }
|
138
|
+
T operator()(Supports_Condition* x) { return static_cast<D*>(this)->fallback(x); }
|
139
|
+
T operator()(Supports_Operator* x) { return static_cast<D*>(this)->fallback(x); }
|
140
|
+
T operator()(Supports_Negation* x) { return static_cast<D*>(this)->fallback(x); }
|
141
|
+
T operator()(Supports_Declaration* x) { return static_cast<D*>(this)->fallback(x); }
|
142
|
+
T operator()(Supports_Interpolation* x) { return static_cast<D*>(this)->fallback(x); }
|
143
|
+
T operator()(Media_Query* x) { return static_cast<D*>(this)->fallback(x); }
|
144
|
+
T operator()(Media_Query_Expression* x) { return static_cast<D*>(this)->fallback(x); }
|
145
|
+
T operator()(At_Root_Expression* x) { return static_cast<D*>(this)->fallback(x); }
|
146
|
+
T operator()(Null* x) { return static_cast<D*>(this)->fallback(x); }
|
147
|
+
T operator()(Parent_Selector* x) { return static_cast<D*>(this)->fallback(x); }
|
147
148
|
// parameters and arguments
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
149
|
+
T operator()(Parameter* x) { return static_cast<D*>(this)->fallback(x); }
|
150
|
+
T operator()(Parameters* x) { return static_cast<D*>(this)->fallback(x); }
|
151
|
+
T operator()(Argument* x) { return static_cast<D*>(this)->fallback(x); }
|
152
|
+
T operator()(Arguments* x) { return static_cast<D*>(this)->fallback(x); }
|
152
153
|
// selectors
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
154
|
+
T operator()(Selector_Schema* x) { return static_cast<D*>(this)->fallback(x); }
|
155
|
+
T operator()(Selector_Placeholder* x) { return static_cast<D*>(this)->fallback(x); }
|
156
|
+
T operator()(Type_Selector* x) { return static_cast<D*>(this)->fallback(x); }
|
157
|
+
T operator()(Selector_Qualifier* x) { return static_cast<D*>(this)->fallback(x); }
|
158
|
+
T operator()(Attribute_Selector* x) { return static_cast<D*>(this)->fallback(x); }
|
159
|
+
T operator()(Pseudo_Selector* x) { return static_cast<D*>(this)->fallback(x); }
|
160
|
+
T operator()(Wrapped_Selector* x) { return static_cast<D*>(this)->fallback(x); }
|
161
|
+
T operator()(Compound_Selector* x) { return static_cast<D*>(this)->fallback(x); }
|
162
|
+
T operator()(Complex_Selector* x) { return static_cast<D*>(this)->fallback(x); }
|
163
|
+
T operator()(Selector_List* x) { return static_cast<D*>(this)->fallback(x); }
|
163
164
|
|
164
165
|
template <typename U>
|
165
166
|
T fallback(U x) { return T(); }
|
166
167
|
};
|
167
|
-
template<typename T, typename D>
|
168
|
-
inline Operation_CRTP<T, D>::~Operation_CRTP() { }
|
169
168
|
|
170
169
|
}
|
171
170
|
|
data/ext/libsass/src/output.cpp
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
+
#include "sass.hpp"
|
1
2
|
#include "ast.hpp"
|
2
3
|
#include "output.hpp"
|
3
|
-
#include "to_string.hpp"
|
4
4
|
|
5
5
|
namespace Sass {
|
6
6
|
|
7
|
-
Output::Output(
|
8
|
-
: Inspect(Emitter(
|
7
|
+
Output::Output(Sass_Output_Options& opt)
|
8
|
+
: Inspect(Emitter(opt)),
|
9
9
|
charset(""),
|
10
10
|
top_nodes(0)
|
11
11
|
{}
|
@@ -20,16 +20,11 @@ namespace Sass {
|
|
20
20
|
void Output::operator()(Number* n)
|
21
21
|
{
|
22
22
|
// use values to_string facility
|
23
|
-
|
24
|
-
std::string res = n->perform(&to_string);
|
23
|
+
std::string res = n->to_string(opt);
|
25
24
|
// check for a valid unit here
|
26
25
|
// includes result for reporting
|
27
|
-
if (n->
|
28
|
-
|
29
|
-
(n->numerator_units().size() && n->numerator_units()[0].find_first_of('/') != std::string::npos) ||
|
30
|
-
(n->numerator_units().size() && n->numerator_units()[0].find_first_of('*') != std::string::npos)
|
31
|
-
) {
|
32
|
-
error(res + " isn't a valid CSS value.", n->pstate());
|
26
|
+
if (!n->is_valid_css_unit()) {
|
27
|
+
throw Exception::InvalidValue(*n);
|
33
28
|
}
|
34
29
|
// output the final token
|
35
30
|
append_token(res, n);
|
@@ -42,15 +37,14 @@ namespace Sass {
|
|
42
37
|
|
43
38
|
void Output::operator()(Map* m)
|
44
39
|
{
|
45
|
-
|
46
|
-
std::string dbg(m->perform(&to_string));
|
40
|
+
std::string dbg(m->to_string(opt));
|
47
41
|
error(dbg + " isn't a valid CSS value.", m->pstate());
|
48
42
|
}
|
49
43
|
|
50
44
|
OutputBuffer Output::get_buffer(void)
|
51
45
|
{
|
52
46
|
|
53
|
-
Emitter emitter(
|
47
|
+
Emitter emitter(opt);
|
54
48
|
Inspect inspect(emitter);
|
55
49
|
|
56
50
|
size_t size_nodes = top_nodes.size();
|
@@ -60,13 +54,14 @@ namespace Sass {
|
|
60
54
|
}
|
61
55
|
|
62
56
|
// flush scheduled outputs
|
63
|
-
|
57
|
+
// maybe omit semicolon if possible
|
58
|
+
inspect.finalize(wbuf.buffer.size() == 0);
|
64
59
|
// prepend buffer on top
|
65
60
|
prepend_output(inspect.output());
|
66
61
|
// make sure we end with a linefeed
|
67
|
-
if (!ends_with(wbuf.buffer,
|
62
|
+
if (!ends_with(wbuf.buffer, opt.linefeed)) {
|
68
63
|
// if the output is not completely empty
|
69
|
-
if (!wbuf.buffer.empty()) append_string(
|
64
|
+
if (!wbuf.buffer.empty()) append_string(opt.linefeed);
|
70
65
|
}
|
71
66
|
|
72
67
|
// search for unicode char
|
@@ -74,9 +69,9 @@ namespace Sass {
|
|
74
69
|
// skip all ascii chars
|
75
70
|
if (chr >= 0) continue;
|
76
71
|
// declare the charset
|
77
|
-
if (output_style() !=
|
72
|
+
if (output_style() != COMPRESSED)
|
78
73
|
charset = "@charset \"UTF-8\";"
|
79
|
-
|
74
|
+
+ std::string(opt.linefeed);
|
80
75
|
else charset = "\xEF\xBB\xBF";
|
81
76
|
// abort search
|
82
77
|
break;
|
@@ -91,11 +86,10 @@ namespace Sass {
|
|
91
86
|
|
92
87
|
void Output::operator()(Comment* c)
|
93
88
|
{
|
94
|
-
|
95
|
-
std::string txt = c->text()->perform(&to_string);
|
89
|
+
std::string txt = c->text()->to_string(opt);
|
96
90
|
// if (indentation && txt == "/**/") return;
|
97
91
|
bool important = c->is_important();
|
98
|
-
if (output_style() !=
|
92
|
+
if (output_style() != COMPRESSED || important) {
|
99
93
|
if (buffer().size() == 0) {
|
100
94
|
top_nodes.push_back(c);
|
101
95
|
} else {
|
@@ -131,8 +125,8 @@ namespace Sass {
|
|
131
125
|
|
132
126
|
if (b->has_non_hoistable()) {
|
133
127
|
decls = true;
|
134
|
-
if (output_style() ==
|
135
|
-
if (
|
128
|
+
if (output_style() == NESTED) indentation += r->tabs();
|
129
|
+
if (opt.source_comments) {
|
136
130
|
std::stringstream ss;
|
137
131
|
append_indentation();
|
138
132
|
ss << "/* line " << r->pstate().line + 1 << ", " << r->pstate().path << " */";
|
@@ -171,7 +165,7 @@ namespace Sass {
|
|
171
165
|
stm->perform(this);
|
172
166
|
}
|
173
167
|
}
|
174
|
-
if (output_style() ==
|
168
|
+
if (output_style() == NESTED) indentation -= r->tabs();
|
175
169
|
append_scope_closer(b);
|
176
170
|
}
|
177
171
|
|
@@ -238,7 +232,7 @@ namespace Sass {
|
|
238
232
|
return;
|
239
233
|
}
|
240
234
|
|
241
|
-
if (output_style() ==
|
235
|
+
if (output_style() == NESTED) indentation += f->tabs();
|
242
236
|
append_indentation();
|
243
237
|
append_token("@supports", f);
|
244
238
|
append_mandatory_space();
|
@@ -274,7 +268,7 @@ namespace Sass {
|
|
274
268
|
}
|
275
269
|
}
|
276
270
|
|
277
|
-
if (output_style() ==
|
271
|
+
if (output_style() == NESTED) indentation -= f->tabs();
|
278
272
|
|
279
273
|
append_scope_closer();
|
280
274
|
|
@@ -297,7 +291,7 @@ namespace Sass {
|
|
297
291
|
}
|
298
292
|
return;
|
299
293
|
}
|
300
|
-
if (output_style() ==
|
294
|
+
if (output_style() == NESTED) indentation += m->tabs();
|
301
295
|
append_indentation();
|
302
296
|
append_token("@media", m);
|
303
297
|
append_mandatory_space();
|
@@ -311,7 +305,7 @@ namespace Sass {
|
|
311
305
|
if (i < L - 1) append_special_linefeed();
|
312
306
|
}
|
313
307
|
|
314
|
-
if (output_style() ==
|
308
|
+
if (output_style() == NESTED) indentation -= m->tabs();
|
315
309
|
append_scope_closer();
|
316
310
|
}
|
317
311
|
|
@@ -332,7 +326,8 @@ namespace Sass {
|
|
332
326
|
}
|
333
327
|
if (v) {
|
334
328
|
append_mandatory_space();
|
335
|
-
|
329
|
+
// ruby sass bug? should use options?
|
330
|
+
append_token(v->to_string(/* opt */), v);
|
336
331
|
}
|
337
332
|
if (!b) {
|
338
333
|
append_delimiter();
|
@@ -340,7 +335,8 @@ namespace Sass {
|
|
340
335
|
}
|
341
336
|
|
342
337
|
if (b->is_invisible() || b->length() == 0) {
|
343
|
-
|
338
|
+
append_optional_space();
|
339
|
+
return append_string("{}");
|
344
340
|
}
|
345
341
|
|
346
342
|
append_scope_opener();
|
@@ -380,7 +376,7 @@ namespace Sass {
|
|
380
376
|
void Output::operator()(String_Constant* s)
|
381
377
|
{
|
382
378
|
std::string value(s->value());
|
383
|
-
if (s->can_compress_whitespace() && output_style() ==
|
379
|
+
if (s->can_compress_whitespace() && output_style() == COMPRESSED) {
|
384
380
|
value.erase(std::remove_if(value.begin(), value.end(), ::isspace), value.end());
|
385
381
|
}
|
386
382
|
if (!in_comment) {
|