Mustache

Renders content as a Mustache template with context as data source/model.

Example

YAML specification

mustache: 'Hello, {{name}}!'

The above specification uses an in-line template. Templates can also be loaded from resources or other sources, e.g. by making an HTTP call, e.g.:

mustache: 
    resource: https://nasdanika.org/hello-mustache-template.txt

Java code

ObjectLoader loader = new Loader();
ProgressMonitor monitor = new PrintStreamProgressMonitor(System.out, 0, 4, false);
Object mustache = loader.loadYaml(specURL, monitor);
		
Context context = Context.singleton("name", "World");		
		
InputStream result = callSupplier(context, monitor, mustache);
assertEquals("Hello, World!", Util.toString(context, result));