12 type text (* = string *) |
12 type text (* = string *) |
13 val plain: string -> text |
13 val plain: string -> text |
14 val name: string -> text |
14 val name: string -> text |
15 val keyword: string -> text |
15 val keyword: string -> text |
16 val file_name: string -> text |
16 val file_name: string -> text |
17 val file_path: Path.T -> text |
17 val file_path: Url.T -> text |
18 val href_name: string -> text -> text |
18 val href_name: string -> text -> text |
19 val href_path: Path.T -> text -> text |
19 val href_path: Url.T -> text -> text |
20 val href_opt_name: string option -> text -> text |
20 val href_opt_name: string option -> text -> text |
21 val href_opt_path: Path.T option -> text -> text |
21 val href_opt_path: Url.T option -> text -> text |
22 val para: text -> text |
22 val para: text -> text |
23 val preform: text -> text |
23 val preform: text -> text |
24 val verbatim: string -> text |
24 val verbatim: string -> text |
25 val begin_index: Path.T * string -> Path.T * string -> Path.T option -> text |
25 val begin_index: Url.T * string -> Url.T * string -> Url.T option -> Url.T -> text |
26 val end_index: text |
26 val end_index: text |
27 val theory_entry: Path.T * string -> text |
27 val applet_pages: string -> Url.T -> Url.T * string -> bool -> (string * string) list |
28 val session_entries: (Path.T * string) list -> text |
28 val theory_entry: Url.T * string -> text |
|
29 val session_entries: (Url.T * string) list -> text |
29 val source: (string, 'a) Source.source -> text |
30 val source: (string, 'a) Source.source -> text |
30 val begin_theory: Path.T * string -> string -> (Path.T option * string) list -> |
31 val begin_theory: Url.T * string -> string -> (Url.T option * string) list -> |
31 (Path.T option * Path.T * bool) list -> text -> text |
32 (Url.T option * Url.T * bool) list -> text -> text |
32 val end_theory: text |
33 val end_theory: text |
33 val ml_file: Path.T -> string -> text |
34 val ml_file: Url.T -> string -> text |
34 val theorem: string -> thm -> text |
35 val theorem: string -> thm -> text |
35 val section: string -> text |
36 val section: string -> text |
36 val setup: (theory -> theory) list |
37 val setup: (theory -> theory) list |
37 end; |
38 end; |
38 |
39 |
106 |
107 |
107 val plain = output; |
108 val plain = output; |
108 fun name s = "<i>" ^ output s ^ "</i>"; |
109 fun name s = "<i>" ^ output s ^ "</i>"; |
109 fun keyword s = "<b>" ^ output s ^ "</b>"; |
110 fun keyword s = "<b>" ^ output s ^ "</b>"; |
110 fun file_name s = "<tt>" ^ output s ^ "</tt>"; |
111 fun file_name s = "<tt>" ^ output s ^ "</tt>"; |
111 val file_path = file_name o Path.pack; |
112 val file_path = file_name o Url.pack; |
112 |
113 |
113 |
114 |
114 (* misc *) |
115 (* misc *) |
115 |
116 |
116 fun href_name s txt = "<a href=" ^ quote s ^ ">" ^ txt ^ "</a>"; |
117 fun href_name s txt = "<a href=" ^ quote s ^ ">" ^ txt ^ "</a>"; |
117 fun href_path path txt = href_name (Path.pack path) txt; |
118 fun href_path path txt = href_name (Url.pack path) txt; |
118 |
119 |
119 fun href_opt_name None txt = txt |
120 fun href_opt_name None txt = txt |
120 | href_opt_name (Some s) txt = href_name s txt; |
121 | href_opt_name (Some s) txt = href_name s txt; |
121 |
122 |
122 fun href_opt_path None txt = txt |
123 fun href_opt_path None txt = txt |
144 para (href_path up_path "Up" ^ " to index of " ^ plain up_name); |
145 para (href_path up_path "Up" ^ " to index of " ^ plain up_name); |
145 |
146 |
146 |
147 |
147 (* session index *) |
148 (* session index *) |
148 |
149 |
149 fun begin_index up (index_path, session) opt_readme = |
150 fun begin_index up (index_path, session) opt_readme graph = |
150 begin_document ("Index of " ^ session) ^ up_link up ^ |
151 begin_document ("Index of " ^ session) ^ |
|
152 para ("View " ^ href_path graph "graph" ^ " of theories") ^ up_link up ^ |
151 (case opt_readme of None => "" | Some p => href_path p "README") ^ |
153 (case opt_readme of None => "" | Some p => href_path p "README") ^ |
152 "\n<hr>\n\n<h2>Theories</h2>\n<ul>\n"; |
154 "\n<hr>\n\n<h2>Theories</h2>\n<ul>\n"; |
153 |
155 |
154 val end_index = end_document; |
156 val end_index = end_document; |
|
157 |
|
158 fun choice chs s = space_implode " " (map (fn (s', lnk) => |
|
159 enclose "[" "]" (if s = s' then keyword s' else href_name lnk s')) chs); |
|
160 |
|
161 fun applet_pages session codebase up alt_graph = |
|
162 let |
|
163 val choices = [("none", "small", "small.html"), |
|
164 ("none", "medium", "medium.html"), |
|
165 ("none", "large", "large.html"), |
|
166 ("all", "small", "small_all.html"), |
|
167 ("all", "medium", "medium_all.html"), |
|
168 ("all", "large", "large_all.html")]; |
|
169 |
|
170 val sizes = [("small", ("500", "400")), |
|
171 ("medium", ("650", "520")), |
|
172 ("large", ("800", "640"))]; |
|
173 |
|
174 fun applet_page (gtype, size, name) = |
|
175 let val (Some (width, height)) = assoc (sizes, size) |
|
176 in (name, begin_document ("Theory dependencies of " ^ session) ^ |
|
177 (if alt_graph then |
|
178 para ("View subsessions: " ^ |
|
179 choice (map (fn (x, _, z) => (x, z)) (filter (fn (_, y, _) => y = size) choices)) gtype) |
|
180 else "") ^ |
|
181 para ("Browser size: " ^ |
|
182 choice (map (fn (_, y, z) => (y, z)) (filter (fn (x, _, _) => x = gtype) choices)) size) ^ |
|
183 up_link up ^ "\n<hr>\n<applet code=\"GraphBrowser/GraphBrowser.class\" \ |
|
184 \codebase=\"" ^ Url.pack codebase ^ "\" width=" ^ width ^ " height=" ^ height ^ ">\n\ |
|
185 \<param name=\"graphfile\" value=\"" ^ |
|
186 (if gtype = "all" then "all_sessions.graph" else "session.graph") ^ "\">\n\ |
|
187 \</applet>\n<hr>" ^ end_document) |
|
188 end; |
|
189 |
|
190 in |
|
191 map applet_page (take (if alt_graph then 6 else 3, choices)) |
|
192 end; |
155 |
193 |
156 fun entry (p, s) = "<li>" ^ href_path p (plain s) ^ "\n"; |
194 fun entry (p, s) = "<li>" ^ href_path p (plain s) ^ "\n"; |
157 |
195 |
158 val theory_entry = entry; |
196 val theory_entry = entry; |
159 |
197 |