Discussion:
[FreeMarker-user] List all macros defined in an ftl
Albert Kam
2015-08-23 03:31:52 UTC
Permalink
This might sound strange, but i need a mechanism to list all macro names
available in an ftl file.

I wonder whether this is possible to avoid having to list it manually
somewhere and have duplication of maintenance for the list of macro names
and the actual macros.
--
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)
Daniel Dekany
2015-08-23 11:50:50 UTC
Permalink
You could use Template.getMacros().keys() for that. Yeah, it's
deprecated, but that's because of the Map values it exposes, not the
keys, and because it doesn't block modifying that map... you just need
the keys. And it's still there in 2.4.
This might sound strange, but i need a mechanism to list all macro names available in an ftl file.
I wonder whether this is possible to avoid having to list it
manually somewhere and have duplication of maintenance for the list
of macro names and the actual macros.
--
Thanks,
Daniel Dekany


------------------------------------------------------------------------------
Loading...