[Lazarus] Mustache templates implementation

Michael Van Canneyt michael at freepascal.org
Tue Apr 20 14:20:34 CEST 2021


Hello ,

For my job I needed a Mustache templates library in pascal.

Since dmustache (part of mORMot) fails the official mustache tests and did not work
on the platform I needed it for, I wrote my own implementation.

The result has been committed to packages/fcl-mustache, in case someone else
has a need for it.

Basic Features:
- TMustache Component, can be dropped on a form.
- Compiles the template, so repeated output should be fast.
- Passes all official testcases (including weird whitespace rules).
- JSON data input by default.
- Output easily configurable.

Extra:
- Integration with FPExprPars engine for expressions: {{[age + 2]}} will work.
- You can use datasets as source of data.
- Written to be easily extendable with other features.
- Unit tested.

Demos available, there is a complete usable command-line program that has all features
enabled.

Enjoy,

Michael.


More information about the lazarus mailing list