Module Htmlg.El
Elements.
Elements
val v : name -> ?a:Att.t list -> child list -> child
v n ~a cs
is an element with namen
, attributesa
(defaults to[]
) and childrencs
. It is illegal to specify an attribute name more than once ina
except forAtt.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 datad
.
val raw : string -> child
raw s
is the raw strings
without escaping markup delimiters. This can be used to include foreign markup.
Output
val buffer_add : doc_type:bool -> Stdlib.Buffer.t -> child -> unit
buffer_add ~doc_type b c
adds childc
(or children ifc
is asplice
) tob
. Ifdoc_type
istrue
an HTML doctype declaration is prepended.
val to_string : doc_type:bool -> child -> string
to_string
is likebuffer_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 blockquote : cons
val figcaption : cons