std/template/zz

Standard Library documentation

ZZPath-backed template engine.

Module

Name
std/template/zz
Area
Standard Library
Source
modules/std/template/zz.zzm

NAME

std/template/zz - ZZPath-backed template engine.

SYNOPSIS

  from std/template/zz import ZZTemplate;

  let tmpl := new ZZTemplate(
    string: "Hello {{ name ?: \"friend\" }}!",
  );
  say( tmpl.process( { name: "Ada" } ) );

IMPLEMENTATION SUPPORT

This module is supported by zuzu.pl, zuzu-rust, and zuzu-js on Node and Electron. It is partially supported by zuzu-js in the browser: filesystem-backed template loading is unsupported.

DESCRIPTION

std/template/zz provides ZZTemplate, a subclass of std/template/z's ZTemplate which renders template expressions using std/path/zz instead of std/path/z.

The parser, escaping, include handling, and rendering machinery are inherited from ZTemplate.

EXPORTS

Classes

  • ZZTemplate({ string?: String, file?, escape?: String, includes?: Boolean })

    Constructs a template that evaluates expressions with std/path/zz. Returns: ZZTemplate. It inherits process(data) from ZTemplate, which takes a model value and returns rendered String output.

COPYRIGHT AND LICENCE

std/template/zz is copyright Toby Inkster.

It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.