94 |
def handle_use_macro(element, context, value): |
def handle_use_macro(element, context, value): |
95 |
value = getattr(element, 'metal_macro', value) |
value = getattr(element, 'metal_macro', value) |
96 |
macro = context.evaluateMacro(value) |
macro = context.evaluateMacro(value) |
97 |
|
if hasattr(context, 'getDefault') and macro is context.getDefault(): |
98 |
|
return element |
99 |
|
if macro is None: |
100 |
|
return None |
101 |
try: |
try: |
102 |
[a for a in macro.children] |
[a for a in macro.children] |
103 |
except: |
except: |
104 |
raise MetalError, ('trying to use an incompatible object as a macro: ' + |
raise MetalError, ('trying to use an incompatible object as a macro: ' + |
105 |
repr(macro)) |
repr(macro)) |
|
if hasattr(context, 'getDefault') and macro is context.getDefault(): |
|
|
return element |
|
106 |
context.metal_slot_stack[-1] = fish_slots(element) |
context.metal_slot_stack[-1] = fish_slots(element) |
107 |
result = macro.copy() |
result = macro.copy() |
108 |
metal = result.attributes[metal_ns] |
metal = result.attributes[metal_ns] |