Caml on the Web
Module Cow . Html . Create
module Tags : sig ... end
type t = Xml.t
val stylesheet : string -> t

stylesheet style converts a COW CSS type to a valid HTML stylesheet

val table : ?flags:Tags.table_flags list -> row:( 'a -> t list ) -> 'a list -> t

table ~flags:f ~row:r tbl produces an HTML table formatted according to f where each row is generated by passing a member of tbl to r.

  • parameter flags

    a list of type Html.Flags.table_flags specifying how the generated table is to be structured.

  • parameter row

    a function to transform a single row of the input table (a single element of the list, that is) into a list of elements, each of which will occupy a cell in a row of the table.

    tbl: a list of (probably) tuples representing a table.

    See the following example:

    let row = (fun (name,email) -> [ <:html<$str:name$>>; <:html<$str:email$>>]) in
    let data =
      \[ "Name","Email Address";
        "John Christopher McAlpine","christophermcalpine\";
        "Somebody McElthein","johnqpublic\@something.something";
        "John Doe","johndoe\"; \] in
    let table = Html.Create ~flags:[Headings_fst_row] ~row data

    which produces the HTML table

    Name Email Address
    John Christopher McAlpine christophermcalpine\
    Somebody McElthein johnqpublic\@something.something
    John Doe johndoe\