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