Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
7fdf5765
Commit
7fdf5765
authored
Mar 09, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changing the echo emitter to return a string instead of writing to stdout.
parent
0782af78
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
22 deletions
+22
-22
document_emitter.cpp
document_emitter.cpp
+1
-1
node.cpp
node.cpp
+20
-20
node.hpp
node.hpp
+1
-1
No files found.
document_emitter.cpp
View file @
7fdf5765
...
...
@@ -10,7 +10,7 @@ namespace Sass {
for
(
int
i
=
0
;
i
<
statements
.
size
();
++
i
)
{
switch
(
style
)
{
case
echo
:
statements
[
i
].
echo
();
statements
[
i
].
echo
(
output
);
break
;
case
nested
:
statements
[
i
].
emit_nested_css
(
output
,
0
,
vector
<
string
>
());
...
...
node.cpp
View file @
7fdf5765
...
...
@@ -12,47 +12,47 @@ namespace Sass {
size_t
Node
::
fresh
=
0
;
size_t
Node
::
copied
=
0
;
void
Node
::
echo
(
size_t
depth
)
{
void
Node
::
echo
(
s
tringstream
&
buf
,
s
ize_t
depth
)
{
string
indentation
(
2
*
depth
,
' '
);
switch
(
type
)
{
case
comment
:
cout
<<
indentation
<<
string
(
token
)
<<
endl
;
buf
<<
indentation
<<
string
(
token
)
<<
endl
;
break
;
case
ruleset
:
cout
<<
indentation
;
children
->
at
(
0
).
echo
(
depth
);
children
->
at
(
1
).
echo
(
depth
);
buf
<<
indentation
;
children
->
at
(
0
).
echo
(
buf
,
depth
);
children
->
at
(
1
).
echo
(
buf
,
depth
);
break
;
case
selector_group
:
children
->
at
(
0
).
echo
(
depth
);
children
->
at
(
0
).
echo
(
buf
,
depth
);
for
(
int
i
=
1
;
i
<
children
->
size
();
++
i
)
{
cout
<<
", "
;
children
->
at
(
i
).
echo
(
depth
);
buf
<<
", "
;
children
->
at
(
i
).
echo
(
buf
,
depth
);
}
break
;
case
selector
:
cout
<<
string
(
token
);
buf
<<
string
(
token
);
break
;
case
block
:
cout
<<
" {"
<<
endl
;
for
(
int
i
=
0
;
i
<
children
->
size
();
children
->
at
(
i
++
).
echo
(
depth
+
1
))
;
cout
<<
indentation
<<
"}"
<<
endl
;
buf
<<
" {"
<<
endl
;
for
(
int
i
=
0
;
i
<
children
->
size
();
children
->
at
(
i
++
).
echo
(
buf
,
depth
+
1
))
;
buf
<<
indentation
<<
"}"
<<
endl
;
break
;
case
rule
:
cout
<<
indentation
;
children
->
at
(
0
).
echo
(
depth
);
cout
<<
':'
;
children
->
at
(
1
).
echo
(
depth
);
cout
<<
';'
<<
endl
;
buf
<<
indentation
;
children
->
at
(
0
).
echo
(
buf
,
depth
);
buf
<<
':'
;
children
->
at
(
1
).
echo
(
buf
,
depth
);
buf
<<
';'
<<
endl
;
break
;
case
property
:
cout
<<
string
(
token
);
buf
<<
string
(
token
);
break
;
case
values
:
for
(
int
i
=
0
;
i
<
children
->
size
();
children
->
at
(
i
++
).
echo
(
depth
))
;
for
(
int
i
=
0
;
i
<
children
->
size
();
children
->
at
(
i
++
).
echo
(
buf
,
depth
))
;
break
;
case
value
:
cout
<<
' '
<<
string
(
token
);
buf
<<
' '
<<
string
(
token
);
break
;
}
}
...
...
node.hpp
View file @
7fdf5765
...
...
@@ -155,7 +155,7 @@ namespace Sass {
void
release
()
const
{
children
=
0
;
}
void
echo
(
size_t
depth
=
0
);
void
echo
(
s
tringstream
&
buf
,
s
ize_t
depth
=
0
);
void
emit_nested_css
(
stringstream
&
buf
,
size_t
depth
,
const
vector
<
string
>&
prefixes
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment