You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Airspeed throws an exception if the macro is referenced in the template before it is defined. This works normally in Apache Velocity.
Code example:
importairspeedt=airspeed.Template("""#set($value = 'my test')${instancesuper}#if(!$!{instancesuper})missing end#endValue is '$value'#new_macro('A','B')#macro(new_macro $name $surname)Your name is $name $surname#endTesting macro#new_macro('A','B')"""
)
print(t.merge(locals()))
This throws a following exception:
raise Exception('no such macro: ' + self.macro_name)
airspeed.TemplateExecutionError: Error in template '<string>' at position 102-121 in expression: #new_macro('A','B')
Exception: no such macro: new_macro
The text was updated successfully, but these errors were encountered:
Hmm, I suspect the fix for this could be fiddly. I agree that compatibility would be good here, but I guess it would be fairly trivial to move the macro declaration earlier in the source code in this case.
Sort of. The problem is that the actual macro is massive and we put it in the back so it doesn't cover what the template really does. But I think I can write a piece of code that will put all the macros in front of the execution.
Airspeed throws an exception if the macro is referenced in the template before it is defined. This works normally in Apache Velocity.
Code example:
This throws a following exception:
The text was updated successfully, but these errors were encountered: