Esc

html

procedureextensionexperimentalsince 0.36.1Source
  • macOS: html works on macOS
  • Linux: html works on Linux
  • Windows: html works on Windows
  • Wasm: html is not available on Wasm

Compiles a constant template in the caller's scope. The first argument must be an identifier or *identifier; its name need not be out. Components start with uppercase. Control branches must finish in the same HTML state; loops preserve their entry state.

Signature

html :: (destination: *Out, $t: string, loc := #caller_code)
Example
Card :: (dest: *Out, title: string) {
    html(dest, "<p>{title}</p>");
}
out: Out;
defer deinit(*out);
html(*out, "<main>{Card(\"Hi\")}</main>");
assert(to_string(*out) == "<main><p>Hi</p></main>");

See also