Commit e2f54e2f by Aaron Leung

Working out more image_url stuff. Have a reasonably simple solution.

parent 6cffdb9f
...@@ -51,7 +51,7 @@ namespace Sass { ...@@ -51,7 +51,7 @@ namespace Sass {
color_names_to_values(map<string, Node>()), color_names_to_values(map<string, Node>()),
color_values_to_names(map<Node, string>()), color_values_to_names(map<Node, string>()),
new_Node(Node_Factory()), new_Node(Node_Factory()),
image_path(""), image_path(0),
ref_count(0), ref_count(0),
has_extensions(false) has_extensions(false)
{ {
......
...@@ -50,7 +50,7 @@ namespace Sass { ...@@ -50,7 +50,7 @@ namespace Sass {
map<string, Node> color_names_to_values; map<string, Node> color_names_to_values;
map<Node, string> color_values_to_names; map<Node, string> color_values_to_names;
Node_Factory new_Node; Node_Factory new_Node;
string image_path; char* image_path;
size_t ref_count; size_t ref_count;
// string sass_path; // string sass_path;
// string css_path; // string css_path;
......
...@@ -827,6 +827,7 @@ namespace Sass { ...@@ -827,6 +827,7 @@ namespace Sass {
if (!lex< exactly<')'> >()) throw_syntax_error("call to image-url is missing ')'"); if (!lex< exactly<')'> >()) throw_syntax_error("call to image-url is missing ')'");
Node the_call(context.new_Node(Node::image_url, path, line, 1)); Node the_call(context.new_Node(Node::image_url, path, line, 1));
the_call << url; the_call << url;
the_call.should_eval() = true;
return the_call; return the_call;
} }
......
...@@ -290,8 +290,11 @@ namespace Sass { ...@@ -290,8 +290,11 @@ namespace Sass {
} break; } break;
case Node::image_url: { case Node::image_url: {
expr[0] = eval(expr[0], prefix, env, f_env, new_Node, ctx); Node base(eval(expr[0], prefix, env, f_env, new_Node, ctx));
return expr; 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));
fullpath << prefix << base;
return fullpath;
} break; } break;
case Node::function_call: { case Node::function_call: {
......
...@@ -59,6 +59,7 @@ extern "C" { ...@@ -59,6 +59,7 @@ extern "C" {
using namespace Sass; using namespace Sass;
try { try {
Context cpp_ctx(c_ctx->options.include_paths); Context cpp_ctx(c_ctx->options.include_paths);
cpp_ctx.image_path = c_ctx->options.image_path;
// Document doc(0, c_ctx->input_string, cpp_ctx); // Document doc(0, c_ctx->input_string, cpp_ctx);
Document doc(Document::make_from_source_chars(cpp_ctx, c_ctx->source_string)); 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); c_ctx->output_string = process_document(doc, c_ctx->options.output_style);
...@@ -95,6 +96,7 @@ extern "C" { ...@@ -95,6 +96,7 @@ extern "C" {
try { try {
Context cpp_ctx(c_ctx->options.include_paths); Context cpp_ctx(c_ctx->options.include_paths);
// Document doc(c_ctx->input_path, 0, cpp_ctx); // Document doc(c_ctx->input_path, 0, cpp_ctx);
cpp_ctx.image_path = c_ctx->options.image_path;
Document doc(Document::make_from_file(cpp_ctx, string(c_ctx->input_path))); Document doc(Document::make_from_file(cpp_ctx, string(c_ctx->input_path)));
// cerr << "MADE A DOC AND CONTEXT OBJ" << endl; // cerr << "MADE A DOC AND CONTEXT OBJ" << endl;
// cerr << "REGISTRY: " << doc.context.registry.size() << endl; // cerr << "REGISTRY: " << doc.context.registry.size() << endl;
......
...@@ -10,6 +10,7 @@ extern "C" { ...@@ -10,6 +10,7 @@ extern "C" {
struct sass_options { struct sass_options {
int output_style; int output_style;
char* include_paths; char* include_paths;
char* image_path;
}; };
struct sass_context { struct sass_context {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment