Formatters

Templater was designed to be extensible. This means that it was designed to scan for parts of the system and include them in runtime.
Formatters are one of the extensible parts of the system. They are designed to add additional formatting functionality and expose it though metadata written in templates.

This can be simple ones like bool(YES/NO/MAYBE) where boolean value will be replaced with YES, NO or MAYBE pattern, or more complicated ones like join(SEPARATOR) where array elements would be joined with SEPARATOR.
They are useful for converting domain model to presentation without doing all the conversions in the domain model.

Where there is some pattern in conversion, like format(PATTERN) or bool(YES/NO), it's useful to create required formatter and use it.
The downside of this approach is that your formatters are leaking into your templates, which can look ugly sometimes. But this is also a strong point, since you don't need Word/Excel add-ons.

Example: Formatters
Template screenshot:
Formatters - before


Result screenshot:
Formatters - after


Back to Features

t