1 (* Copyright (C) 2000, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://cs.unibo.it/helm/.
26 (*************************************************************************)
30 (* Andrea Asperti <asperti@cs.unibo.it> *)
33 (*************************************************************************)
40 | H of attr * ('expr box) list
41 | V of attr * ('expr box) list
42 | Object of attr * 'expr
43 | Action of attr * ('expr box) list
45 and attr = (string option * string * string) list
47 let smallskip = Space([None,"width","0.5em"]);;
48 let skip = Space([None,"width","1em"]);;
50 let indent t = H([],[skip;t]);;
58 Text (attr,s) -> X.xml_nempty ~prefix "text" attr (X.xml_cdata s)
59 | Space attr -> X.xml_empty ~prefix "space" attr
60 | Ink attr -> X.xml_empty ~prefix "ink" attr
62 X.xml_nempty ~prefix "h" attr
63 [< (List.fold_right (fun x i -> [< (print_box x) ; i >]) l [<>])
66 X.xml_nempty ~prefix "v" attr
67 [< (List.fold_right (fun x i -> [< (print_box x) ; i >]) l [<>])
70 X.xml_nempty ~prefix "obj" attr [< Mpresentation.print_mpres m >]
72 X.xml_nempty ~prefix "action" attr
73 [< (List.fold_right (fun x i -> [< (print_box x) ; i >]) l [<>])
77 let document_of_box pres =
78 [< Xml.xml_cdata "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ;
80 Xml.xml_nempty ~prefix "box"
81 [Some "xmlns","m","http://www.w3.org/1998/Math/MathML" ;
82 Some "xmlns","b","http://helm.cs.unibo.it/2003/BoxML" ;
83 Some "xmlns","helm","http://www.cs.unibo.it/helm" ;
84 Some "xmlns","xlink","http://www.w3.org/1999/xlink"
90 let b_text a b = Text(a,b)
91 let b_object b = Object ([],b)
93 let b_space = Space [None, "width", "0.5em"]
94 let b_kw = b_text [None, "color", "red"]