CONGA - Custom Handlebars expressions
By using CONGA handlebars helper plugins it is possible to extend handlebars by registering custom expressions. Out of the box CONGA ships with a set of built-in custom expressions documented in this chapter. See Extensibility model how to register you own helpers.
The basic handlebars expressions are documented in the Handlebars quickstart.
You can also use the following helpers provided by handlebars.java:
Additionally, the CONGA AEM plugin provides a set of Custom Handlebars expressions for AEM.
regexQuote
To insert a variable expression and applying regex quoting on it:
{{regexQuote group1.param1}}
ifEquals
Conditional if statement - block is rendered if expression equals to an argument:
{{#ifEquals group1.param1 "myValue"}}
condition met block...
{{/ifEquals}}
ifNotEquals
Conditional if statement - block is rendered if expression unequals to an argument:
{{#ifNotEquals group1.param1 "myValue"}}
condition met block...
{{/ifEquals}}
eachIf
Conditional for each loop - loop is generated if condition is true:
{{#eachIf group1.list "group1.flag1"}},
conditional loop block
{{/eachIf}}
eachIfEquals
Conditional for each loop - loop is generated if expression equals to an argument:
{{#eachIfEquals group1.list "group1.param1" "myValue"}},
conditional loop block
{{/eachIfEquals}}
contains
Checks for presence of a given value in a list:
{{#contains group1.list1 "myValue"}}
condition met block...
{{/contains}}
ensureProperties
Ensure that all properties with the given names are set. Build fails if this is not the case, the exception message contains the missing properties.
{{ensureProperties "group1.prop1" "group1.prop2"}}
disallowProperty
Ensure that the given property is not set/present. It fails with an error message, if it is present. Optionally, a custom error message can be defined via a second parameter.
{{ensureProperties "group1.prop1" "Property 'group1.prop1' is deprecated, please use 'XYZ' instead."}}