pyjade
pyjade copied to clipboard
Tag interpolation
Tag interpolation [jade issue] [jade commit]
mixin test(tag)
#{tag} text
+test('div')
Also fix a bug in ext/html.py
def _make_mixin(self, mixin):
arg_names = [arg.strip() for arg in mixin.args.split(",")]
def _mixin(self, args):
if args:
arg_values = self._do_eval(args)
else:
arg_values = []
if not isinstance(arg_values, (list, tuple)):
arg_values = [arg_values]
local_context = dict(zip(arg_names, arg_values))
with local_context_manager(self, local_context):
self.visitBlock(mixin.block)
return _mixin
If arg_values
is a string, then local_context
will map the parameters into the characters of the string instead of the string value.