Commit 8f32ad66 by Aaron Leung

Adding the 'append' builtin function because Bourbon needs it. Currently…

Adding the 'append' builtin function because Bourbon needs it. Currently implemented in terms of 'join'; will need to rewrite.
parent a8ca4ab9
......@@ -114,6 +114,8 @@ namespace Sass {
register_function(nth_descriptor, nth);
register_function(join_2_descriptor, join_2);
register_function(join_3_descriptor, join_3);
register_function(append_2_descriptor, join_2);
register_function(append_3_descriptor, join_3);
// Introspection Functions
register_function(type_of_descriptor, type_of);
register_function(unit_descriptor, unit);
......
......@@ -479,7 +479,7 @@ namespace Sass {
else if (sep == "space") rtype = Node::space_list;
else if (sep == "auto") rtype = l1.type();
else {
throw_eval_error("third argument to join must be 'space', 'comma', or 'auto'", l2.path(), l2.line());
throw_eval_error("third argument to append/join must be 'space', 'comma', or 'auto'", l2.path(), l2.line());
}
}
else if (l1.type() != Node::nil) rtype = l1.type();
......@@ -502,6 +502,15 @@ namespace Sass {
Node join_3(const vector<Token>& parameters, map<Token, Node>& bindings, Node_Factory& new_Node) {
return join_impl(parameters, bindings, true, new_Node);
}
// Node append_impl(const vector<Token>& parameters, map<Token, Node>& bindings, bool has_sep, Node_Factory& new_Node) {
// }
Function_Descriptor append_2_descriptor =
{ "append", "$list", "$val", 0 };
Function_Descriptor append_3_descriptor =
{ "append", "$list", "$val", "$separator", 0 };
// Introspection Functions /////////////////////////////////////////////
......
......@@ -145,6 +145,9 @@ namespace Sass {
extern Function_Descriptor join_3_descriptor;
Node join_3(const vector<Token>& parameters, map<Token, Node>& bindings, Node_Factory& new_Node);
extern Function_Descriptor append_2_descriptor;
extern Function_Descriptor append_3_descriptor;
// Introspection Functions /////////////////////////////////////////////
......
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