erb

Template Engine

Functions

FunctionDescription
_erb_copy
_erb_streq
erb_vars_newCreate variable map.
erb_vars_setSet a variable in the map.
_erb_lookupInternal: lookup variable value. Returns value length, copies to out.
erb_renderRender template with variable substitution. Replaces <%= name %> with variabl…
erb_escape_htmlHTML-escape string (&, <, >, “, ‘). Returns output length.

Details

_erb_copy

fn _erb_copy(dst: &i8, doff: i64, src: &i8, soff: i64, n: i64)

_erb_streq

fn _erb_streq(a: &i8, aoff: i64, alen: i64, b: &i8, boff: i64, blen: i64) -> i64

erb_vars_new

fn erb_vars_new() -> &i64

Create variable map.

erb_vars_set

fn erb_vars_set(vars: &i64, key: &i8, klen: i64, val: &i8, vlen: i64)

Set a variable in the map.

_erb_lookup

fn _erb_lookup(vars: &i64, name: &i8, noff: i64, nlen: i64, out: &i8) -> i64

Internal: lookup variable value. Returns value length, copies to out.

erb_render

fn erb_render(tmpl: &i8, tlen: i64, vars: &i64, out: &i8, max: i64) -> i64

Render template with variable substitution. Replaces <%= name %> with variable value from vars map. Returns output length.

erb_escape_html

fn erb_escape_html(src: &i8, slen: i64, out: &i8) -> i64

HTML-escape string (&, <, >, “, ‘). Returns output length.