Contents

Trunklet-format

Jim C. Nasby <Jim.Nasby@BlueTreble.com> v0.0.1, January 2015: :toc: :toclevels: 3 :numbered: Trunklet is an extensible templating system for Postgres. It supports storing templates to be used later, as well as creating new templating languages.

Trunklet-format is a template language for trunklet that is based on the Postgres format() function. The largest difference is that trunklet-format allows for naming variables/parameters, which makes it much easier to work with for large/complex templates.

Table of Contents

Trunklet allows many options for dealing with templates. The most relevant ones are shown below. Full documentation on trunklet can be found here.

Trunklet-format templates use the same general rules as the format() function, except that parameters in the template are named and positions are not supported. Currently widths are not supported either; they are a TODO. The specification is:

%parameter_name%type

parameter_name can be any string, but may not contain a line break or a %.

type must be one of s, I or L. They operate as specified in the format() documentation.

Parameters are specified as a JSON object containing key/value pairs. (Eventually it may accept an array of pairs). The JSON type for each value must be string, number, boolean or null. The value of each key will be cast to text, formatted via format() and then used to replace each occurrence of the parameter in the template.

Copyright (c) 2015 Jim C. Nasby.