Library
Module
Module type
Parameter
Class
Class type
Mutable value holding a collection of mappings from names of variables to their values (both being strings).
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.
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
.
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.
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
.