Macros

Elephant renders macros each time a page is requested. Macros start with {@ special characters and expand into text or HTML code. Macros can even include content from a file, HTML page or JSP page. In order to understand what macros are for see what current macros do:

Macros can be nested, but take in mind that macros are written inline, in order to allow content inclusions. Thus, only macros that resolve to a string could be nested. Ex.

{@equals:{@user:id}:admin:Administering:Browsing}

To escape the : character prepend a slash, like /:.

Next generation

The next generation of macros provide a great number of features, aiming to easy-of-use customization. The main goals are:

  • Order agnostic parameters. Parameters can be specified by name, in any order.
  • Significant decrement of macro names. Using the order agnostic parameters, a single macro can offer more options.
  • Easy escaping characters. Escape values enclose it in brackets, ex. name=[values] or [values].
  • Single parser, multiple processors. Relaxes complexity on macro processors, by parsing parameter tuples.
  • Improved fail detection. Parser detects macro existence before fully interpreting the content.
  • Better backward compatibility. While using named parameters, macro changes won't break previous code.
  • Error feedback. None interpretable macros will be rendered in red and failure will be logged in the system.
  • Empty result default. Empty results can show a value using the system-wide parameter void.
  • Fully nested macros. Macros can be nested, in order to provide values, macro names or the empty default.

Next generation macros are expressed as @{macro_name}.

Backward compatibility

For compatibility reasons, next generation macros will be included at the end of each macro definition. Both macro types can be used in the same content, even combined.

Printer version
English06/08/11 18:00Lluís Turró Cutiller
English09/23/11 13:42Lluís Turró Cutiller
English08/20/13 10:20Lluís Turró Cutiller
English01/08/18 10:40Lluís Turró Cutiller
English10/24/22 17:21Lluís Turró Cutiller