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
Consider supporting function declarations inside imported files in templates.
Use case
This is useful in all cases where an imported file, which contains macro declarations, needs to use a function written in Go. Currently the only way seems to be to declare a function literal inside a multiline statement in the macro, and this, in addition to being visually heavy and confusing, prevents the use of that function in other macros in the same file.
Possible syntax
A possible syntax could be that of the multiline statement with a func declaration inside as: {%% func F(...) { ... } %%}. Obviously this should be at the top level in the file.
Consequences on extend
Check whether this change can have consequences (desirable or not) also on the functioning of the extend, in addition to the import. This needs to be explored in more detail.
The text was updated successfully, but these errors were encountered:
Description
Consider supporting function declarations inside imported files in templates.
Use case
This is useful in all cases where an imported file, which contains macro declarations, needs to use a function written in Go. Currently the only way seems to be to declare a function literal inside a multiline statement in the macro, and this, in addition to being visually heavy and confusing, prevents the use of that function in other macros in the same file.
Possible syntax
A possible syntax could be that of the multiline statement with a
func
declaration inside as:{%% func F(...) { ... } %%}
. Obviously this should be at the top level in the file.Consequences on extend
Check whether this change can have consequences (desirable or not) also on the functioning of the extend, in addition to the import. This needs to be explored in more detail.
The text was updated successfully, but these errors were encountered: