package weberizer

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t

Mutable value holding a collection of mappings from names of variables to their values (both being strings).

exception Not_found of string

Not_found var is raised if the variable var is not found in the binding.

val make : unit -> t

make() returns a new empty collection of bindings.

val copy : t -> t

copy b returns a new collection of bindings initially containing the same bindings as b.

val string : t -> string -> string -> unit

string b var s add to the binding var -> s to b.

val html : t -> string -> html -> unit

html b var h add to the binding var -> h to b.

val fun_html : t -> string -> (< content : html ; page : html > -> string list -> html) -> unit

fun_html b var f add to the binding var -> f to b. At each occurrence of var, f ctx args will be executed and its output will replace current HTML tag (or its content, depending on whether ml:strip was set or not). ctx is an object giving some "context". ctx#content is the html that is inside the tag and which is going to be replaced. It can be used as a structured argument. ctx#page returns the whole HTML page — this can be useful to generate a table of content for example.

val fun_string : t -> string -> (< page : html > -> string list -> string) -> unit

fun_string b var f add to the binding var -> f to b. See fun_html for the arguments of f.

val on_error : t -> (string -> string list -> exn -> unit) -> unit

on_error b f when a function associated to a variable v applied to the arguments a raises an exception e, call f v a e. The default value for f prints an error on stderr.