]> matita.cs.unibo.it Git - helm.git/blob - helm/www/lambdadelta/bin/xhtbl/table.ml
- we begin the new site based on ld_web
[helm.git] / helm / www / lambdadelta / bin / xhtbl / table.ml
1 type css = string list
2
3 type size = {
4    y : int;         (* first row *)
5    x : int;         (* first column *)
6    rf: int;         (* finite rows *)
7    cf: int;         (* finite columns *)
8    ri: int;         (* infinite rows *)
9    ci: int;         (* infinite columns *)
10    p : bool option; (* parent kind *)
11 }
12
13 type border = {
14    n: bool; (* north *)
15    s: bool; (* south *)
16    e: bool; (* east *)
17    w: bool; (* west *)
18 }
19
20 type text = Plain of string
21           | Link of string * string
22
23 type key = Text of text list
24          | Glue of int option
25
26 type table = {
27    mutable tc: css;    (* css classes *)
28    mutable ts: size;   (* dimension *)
29            tb: border; (* border *)
30            te: entry;  (* contents *)
31            ti: int;    (* table identifier *)
32 }
33
34 and entry = Key  of key
35           | Line of bool * table list (* true for a row *)
36
37 let id =
38    let current = ref 0 in
39    fun () -> incr current; !current
40
41 let no_size = {
42    y = 0; x = 0; rf = 0; cf = 0; ri = 0; ci = 0; p = None;
43 }
44
45 let border b = {
46    n = b; s = b; e = b; w = b;
47 }
48
49 let mk_key k tc = {
50    ts = no_size; tb = border false; te = Key k; tc = tc;
51    ti = id ();
52 }
53
54 let mk_line b tl tc = {
55    ts = no_size; tb = border b; te = Line (b, tl); tc = tc;
56    ti = id ();
57 }