9 i: int; (* indentation *)
10 out: string -> unit; (* output function *)
14 i = 0; out = print_string
20 let add st = {st with i = st.i + 3}
22 let sub st = {st with i = st.i - 3}
30 P.sprintf "(%u, %u); (%u+%u, %u+%u); %s"
31 ts.T.y ts.T.x ts.T.rf ts.T.ri ts.T.cf ts.T.ci (parent ts.T.p)
34 let str = S.make 4 ' ' in
35 if tb.T.w then str.[0] <- 'W';
36 if tb.T.n then str.[1] <- 'N';
37 if tb.T.e then str.[2] <- 'E';
38 if tb.T.s then str.[3] <- 'S';
42 P.sprintf "\"%s\"" (S.concat " " tc)
45 P.sprintf "@\"%s\" \"%s\"" tu tx
48 P.sprintf "$\"%s\"" tn
52 | T.Plain s -> P.sprintf "\"%s\"" s
53 | T.Link (true, uri, s) -> P.sprintf "@(\"%s\" \"%s\")" uri s
54 | T.Link (false, uri, s) -> P.sprintf "@@(\"%s\" \"%s\")" uri s
57 | T.Text sl -> S.concat " ^ " (L.map text sl)
59 | T.Glue (Some i) -> P.sprintf "%u" i
65 (****************************************************************************)
69 P.sprintf "%s[{#%u: %s; %s; %s; %s; %s}\n"
70 (indent st) t.T.ti (size t.T.ts) (border t.T.tb) (css t.T.tc) (uri t.T.tu t.T.tx) (name t.T.tn)
74 let close_table st t =
76 let str = P.sprintf "%s]\n" (indent st) in
80 let str = P.sprintf "%s%s\n" (indent st) (key k) in
84 let str = P.sprintf "%s%s\n" (indent st) (entry b) in
87 let close_line b st = st
89 let open_entry b st = st
91 let close_entry b st sst = st
94 F.open_table = open_table; F.close_table = close_table;
95 F.open_line = open_line; F.close_line = close_line;
96 F.open_entry = open_entry; F.close_entry = close_entry;
101 let _ = F.fold_table cb home t in ()