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
b3e8d772
Commit
b3e8d772
authored
Aug 13, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly handling the image-url function.
parent
e2f54e2f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
12 deletions
+26
-12
context.cpp
context.cpp
+8
-1
context.hpp
context.hpp
+1
-1
document_parser.cpp
document_parser.cpp
+4
-2
eval_apply.cpp
eval_apply.cpp
+3
-1
node_emitters.cpp
node_emitters.cpp
+2
-1
sass_interface.cpp
sass_interface.cpp
+8
-6
No files found.
context.cpp
View file @
b3e8d772
#include "context.hpp"
#include <cstring>
#include <iostream>
#include <unistd.h>
#include "prelexer.hpp"
...
...
@@ -41,7 +42,7 @@ namespace Sass {
// }
}
Context
::
Context
(
const
char
*
paths_str
)
Context
::
Context
(
const
char
*
paths_str
,
const
char
*
img_path_str
)
:
global_env
(
Environment
()),
function_env
(
map
<
string
,
Function
>
()),
extensions
(
multimap
<
Node
,
Node
>
()),
...
...
@@ -58,6 +59,11 @@ namespace Sass {
register_functions
();
collect_include_paths
(
paths_str
);
setup_color_map
();
string
path_string
(
img_path_str
);
path_string
=
"'"
+
path_string
+
"/'"
;
image_path
=
new
char
[
path_string
.
length
()
+
1
];
std
::
strcpy
(
image_path
,
path_string
.
c_str
());
}
Context
::~
Context
()
...
...
@@ -65,6 +71,7 @@ namespace Sass {
for
(
size_t
i
=
0
;
i
<
source_refs
.
size
();
++
i
)
{
delete
[]
source_refs
[
i
];
}
delete
[]
image_path
;
new_Node
.
free
();
// cerr << "Deallocated " << i << " source string(s)." << endl;
}
...
...
context.hpp
View file @
b3e8d772
...
...
@@ -57,7 +57,7 @@ namespace Sass {
bool
has_extensions
;
void
collect_include_paths
(
const
char
*
paths_str
);
Context
(
const
char
*
paths_str
=
0
);
Context
(
const
char
*
paths_str
=
0
,
const
char
*
img_path_str
=
0
);
~
Context
();
void
register_function
(
Function_Descriptor
d
,
Primitive
ip
);
...
...
document_parser.cpp
View file @
b3e8d772
...
...
@@ -813,9 +813,11 @@ namespace Sass {
const
char
*
value
=
position
;
const
char
*
rparen
=
find_first
<
exactly
<
')'
>
>
(
position
);
if
(
!
rparen
)
throw_syntax_error
(
"URI is missing ')'"
);
Token
contents
(
Token
::
make
(
value
,
rparen
));
Token
content_tok
(
Token
::
make
(
value
,
rparen
));
Node
content_node
(
context
.
new_Node
(
Node
::
string_constant
,
path
,
line
,
content_tok
));
// lex< string_constant >();
Node
result
(
context
.
new_Node
(
Node
::
uri
,
path
,
line
,
contents
));
Node
result
(
context
.
new_Node
(
Node
::
uri
,
path
,
line
,
1
));
result
<<
content_node
;
position
=
rparen
;
lex
<
exactly
<
')'
>
>
();
return
result
;
...
...
eval_apply.cpp
View file @
b3e8d772
...
...
@@ -293,8 +293,10 @@ namespace Sass {
Node
base
(
eval
(
expr
[
0
],
prefix
,
env
,
f_env
,
new_Node
,
ctx
));
Node
prefix
(
new_Node
(
Node
::
identifier
,
base
.
path
(),
base
.
line
(),
Token
::
make
(
ctx
.
image_path
)));
Node
fullpath
(
new_Node
(
Node
::
concatenation
,
base
.
path
(),
base
.
line
(),
2
));
Node
url
(
new_Node
(
Node
::
uri
,
base
.
path
(),
base
.
line
(),
1
));
fullpath
<<
prefix
<<
base
;
return
fullpath
;
url
<<
fullpath
;
return
url
;
}
break
;
case
Node
:
:
function_call
:
{
...
...
node_emitters.cpp
View file @
b3e8d772
...
...
@@ -268,7 +268,8 @@ namespace Sass {
case
uri
:
{
string
result
(
"url("
);
result
+=
token
().
to_string
();
// result += token().to_string();
result
+=
at
(
0
).
to_string
();
result
+=
")"
;
return
result
;
}
break
;
...
...
sass_interface.cpp
View file @
b3e8d772
...
...
@@ -13,7 +13,7 @@ extern "C" {
using
namespace
std
;
sass_context
*
sass_new_context
()
{
return
(
sass_context
*
)
calloc
(
1
,
sizeof
(
sass_context
));
}
{
return
(
sass_context
*
)
calloc
(
1
,
sizeof
(
sass_context
));
}
void
sass_free_context
(
sass_context
*
ctx
)
{
...
...
@@ -24,7 +24,7 @@ extern "C" {
}
sass_file_context
*
sass_new_file_context
()
{
return
(
sass_file_context
*
)
calloc
(
1
,
sizeof
(
sass_file_context
));
}
{
return
(
sass_file_context
*
)
calloc
(
1
,
sizeof
(
sass_file_context
));
}
void
sass_free_file_context
(
sass_file_context
*
ctx
)
{
...
...
@@ -58,8 +58,8 @@ extern "C" {
{
using
namespace
Sass
;
try
{
Context
cpp_ctx
(
c_ctx
->
options
.
include_paths
);
cpp_ctx
.
image_path
=
c_ctx
->
options
.
image_path
;
Context
cpp_ctx
(
c_ctx
->
options
.
include_paths
,
c_ctx
->
options
.
image_path
);
//
cpp_ctx.image_path = c_ctx->options.image_path;
// Document doc(0, c_ctx->input_string, cpp_ctx);
Document
doc
(
Document
::
make_from_source_chars
(
cpp_ctx
,
c_ctx
->
source_string
));
c_ctx
->
output_string
=
process_document
(
doc
,
c_ctx
->
options
.
output_style
);
...
...
@@ -94,9 +94,11 @@ extern "C" {
{
using
namespace
Sass
;
try
{
Context
cpp_ctx
(
c_ctx
->
options
.
include_paths
);
Context
cpp_ctx
(
c_ctx
->
options
.
include_paths
,
c_ctx
->
options
.
image_path
);
// Document doc(c_ctx->input_path, 0, cpp_ctx);
cpp_ctx
.
image_path
=
c_ctx
->
options
.
image_path
;
// string path_string(c_ctx->options.image_path);
// path_string = "'" + path_string + "/";
// cpp_ctx.image_path = c_ctx->options.image_path;
Document
doc
(
Document
::
make_from_file
(
cpp_ctx
,
string
(
c_ctx
->
input_path
)));
// cerr << "MADE A DOC AND CONTEXT OBJ" << endl;
// cerr << "REGISTRY: " << doc.context.registry.size() << endl;
...
...
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