diff options
author | German M. Bravo <german.mb@deipi.com> | 2013-08-16 15:00:42 -0500 |
---|---|---|
committer | German M. Bravo <german.mb@deipi.com> | 2013-08-16 15:00:49 -0500 |
commit | d2cdd641857af07a5439e8b8fb2e2b5110aa9566 (patch) | |
tree | 0273caf576c0935ea15f074ccc55197ce0044c40 | |
parent | 1c7c055e8f8cabbe893fa34220e36b33144f2b4d (diff) | |
download | pyscss-d2cdd641857af07a5439e8b8fb2e2b5110aa9566.tar.gz |
first-value-of() fixed to maybe receive lists
-rw-r--r-- | scss/functions/compass/helpers.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/scss/functions/compass/helpers.py b/scss/functions/compass/helpers.py index 3300df9..c172f89 100644 --- a/scss/functions/compass/helpers.py +++ b/scss/functions/compass/helpers.py @@ -91,17 +91,15 @@ def reject(lst, *values): @register('first-value-of') -def first_value_of(lst): - if isinstance(lst, QuotedStringValue): - first = lst.value.split()[0] - return type(lst)(first) - elif isinstance(lst, List): - if len(lst): - return lst[0] - else: - return Null() +def first_value_of(*args): + args = List.from_maybe_starargs(args) + if len(args) == 1 and isinstance(args[0], QuotedStringValue): + first = args[0].value.split()[0] + return type(args[0])(first) + elif len(args): + return args[0] else: - return lst + return Null() @register('-compass-list') |