1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Sass] [SCSS] Support expression() and calc().

This commit is contained in:
Nathan Weizenbaum 2010-02-12 00:35:57 -08:00
parent d973cdfdab
commit 55dd4a858c
2 changed files with 20 additions and 1 deletions

View file

@ -520,7 +520,12 @@ MESSAGE
def function
return unless name = tok(FUNCTION)
[name, str{ss}, expr, tok!(/\)/)]
if name == "expression(" || name == "calc("
str, _ = Haml::Shared.balance(@scanner, ?(, ?), 1)
[name, str]
else
[name, str{ss}, expr, tok!(/\)/)]
end
end
def interpolation

View file

@ -332,6 +332,20 @@ foo {
SCSS
end
def test_expression_function
assert_parses <<SCSS
foo {
a: 12px expression(1 + (3 / Foo.bar("baz" + "bang") + function() {return 12;}) % 12); }
SCSS
end
def test_calc_function
assert_parses <<SCSS
foo {
a: 12px calc(100%/3 - 2*1em - 2*1px); }
SCSS
end
## Directives
def test_charset_directive