package b0

  1. Overview
  2. Docs

Elements.

Elements

type name = string

The type for element names.

type child

The type for element children. Either textual data or an element or a sequence thereof.

val v : name -> ?a:Att.t list -> child list -> child

v n ~a cs is an element with name n, attributes a (defaults to []) and children cs. It is illegal to specify an attribute name more than once in a except for Att.class' which is treated specially: multiple specifications are gathered to form a single space seperated attribute value for the class attribute.

val txt : string -> child

txt d is character data d.

val splice : child list -> child

splice cs when added to a child list splices cs into the list.

val raw : string -> child

raw s is the raw string s without escaping markup delimiters. This can be used to include foreign markup.

Output

val buffer_add : doc_type:bool -> Buffer.t -> child -> unit

buffer_add ~doc_type b c adds child c (or children if c is a splice) to b. If doc_type is true an HTML doctype declaration is prepended.

val to_string : doc_type:bool -> child -> string

to_string is like buffer_add but returns directly a string.

Predefined element constructors

Convention. Whenever an element name conflicts with an OCaml keyword we prime it, see for example object'.

type cons = ?a:Att.t list -> child list -> child

The type for element constructors. This is simply v with a pre-applied element name.

type void_cons = a:Att.t list -> child

The type for void element constructors. This is simply el with a pre-applied element name and without children.

val a : cons
val abbr : cons
val address : cons
val area : void_cons
val article : cons
val aside : cons
val audio : cons
val b : cons
val base : void_cons
val bdi : cons
val bdo : cons
val blockquote : cons
val body : cons
val br : void_cons
val button : cons
val canvas : cons
val caption : cons
val cite : cons
val code : cons
val col : void_cons
val colgroup : cons
val command : cons
val datalist : cons
val dd : cons
val del : cons
val details : cons
val dfn : cons
val div : cons
val dl : cons
val dt : cons
val em : cons
val embed : void_cons
val fieldset : cons
val figcaption : cons
val figure : cons
val form : cons
val h1 : cons
val h2 : cons
val h3 : cons
val h4 : cons
val h5 : cons
val h6 : cons
val head : cons
val header : cons
val hgroup : cons
val hr : void_cons
val html : cons
val i : cons
val iframe : cons
val img : void_cons
val input : void_cons
val ins : cons
val kbd : cons
val keygen : cons
val label : cons
val legend : cons
val li : cons
val map : cons
val mark : cons
val menu : cons
val meta : void_cons
val meter : cons
val nav : cons
val noscript : cons
val object' : cons
val ol : cons
val optgroup : cons
val option : cons
val output : cons
val p : cons
val param : void_cons
val pre : cons
val progress : cons
val q : cons
val rp : cons
val rt : cons
val ruby : cons
val s : cons
val samp : cons
val script : cons
val section : cons
val select : cons
val small : cons
val source : void_cons
val span : cons
val strong : cons
val style : cons
val sub : cons
val summary : cons
val sup : cons
val table : cons
val tbody : cons
val td : cons
val textarea : cons
val tfoot : cons
val th : cons
val thead : cons
val time : cons
val title : cons
val tr : cons
val track : void_cons
val u : cons
val ul : cons
val var : cons
val video : cons
val wbr : void_cons
OCaml

Innovation. Community. Security.