Commits

Victor Kotseruba committed c5af741

RubyStringFormatter is beautifuler than last one

  • Participants
  • Parent commits 84d1ae7

Comments (0)

Files changed (1)

File sass/parser.py

         super(RubyStringFormatter, self).__init__()
         self.ast = AstWrap(self)
     
+    def _var_match(self, variables, match):
+        variables.add(match.group(1))
+        return '%%(%s)s' % match.group(1)        
     
     def visit_Str(self, node):
-        
-        s = node.s
-        
         variables = set([])
-        
-        def _var_match(match):
-            variables.add(match.group(1))
-            return '%%(%s)s' % match.group(1)
-        
-        s = re.sub(r'#{!?(\w+)}', _var_match, s)
+        s = re.sub(r'#{!?(\w+)}',
+                   functools.partial(self._var_match, variables),
+                   node.s)
         
         if not variables:
             return node