diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-08-26 18:08:49 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-08-26 18:08:49 -0700 |
commit | 6a8efa934d9a91c0916ecbc6659f275e25858bc6 (patch) | |
tree | b5d490339631d2ffa144eeb26d81b66ee128883f /scss/compiler.py | |
parent | 9f0c60e02e76d0fb06538160eb0b36df72abca1a (diff) | |
download | pyscss-6a8efa934d9a91c0916ecbc6659f275e25858bc6.tar.gz |
Partial support for slurpy named arguments.
Diffstat (limited to 'scss/compiler.py')
-rw-r--r-- | scss/compiler.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/scss/compiler.py b/scss/compiler.py index 2394258..fa25e7e 100644 --- a/scss/compiler.py +++ b/scss/compiler.py @@ -30,11 +30,12 @@ from scss.rule import SassRule from scss.rule import UnparsedBlock from scss.selector import Selector from scss.source import SourceFile -from scss.types import Number +from scss.types import Arglist from scss.types import Boolean -from scss.types import String from scss.types import List from scss.types import Null +from scss.types import Number +from scss.types import String from scss.types import Undefined from scss.types import Url from scss.util import dequote @@ -518,10 +519,15 @@ class Compilation(object): if callee_argspec.slurp: # Slurpy var gets whatever is left + # TODO should preserve the order of extra kwargs + sass_kwargs = [] + for key, value in kwargs.items(): + sass_kwargs.append((String(key[1:]), value)) callee_namespace.set_variable( callee_argspec.slurp.name, - List(args, use_comma=True)) + Arglist(args, sass_kwargs)) args = [] + kwargs = {} elif callee_argspec.inject: # Callee namespace gets all the extra kwargs whether declared or # not @@ -595,6 +601,8 @@ class Compilation(object): ancestry=rule.ancestry, nested=rule.nested, ) + # TODO supposed to throw an error if there's a slurpy arg + # but keywords() is never called on it try: self.manage_children(_rule, scope) except SassReturn as e: |