view release on metacpan or search on metacpan
t/sass-spec/spec/basic/30_if_in_function/expected.compact.css
t/sass-spec/spec/basic/30_if_in_function/expected.compressed.css
t/sass-spec/spec/basic/30_if_in_function/expected.expanded.css
t/sass-spec/spec/basic/30_if_in_function/expected_output.css
t/sass-spec/spec/basic/30_if_in_function/input.scss
t/sass-spec/spec/basic/31_if_in_mixin/expected.compact.css
t/sass-spec/spec/basic/31_if_in_mixin/expected.compressed.css
t/sass-spec/spec/basic/31_if_in_mixin/expected.expanded.css
t/sass-spec/spec/basic/31_if_in_mixin/expected_output.css
t/sass-spec/spec/basic/31_if_in_mixin/input.scss
t/sass-spec/spec/basic/32_percentages/expected.compact.css
t/sass-spec/spec/basic/32_percentages/expected.compressed.css
t/sass-spec/spec/basic/32_percentages/expected.expanded.css
t/sass-spec/spec/basic/32_percentages/expected_output.css
t/sass-spec/spec/basic/32_percentages/input.scss
t/sass-spec/spec/basic/33_ambiguous_imports/blir/_fudge.scss
t/sass-spec/spec/basic/33_ambiguous_imports/dir.scss
t/sass-spec/spec/basic/33_ambiguous_imports/dir/whatever
t/sass-spec/spec/basic/33_ambiguous_imports/expected.compact.css
t/sass-spec/spec/basic/33_ambiguous_imports/expected.compressed.css
t/sass-spec/spec/basic/33_ambiguous_imports/expected.expanded.css
t/sass-spec/spec/basic/33_ambiguous_imports/expected_output.css
t/sass-spec/spec/basic/33_ambiguous_imports/input.scss
t/sass-spec/spec/basic/35_varargs_false/expected.compact.css
t/sass-spec/spec/basic/35_varargs_false/expected.compressed.css
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/dimension/expected.compact.css
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/dimension/expected.compressed.css
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/dimension/expected.expanded.css
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/dimension/expected_output.css
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/dimension/input.scss
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/number/expected.compact.css
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/number/expected.compressed.css
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/number/expected.expanded.css
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/number/expected_output.css
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/number/input.scss
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/percent/expected.compact.css
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/percent/expected.compressed.css
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/percent/expected.expanded.css
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/percent/expected_output.css
t/sass-spec/spec/libsass-closed-issues/issue_550/literal/percent/input.scss
t/sass-spec/spec/libsass-closed-issues/issue_550/operator/expected.compact.css
t/sass-spec/spec/libsass-closed-issues/issue_550/operator/expected.compressed.css
t/sass-spec/spec/libsass-closed-issues/issue_550/operator/expected.expanded.css
t/sass-spec/spec/libsass-closed-issues/issue_550/operator/expected_output.css
t/sass-spec/spec/libsass-closed-issues/issue_550/operator/input.scss
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/dimension/expected.compact.css
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/dimension/expected.compressed.css
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/dimension/expected.expanded.css
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/dimension/expected_output.css
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/dimension/input.scss
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/number/expected.compact.css
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/number/expected.compressed.css
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/number/expected.expanded.css
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/number/expected_output.css
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/number/input.scss
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/percent/expected.compact.css
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/percent/expected.compressed.css
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/percent/expected.expanded.css
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/percent/expected_output.css
t/sass-spec/spec/libsass-closed-issues/issue_550/variable/percent/input.scss
t/sass-spec/spec/libsass-closed-issues/issue_552/expected.compact.css
t/sass-spec/spec/libsass-closed-issues/issue_552/expected.compressed.css
t/sass-spec/spec/libsass-closed-issues/issue_552/expected.expanded.css
t/sass-spec/spec/libsass-closed-issues/issue_552/expected_output.css
t/sass-spec/spec/libsass-closed-issues/issue_552/input.scss
t/sass-spec/spec/libsass-closed-issues/issue_553/expected.compact.css
t/sass-spec/spec/libsass-closed-issues/issue_553/expected.compressed.css
t/sass-spec/spec/libsass-closed-issues/issue_553/expected.expanded.css
t/sass-spec/spec/libsass-closed-issues/issue_553/expected_output.css
t/sass-spec/spec/libsass-closed-issues/issue_553/input.scss
t/sass-spec/spec/number-functions/max/expected.compact.css
t/sass-spec/spec/number-functions/max/expected.compressed.css
t/sass-spec/spec/number-functions/max/expected.expanded.css
t/sass-spec/spec/number-functions/max/expected_output.css
t/sass-spec/spec/number-functions/max/input.scss
t/sass-spec/spec/number-functions/min/expected.compact.css
t/sass-spec/spec/number-functions/min/expected.compressed.css
t/sass-spec/spec/number-functions/min/expected.expanded.css
t/sass-spec/spec/number-functions/min/expected_output.css
t/sass-spec/spec/number-functions/min/input.scss
t/sass-spec/spec/number-functions/percentage/expected.compact.css
t/sass-spec/spec/number-functions/percentage/expected.compressed.css
t/sass-spec/spec/number-functions/percentage/expected.expanded.css
t/sass-spec/spec/number-functions/percentage/expected_output.css
t/sass-spec/spec/number-functions/percentage/input.scss
t/sass-spec/spec/number-functions/random/expected.compact.css
t/sass-spec/spec/number-functions/random/expected.compressed.css
t/sass-spec/spec/number-functions/random/expected.expanded.css
t/sass-spec/spec/number-functions/random/expected_output.css
t/sass-spec/spec/number-functions/random/input.scss
t/sass-spec/spec/number-functions/round/expected.compact.css
t/sass-spec/spec/number-functions/round/expected.compressed.css
t/sass-spec/spec/number-functions/round/expected.expanded.css
t/sass-spec/spec/number-functions/round/expected_output.css
t/sass-spec/spec/number-functions/round/input.scss
t/sass-spec/spec/scss/passing_all_as_keyword_args_in_opposite_order/expected.compact.css
t/sass-spec/spec/scss/passing_all_as_keyword_args_in_opposite_order/expected.compressed.css
t/sass-spec/spec/scss/passing_all_as_keyword_args_in_opposite_order/expected.expanded.css
t/sass-spec/spec/scss/passing_all_as_keyword_args_in_opposite_order/expected_output.css
t/sass-spec/spec/scss/passing_all_as_keyword_args_in_opposite_order/input.scss
t/sass-spec/spec/scss/passing_required_args_as_a_keyword_arg/expected.compact.css
t/sass-spec/spec/scss/passing_required_args_as_a_keyword_arg/expected.compressed.css
t/sass-spec/spec/scss/passing_required_args_as_a_keyword_arg/expected.expanded.css
t/sass-spec/spec/scss/passing_required_args_as_a_keyword_arg/expected_output.css
t/sass-spec/spec/scss/passing_required_args_as_a_keyword_arg/input.scss
t/sass-spec/spec/scss/percentages/expected.compact.css
t/sass-spec/spec/scss/percentages/expected.compressed.css
t/sass-spec/spec/scss/percentages/expected.expanded.css
t/sass-spec/spec/scss/percentages/expected_output.css
t/sass-spec/spec/scss/percentages/input.scss
t/sass-spec/spec/scss/placeholder-with-media/expected.compact.css
t/sass-spec/spec/scss/placeholder-with-media/expected.compressed.css
t/sass-spec/spec/scss/placeholder-with-media/expected.expanded.css
t/sass-spec/spec/scss/placeholder-with-media/expected_output.css
t/sass-spec/spec/scss/placeholder-with-media/input.scss
t/sass-spec/spec/scss/placeholder/expected.compact.css
t/sass-spec/spec/scss/placeholder/expected.compressed.css
t/sass-spec/spec/scss/placeholder/expected.expanded.css
t/sass-spec/spec/scss/placeholder/expected_output.css
t/sass-spec/spec/scss/placeholder/input.scss
libsass/ast.hpp view on Meta::CPAN
virtual size_t hash()
{
if (hash_ == 0) hash_ = std::hash<string>()(value_) ^ std::hash<int>()(type_);
return hash_;
}
ATTACH_OPERATIONS();
};
////////////////////////////////////////////////
// Numbers, percentages, dimensions, and colors.
////////////////////////////////////////////////
class Number : public Expression {
ADD_PROPERTY(double, value);
ADD_PROPERTY(bool, zero);
vector<string> numerator_units_;
vector<string> denominator_units_;
size_t hash_;
public:
Number(ParserState pstate, double val, string u = "", bool zero = true)
: Expression(pstate),
libsass/constants.cpp view on Meta::CPAN
extern const char gt[] = ">";
extern const char gte[] = ">=";
extern const char lt[] = "<";
extern const char lte[] = "<=";
extern const char eq[] = "==";
extern const char neq[] = "!=";
extern const char true_kwd[] = "true";
extern const char false_kwd[] = "false";
// miscellaneous punctuation and delimiters
extern const char percent_str[] = "%";
extern const char empty_str[] = "";
extern const char slash_slash[] = "//";
extern const char slash_star[] = "/*";
extern const char star_slash[] = "*/";
extern const char hash_lbrace[] = "#{";
extern const char rbrace[] = "}";
extern const char rparen[] = ")";
extern const char sign_chars[] = "-+";
extern const char hyphen[] = "-";
extern const char ellipsis[] = "...";
// extern const char url_space_chars[] = " \t\r\n\f";
extern const char escape_chars[] = " -~"; // need to include unicode spaces too
// type names
extern const char numeric_name[] = "numeric value";
extern const char number_name[] = "number";
extern const char percentage_name[] = "percentage";
extern const char dimension_name[] = "numeric dimension";
extern const char string_name[] = "string";
extern const char bool_name[] = "bool";
extern const char color_name[] = "color";
extern const char list_name[] = "list";
extern const char map_name[] = "map";
extern const char arglist_name[] = "arglist";
// constants for uri parsing (RFC 3986 Appendix A.)
extern const char uri_chars[] = ":;/?!$%&#@[]{}'\"*+-.,_=";
libsass/constants.hpp view on Meta::CPAN
extern const char gt[];
extern const char gte[];
extern const char lt[];
extern const char lte[];
extern const char eq[];
extern const char neq[];
extern const char true_kwd[];
extern const char false_kwd[];
// miscellaneous punctuation and delimiters
extern const char percent_str[];
extern const char empty_str[];
extern const char slash_slash[];
extern const char slash_star[];
extern const char star_slash[];
extern const char hash_lbrace[];
extern const char rbrace[];
extern const char rparen[];
extern const char sign_chars[];
extern const char hyphen[];
extern const char ellipsis[];
// extern const char url_space_chars[];
extern const char escape_chars[];
// type names
extern const char numeric_name[];
extern const char number_name[];
extern const char percentage_name[];
extern const char dimension_name[];
extern const char string_name[];
extern const char bool_name[];
extern const char color_name[];
extern const char list_name[];
extern const char map_name[];
extern const char arglist_name[];
// constants for uri parsing (RFC 3986 Appendix A.)
extern const char uri_chars[];
libsass/context.cpp view on Meta::CPAN
// String Functions
register_function(ctx, unquote_sig, sass_unquote, env);
register_function(ctx, quote_sig, sass_quote, env);
register_function(ctx, str_length_sig, str_length, env);
register_function(ctx, str_insert_sig, str_insert, env);
register_function(ctx, str_index_sig, str_index, env);
register_function(ctx, str_slice_sig, str_slice, env);
register_function(ctx, to_upper_case_sig, to_upper_case, env);
register_function(ctx, to_lower_case_sig, to_lower_case, env);
// Number Functions
register_function(ctx, percentage_sig, percentage, env);
register_function(ctx, round_sig, round, env);
register_function(ctx, ceil_sig, ceil, env);
register_function(ctx, floor_sig, floor, env);
register_function(ctx, abs_sig, abs, env);
register_function(ctx, min_sig, min, env);
register_function(ctx, max_sig, max, env);
register_function(ctx, random_sig, random, env);
// List Functions
register_function(ctx, length_sig, length, env);
register_function(ctx, nth_sig, nth, env);
libsass/functions.cpp view on Meta::CPAN
if (String_Quoted* ss = dynamic_cast<String_Quoted*>(s)) {
str = ss->quote_mark() ? quote(str, '"') : str;
}
return new (ctx.mem) String_Constant(pstate, str);
}
///////////////////
// NUMBER FUNCTIONS
///////////////////
Signature percentage_sig = "percentage($number)";
BUILT_IN(percentage)
{
Number* n = ARG("$number", Number);
if (!n->is_unitless()) error("argument $number of `" + string(sig) + "` must be unitless", pstate);
return new (ctx.mem) Number(pstate, n->value() * 100, "%");
}
Signature round_sig = "round($number)";
BUILT_IN(round)
{
Number* n = ARG("$number", Number);
libsass/functions.hpp view on Meta::CPAN
extern Signature change_color_sig;
extern Signature ie_hex_str_sig;
extern Signature unquote_sig;
extern Signature quote_sig;
extern Signature str_length_sig;
extern Signature str_insert_sig;
extern Signature str_index_sig;
extern Signature str_slice_sig;
extern Signature to_upper_case_sig;
extern Signature to_lower_case_sig;
extern Signature percentage_sig;
extern Signature round_sig;
extern Signature ceil_sig;
extern Signature floor_sig;
extern Signature abs_sig;
extern Signature min_sig;
extern Signature max_sig;
extern Signature inspect_sig;
extern Signature random_sig;
extern Signature length_sig;
extern Signature nth_sig;
libsass/functions.hpp view on Meta::CPAN
BUILT_IN(change_color);
BUILT_IN(ie_hex_str);
BUILT_IN(sass_unquote);
BUILT_IN(sass_quote);
BUILT_IN(str_length);
BUILT_IN(str_insert);
BUILT_IN(str_index);
BUILT_IN(str_slice);
BUILT_IN(to_upper_case);
BUILT_IN(to_lower_case);
BUILT_IN(percentage);
BUILT_IN(round);
BUILT_IN(ceil);
BUILT_IN(floor);
BUILT_IN(abs);
BUILT_IN(min);
BUILT_IN(max);
BUILT_IN(inspect);
BUILT_IN(random);
BUILT_IN(length);
BUILT_IN(nth);
libsass/parser.cpp view on Meta::CPAN
if (block_stack.back() && block_stack.back()->is_root()) {
//error("Base-level rules cannot contain the parent-selector-referencing character '&'.", pstate);
}
(*seq) << new (ctx.mem) Selector_Reference(pstate);
sawsomething = true;
// if you see a space after a &, then you're done
if(peek< spaces >() || peek< alternatives < spaces, exactly<';'> > >()) {
return seq;
}
}
if (sawsomething && lex_css< sequence< negate< functional >, alternatives< identifier_alnums, universal, quoted_string, dimension, percentage, number > > >()) {
// saw an ampersand, then allow type selectors with arbitrary number of hyphens at the beginning
(*seq) << new (ctx.mem) Type_Selector(pstate, unquote(lexed));
} else if (lex_css< sequence< negate< functional >, alternatives< type_selector, universal, quoted_string, dimension, percentage, number > > >()) {
// if you see a type selector
(*seq) << new (ctx.mem) Type_Selector(pstate, lexed);
sawsomething = true;
}
if (!sawsomething) {
// don't blindly do this if you saw a & or selector
(*seq) << parse_simple_selector();
}
while (!peek< spaces >(position) &&
libsass/parser.cpp view on Meta::CPAN
if (lex< kwd_null >())
{ return new (ctx.mem) Null(pstate); }
if (lex< identifier >()) {
String_Constant* str = new (ctx.mem) String_Quoted(pstate, lexed);
// Dont' delay this string if it is a name color. Fixes #652.
str->is_delayed(ctx.names_to_colors.count(unquote(lexed)) == 0);
return str;
}
if (lex< percentage >())
{ return new (ctx.mem) Textual(pstate, Textual::PERCENTAGE, lexed); }
// match hex number first because 0x000 looks like a number followed by an indentifier
if (lex< alternatives< hex, hex0 > >())
{ return new (ctx.mem) Textual(pstate, Textual::HEX, lexed); }
// also handle the 10em- foo special case
if (lex< sequence< dimension, optional< sequence< exactly<'-'>, negate< digit > > > > >())
{ return new (ctx.mem) Textual(pstate, Textual::DIMENSION, lexed); }
if (lex< number >())
{ return new (ctx.mem) Textual(pstate, Textual::NUMBER, lexed); }
if (peek< quoted_string >())
{ return parse_string(); }
if (lex< variable >())
{ return new (ctx.mem) Variable(pstate, Util::normalize_underscores(lexed)); }
// Special case handling for `%` proceeding an interpolant.
if (lex< sequence< exactly<'%'>, optional< percentage > > >())
{ return new (ctx.mem) String_Quoted(pstate, lexed); }
error("error reading values after " + lexed.to_string(), pstate);
// unreachable statement
return 0;
}
// this parses interpolation inside other strings
// means the result should later be quoted again
libsass/parser.cpp view on Meta::CPAN
Expression* interp_node = Parser::from_token(insides, ctx, pstate).parse_list();
interp_node->is_interpolant(true);
(*schema) << interp_node;
}
else if (lex< exactly<'%'> >()) {
(*schema) << new (ctx.mem) String_Constant(pstate, lexed);
}
else if (lex< identifier >()) {
(*schema) << new (ctx.mem) String_Quoted(pstate, lexed);
}
else if (lex< percentage >()) {
(*schema) << new (ctx.mem) Textual(pstate, Textual::PERCENTAGE, lexed);
}
else if (lex< dimension >()) {
(*schema) << new (ctx.mem) Textual(pstate, Textual::DIMENSION, lexed);
}
else if (lex< number >()) {
(*schema) << new (ctx.mem) Textual(pstate, Textual::NUMBER, lexed);
}
else if (lex< hex >()) {
(*schema) << new (ctx.mem) Textual(pstate, Textual::HEX, unquote(lexed));
libsass/parser.cpp view on Meta::CPAN
bool saw_stuff = false;
bool saw_interpolant = false;
while ((q = peek< identifier >(p)) ||
(q = peek< hyphens_and_identifier >(p)) ||
(q = peek< hyphens_and_name >(p)) ||
(q = peek< type_selector >(p)) ||
(q = peek< id_name >(p)) ||
(q = peek< class_name >(p)) ||
(q = peek< sequence< pseudo_prefix, identifier > >(p)) ||
(q = peek< percentage >(p)) ||
(q = peek< dimension >(p)) ||
(q = peek< quoted_string >(p)) ||
(q = peek< exactly<'*'> >(p)) ||
(q = peek< exactly<sel_deep_kwd> >(p)) ||
(q = peek< exactly<'('> >(p)) ||
(q = peek< exactly<')'> >(p)) ||
(q = peek< exactly<'['> >(p)) ||
(q = peek< exactly<']'> >(p)) ||
(q = peek< exactly<'+'> >(p)) ||
(q = peek< exactly<'~'> >(p)) ||
libsass/parser.cpp view on Meta::CPAN
const char* p = start ? start : position;
const char* q;
bool saw_interpolant = false;
bool saw_stuff = false;
while ((q = peek< identifier >(p)) ||
(q = peek< type_selector >(p)) ||
(q = peek< id_name >(p)) ||
(q = peek< class_name >(p)) ||
(q = peek< sequence< pseudo_prefix, identifier > >(p)) ||
(q = peek< percentage >(p)) ||
(q = peek< dimension >(p)) ||
(q = peek< quoted_string >(p)) ||
(q = peek< exactly<'*'> >(p)) ||
(q = peek< exactly<'('> >(p)) ||
(q = peek< exactly<')'> >(p)) ||
(q = peek< exactly<'['> >(p)) ||
(q = peek< exactly<']'> >(p)) ||
(q = peek< exactly<'+'> >(p)) ||
(q = peek< exactly<'~'> >(p)) ||
(q = peek< exactly<'>'> >(p)) ||
libsass/prelexer.cpp view on Meta::CPAN
const char* quoted_string(const char* src) {
// match a quoted string, while skipping interpolants
return alternatives<
single_quoted_string,
double_quoted_string
>(src);
}
const char* value_schema(const char* src) {
// follows this pattern: ([xyz]*i[xyz]*)+
return one_plus< sequence< zero_plus< alternatives< identifier, percentage, dimension, hex, number, quoted_string > >,
interpolant,
zero_plus< alternatives< identifier, percentage, dimension, hex, number, quoted_string, exactly<'%'> > > > >(src);
}
/* not used anymore - remove?
const char* filename(const char* src) {
return one_plus< alternatives< identifier, number, exactly<'.'> > >(src);
}
*/
// Match CSS '@' keywords.
const char* at_keyword(const char* src) {
libsass/prelexer.cpp view on Meta::CPAN
}
const char* binomial(const char* src) {
return sequence< optional<sign>,
optional<digits>,
exactly<'n'>,
zero_plus < space >,
sign,
zero_plus < space >,
digits >(src);
}
const char* percentage(const char* src) {
return sequence< number, exactly<'%'> >(src);
}
const char* ampersand(const char* src) {
return exactly<'&'>(src);
}
/* not used anymore - remove?
const char* em(const char* src) {
return sequence< number, exactly<em_kwd> >(src);
} */
libsass/prelexer.cpp view on Meta::CPAN
const char* pos = src;
const char * s = quoted_string(pos);
Token t(pos, s);
const unsigned int p = count_interval< interpolant >(t.begin, t.end);
return (p == 0) ? t.end : 0;
}
const char* static_component(const char* src) {
return alternatives< identifier,
static_string,
percentage,
hex,
number,
sequence< exactly<'!'>, word<important_kwd> >
>(src);
}
const char* static_value(const char* src) {
return sequence< sequence<
static_component,
zero_plus< identifier >
libsass/prelexer.hpp view on Meta::CPAN
// Attribute name in an attribute selector
const char* attribute_name(const char* src);
// Match placeholder selectors.
const char* placeholder(const char* src);
// Match CSS numeric constants.
const char* sign(const char* src);
const char* unsigned_number(const char* src);
const char* number(const char* src);
const char* coefficient(const char* src);
const char* binomial(const char* src);
const char* percentage(const char* src);
const char* ampersand(const char* src);
const char* dimension(const char* src);
const char* hex(const char* src);
const char* hexa(const char* src);
const char* hex0(const char* src);
// const char* rgb_prefix(const char* src);
// Match CSS uri specifiers.
const char* uri_prefix(const char* src);
const char* uri_value(const char* src);
// Match CSS "!important" keyword.
t/03_xs_functions.t view on Meta::CPAN
# Number input/output
($r, $err) = CSS::Sass::sass_compile('.valid { color: test(40); }',
sass_functions => { 'test($x)' => sub { CSS::Sass::Type::Number->new(shift->value**2) } } );
like ($r, qr/color: 1600;/, "Sass function number works");
is ($err, undef, "Sass function number returns no errors");
# Percentage input/output
($r, $err) = CSS::Sass::sass_compile('.valid { color: test(40%); }',
sass_functions => { 'test($x)' => sub { CSS::Sass::Type::Number->new(shift->value/2, '%') } } );
like ($r, qr/color: 20%;/, "Sass function percentage works");
is ($err, undef, "Sass function percentage returns no errors");
# Dimension input/output
($r, $err) = CSS::Sass::sass_compile('.valid { color: test(20rods); }',
sass_functions => { 'test($x)' => sub { CSS::Sass::Type::Number->new($_[0]->value*2,
$_[0]->unit."perhogshead") } } );
like ($r, qr/color: 40rodsperhogshead;/, "Sass function dimension works");
is ($err, undef, "Sass function dimension returns no errors");
# Color input/output
($r, $err) = CSS::Sass::sass_compile('.valid { color: test(rgba(40,30,20,.3)); }',
t/04_xs_value_types.t view on Meta::CPAN
my $bool_null = CSS::Sass::Type::Boolean->new(undef);
my $bool_true = CSS::Sass::Type::Boolean->new(1);
my $bool_false = CSS::Sass::Type::Boolean->new(0);
my $string = CSS::Sass::Type::String->new();
my $string_null = CSS::Sass::Type::String->new(undef);
my $string_foobar = CSS::Sass::Type::String->new('foobar');
my $number = CSS::Sass::Type::Number->new();
my $number_null = CSS::Sass::Type::Number->new(undef);
my $number_42 = CSS::Sass::Type::Number->new(42);
my $number_px = CSS::Sass::Type::Number->new(42, 'px');
my $number_percent = CSS::Sass::Type::Number->new(42, '%');
my $color = CSS::Sass::Type::Color->new();
my $color_rgb = CSS::Sass::Type::Color->new(42, 43, 44);
my $color_rgba = CSS::Sass::Type::Color->new(1, 2, 3, 0.4);
my $color_trans = CSS::Sass::Type::Color->new(255, 0, 128, 0);
my $list = CSS::Sass::Type::List->new('foo', 'bar');
my $list_comma = CSS::Sass::Type::List::Comma->new('foo', 'bar', 'baz');
my $list_space = CSS::Sass::Type::List::Space->new('foo', 'bar', 'baz');
my $map = CSS::Sass::Type::Map->new('foo' => 'bar');
my $error = CSS::Sass::Type::Error->new();
my $error_msg = CSS::Sass::Type::Error->new('message');
t/04_xs_value_types.t view on Meta::CPAN
is $color_rgba->a, 0.4, "color_rgba a is correct";
is $color_trans, "transparent", "color without opacity is transparent";
################################################################################
test_number($number);
test_number($number_null);
test_number($number_42);
test_number($number_px);
test_number($number_percent);
is $number, "0", "number stringify is correct";
is $number->value, 0, "number value is correct";
is $number->unit, "", "number unit is correct";
is $number_null, "0", "number_null stringify is correct";
is $number_null->value, 0, "number_null value is correct";
is $number_null->unit, "", "number_null unit is correct";
is $number_42, "42", "number_42 stringify is correct";
is $number_42->value, 42, "number_42 value is correct";
is $number_42->unit, "", "number_42 unit is correct";
is $number_px, "42px", "number_px stringify is correct";
is $number_px->value, 42, "number_px value is correct";
is $number_px->unit, "px", "number_px unit is correct";
is $number_percent, "42%", "number_percent stringify is correct";
is $number_percent->value, 42, "number_percent value is correct";
is $number_percent->unit, "%", "number_percent unit is correct";
################################################################################
test_list($list);
test_list($list_comma);
test_list($list_space);
is $list, 'foo, bar', "list stringify is correct";
is $list->[0], 'foo', "list[0] is correct";
is $list->[1], 'bar', "list[1] is correct";
t/sass-spec/spec/libsass-closed-issues/issue_361/input.scss view on Meta::CPAN
h1 {
margin-left: percentage(10/(120-20));
}
t/sass-spec/spec/libsass-todo-tests/libsass/arithmetic/expected.compact.css view on Meta::CPAN
div { /* number + whatever */ font: 5; font: 53%; font: 15px; font: #141414; font: 3hello; font: "3hello"; font: 3true; font: 3false; font: 3not-there(hello); font: 3unquote("hello"); font: 3a, b, c; font: 3a b c; /* number - whatever */ font: 1; fon...
t/sass-spec/spec/libsass-todo-tests/libsass/arithmetic/expected.expanded.css view on Meta::CPAN
font: 3/"hello";
font: 3/true;
font: 3/false;
font: 3/not-there(hello);
font: 3/unquote("hello");
font: 3/a, b, c;
font: 3/a b c;
/* number % whatever */
font: 1;
/* */
/* percentage + whatever */
font: 53%;
font: 150%;
font: 50%hello;
font: "50%hello";
font: 50%undefined(hello);
font: 50%unquote("hello");
font: 50%a, b, c;
font: 50%a b c;
/* percentage - whatever */
font: 47%;
font: -50%;
font: 50%-#111111;
font: 50%-hello;
font: 50%-"hello";
font: 50%-undefined(hello);
font: 50%-unquote("hello");
font: 50%-a, b, c;
font: 50%-a b c;
/* percentage * whatever */
font: 150%;
/* percentage / whatever */
font: 16.66667%;
font: 0.5;
font: 50%/#111111;
font: 50%/hello;
font: 50%/"hello";
font: 50%/undefined(hello);
font: 50%/unquote("hello");
font: 50%/a, b, c;
font: 50%/a b c;
/* percentage % whatever */
/* percentage / whatever */
font: 2%;
font: string;
blah: 20/#abc;
blah: string;
blah: 3true;
blah: true3;
blah: true-5;
blah: #0a0b0c;
foo: string;
foo: 1 2 3a b c;
t/sass-spec/spec/libsass-todo-tests/libsass/arithmetic/expected_output.css view on Meta::CPAN
font: 3/"hello";
font: 3/true;
font: 3/false;
font: 3/not-there(hello);
font: 3/unquote("hello");
font: 3/a, b, c;
font: 3/a b c;
/* number % whatever */
font: 1;
/* */
/* percentage + whatever */
font: 53%;
font: 150%;
font: 50%hello;
font: "50%hello";
font: 50%undefined(hello);
font: 50%unquote("hello");
font: 50%a, b, c;
font: 50%a b c;
/* percentage - whatever */
font: 47%;
font: -50%;
font: 50%-#111111;
font: 50%-hello;
font: 50%-"hello";
font: 50%-undefined(hello);
font: 50%-unquote("hello");
font: 50%-a, b, c;
font: 50%-a b c;
/* percentage * whatever */
font: 150%;
/* percentage / whatever */
font: 16.66667%;
font: 0.5;
font: 50%/#111111;
font: 50%/hello;
font: 50%/"hello";
font: 50%/undefined(hello);
font: 50%/unquote("hello");
font: 50%/a, b, c;
font: 50%/a b c;
/* percentage % whatever */
/* percentage / whatever */
font: 2%;
font: string;
blah: 20/#abc;
blah: string;
blah: 3true;
blah: true3;
blah: true-5;
blah: #0a0b0c;
foo: string;
foo: 1 2 3a b c;
t/sass-spec/spec/libsass-todo-tests/libsass/arithmetic/input.scss view on Meta::CPAN
// font: 3 % #111111; // invalid operand
// font: 3 % hello;
// font: 3 % "hello";
// font: 3 % true;
// font: 3 % false;
// font: 3 % not-there(hello);
// font: 3 % un#{quo}te("hello");
// font: 3 % (a, b, c);
// font: 3 % (a b c);
/* */
/* percentage + whatever */
font: 50% + 3;
font: 50% + 100%;
// font : 50% + 10px; // incompatible units
// font: 50% + #111111; // invalid operands
font: 50% + hello;
font: 50% + "hello";
font: 50% + undefined(hello);
font: 50% + un#{quo}te("hello");
font: 50% + (a, b, c);
font: 50% + (a b c);
/* percentage - whatever */
font: 50% - 3;
font: 50% - 100%;
// font: 50% - 10px; // incompatible units
font: 50% - #111111; // invalid operands
font: 50% - hello;
font: 50% - "hello";
font: 50% - undefined(hello);
font: 50% - un#{quo}te("hello");
font: 50% - (a, b, c);
font: 50% - (a b c);
/* percentage * whatever */
font: 50% * 3;
// font: 50% * 100%; // results in squared units
// font: 50% * 10px; // results in mixed units
// font: 50% * #111111; // invalid operands
// font: 50% * hello;
// font: 50% * "hello";
// font: 50% * undefined(hello);
// font: 50% * un#{quo}te("hello");
// font: 50% * (a, b, c);
// font: 50% * (a b c);
/* percentage / whatever */
font: (50% / 3);
font: (50% / 100%);
// font: (50% / 10px); // incompatible units
font: (50% / #111111); // invalid operands
font: (50% / hello);
font: 50%/"hello";
font: (50% / undefined(hello));
font: 50% / un#{quo}te("hello");
font: 50% / (a, b, c);
font: 50% / (a b c);
/* percentage % whatever */
/* percentage / whatever */
font: 50% % 3;
// font: 50% % 100%; // not allowed to mod by units
// font: 50% % 10px;
// font: 50% % #111111; // invalid operands
// font: 50% % hello;
// font: 50% % "hello";
// font: 50% % undefined(hello);
// font: 50% % un#{quo}te("hello");
// font: 50% % (a, b, c);
// font: 50% % (a b c);
t/sass-spec/spec/libsass/bourbon/lib/functions/_flex-grid.scss view on Meta::CPAN
// Flexible grid
@function flex-grid($columns, $container-columns: $fg-max-columns) {
$width: $columns * $fg-column + ($columns - 1) * $fg-gutter;
$container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter;
@return percentage($width / $container-width);
}
// Flexible gutter
@function flex-gutter($container-columns: $fg-max-columns, $gutter: $fg-gutter) {
$container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter;
@return percentage($gutter / $container-width);
}
// The $fg-column, $fg-gutter and $fg-max-columns variables must be defined in your base stylesheet to properly use the flex-grid function.
// This function takes the fluid grid equation (target / context = result) and uses columns to help define each.
//
// The calculation presumes that your column structure will be missing the last gutter:
//
// -- column -- gutter -- column -- gutter -- column
//
// $fg-column: 60px; // Column Width
t/sass-spec/spec/libsass/bourbon/lib/functions/_tint-shade.scss view on Meta::CPAN
// Add percentage of white to a color
@function tint($color, $percent){
@return mix(white, $color, $percent);
}
// Add percentage of black to a color
@function shade($color, $percent){
@return mix(black, $color, $percent);
}
t/sass-spec/spec/libsass/bourbon/lib/helpers/_deprecated-webkit-gradient.scss view on Meta::CPAN
// Render Deprecated Webkit Gradient - Linear || Radial
//************************************************************************//
@function _deprecated-webkit-gradient($type,
$deprecated-pos1, $deprecated-pos2,
$full,
$deprecated-radius1: false, $deprecated-radius2: false) {
$gradient-list: ();
$gradient: false;
$full-length: length($full);
$percentage: false;
$gradient-type: $type;
@for $i from 1 through $full-length {
$gradient: nth($full, $i);
@if length($gradient) == 2 {
$color-stop: color-stop(nth($gradient, 2), nth($gradient, 1));
$gradient-list: join($gradient-list, $color-stop, comma);
}
@else if $gradient != null {
@if $i == $full-length {
$percentage: 100%;
}
@else {
$percentage: ($i - 1) * (100 / ($full-length - 1)) + "%";
}
$color-stop: color-stop(unquote($percentage), $gradient);
$gradient-list: join($gradient-list, $color-stop, comma);
}
}
@if $type == radial {
$gradient: -webkit-gradient(radial, $deprecated-pos1, $deprecated-radius1, $deprecated-pos2, $deprecated-radius2, $gradient-list);
}
@else if $type == linear {
$gradient: -webkit-gradient(linear, $deprecated-pos1, $deprecated-pos2, $gradient-list);
}
t/sass-spec/spec/libsass/unquote/input.scss view on Meta::CPAN
div {
a: unquote("foo");
b: unquote("I'm a \"fashion\" \"expert\".");
c: unquote(\"wha);
d: unquote("column1\tcolumn2");
e: unquote(23+1);
f: percentage(.37);
g: type-of(null);
// h: hello + null;
j: length(null);
k: nth(1 2 3, 2);
l: join(a, b, auto);
m: zip(a b c, 1 2);
n: min(1, 2%, 3px);
}
t/sass-spec/spec/number-functions/percentage/input.scss view on Meta::CPAN
foo {
foo: percentage(.5);
foo: percentage(1);
foo: percentage(25px / 100px);
foo: percentage($number: 0.5);
}
t/smoke/mem-leaks.pl view on Meta::CPAN
my $bool_null = CSS::Sass::Type::Boolean->new(undef);
my $bool_true = CSS::Sass::Type::Boolean->new(1);
my $bool_false = CSS::Sass::Type::Boolean->new(0);
my $string = CSS::Sass::Type::String->new();
my $string_null = CSS::Sass::Type::String->new(undef);
my $string_foobar = CSS::Sass::Type::String->new('foobar');
my $number = CSS::Sass::Type::Number->new();
my $number_null = CSS::Sass::Type::Number->new(undef);
my $number_42 = CSS::Sass::Type::Number->new(42);
my $number_px = CSS::Sass::Type::Number->new(42, 'px');
my $number_percent = CSS::Sass::Type::Number->new(42, '%');
my $color = CSS::Sass::Type::Color->new();
my $color_rgb = CSS::Sass::Type::Color->new(42, 43, 44);
my $color_rgba = CSS::Sass::Type::Color->new(1, 2, 3, 0.4);
my $color_trans = CSS::Sass::Type::Color->new(255, 0, 128, 0);
my $list = CSS::Sass::Type::List->new('foo', 'bar');
my $list_comma = CSS::Sass::Type::List::Comma->new('foo', 'bar', 'baz');
my $list_space = CSS::Sass::Type::List::Space->new('foo', 'bar', 'baz');
my $map = CSS::Sass::Type::Map->new('foo' => 'bar');
my $error = CSS::Sass::Type::Error->new();
my $error_msg = CSS::Sass::Type::Error->new('message');