Commit e2f54e2f by Aaron Leung

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

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