| author | wenzelm |
| Thu, 28 Mar 2013 14:01:56 +0100 | |
| changeset 51567 | a86c5e02ba58 |
| parent 51399 | 6ac3c29a300e |
| child 53021 | d0fa3f446b9d |
| permissions | -rw-r--r-- |
| 24584 | 1 |
(* Title: Pure/Thy/html.ML |
| 9415 | 2 |
Author: Markus Wenzel and Stefan Berghofer, TU Muenchen |
| 6324 | 3 |
|
| 9415 | 4 |
HTML presentation elements. |
| 6324 | 5 |
*) |
6 |
||
7 |
signature HTML = |
|
8 |
sig |
|
| 23724 | 9 |
val html_mode: ('a -> 'b) -> 'a -> 'b
|
| 23622 | 10 |
type text = string |
| 6324 | 11 |
val plain: string -> text |
12 |
val name: string -> text |
|
13 |
val keyword: string -> text |
|
| 23622 | 14 |
val command: string -> text |
| 6324 | 15 |
val file_name: string -> text |
| 6649 | 16 |
val file_path: Url.T -> text |
| 6324 | 17 |
val href_name: string -> text -> text |
| 6649 | 18 |
val href_path: Url.T -> text -> text |
19 |
val href_opt_path: Url.T option -> text -> text |
|
| 6376 | 20 |
val para: text -> text |
| 6324 | 21 |
val preform: text -> text |
22 |
val verbatim: string -> text |
|
| 23724 | 23 |
val begin_document: string -> text |
24 |
val end_document: text |
|
|
51399
6ac3c29a300e
discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents:
50233
diff
changeset
|
25 |
val begin_session_index: string -> (Url.T * string) list -> Url.T -> text |
| 9415 | 26 |
val applet_pages: string -> Url.T * string -> (string * string) list |
| 6649 | 27 |
val theory_entry: Url.T * string -> text |
|
27861
911bf8e58c4c
removed obsolete verbatim_source, results, chapter, section etc.;
wenzelm
parents:
27832
diff
changeset
|
28 |
val theory_source: text -> text |
|
51399
6ac3c29a300e
discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents:
50233
diff
changeset
|
29 |
val begin_theory: string -> (Url.T option * string) list -> |
| 27490 | 30 |
(Url.T * Url.T * bool) list -> text -> text |
|
37940
4857eab31298
generic external source files -- nothing special about ML here;
wenzelm
parents:
37146
diff
changeset
|
31 |
val external_file: Url.T -> string -> text |
| 6324 | 32 |
end; |
33 |
||
34 |
structure HTML: HTML = |
|
35 |
struct |
|
36 |
||
37 |
||
38 |
(** HTML print modes **) |
|
39 |
||
40 |
(* mode *) |
|
41 |
||
42 |
val htmlN = "HTML"; |
|
|
37146
f652333bbf8e
renamed structure PrintMode to Print_Mode, keeping the old name as legacy alias for some time;
wenzelm
parents:
34003
diff
changeset
|
43 |
fun html_mode f x = Print_Mode.with_modes [htmlN] f x; |
| 6324 | 44 |
|
45 |
||
| 33985 | 46 |
(* common markup *) |
47 |
||
48 |
fun span class = ("<span class=" ^ quote (XML.text class) ^ ">", "</span>");
|
|
49 |
||
|
46866
b190913c3c41
simplified span class in conformance to Scala version;
wenzelm
parents:
45666
diff
changeset
|
50 |
val _ = Markup.add_mode htmlN (span o fst); |
| 33985 | 51 |
|
52 |
||
| 6324 | 53 |
(* symbol output *) |
54 |
||
| 6338 | 55 |
local |
|
50201
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
wenzelm
parents:
48670
diff
changeset
|
56 |
val hidden = span Markup.hiddenN |-> enclose; |
| 33985 | 57 |
|
|
43592
e67d104c0c50
HTML: render control symbols more like Isabelle/Scala/jEdit;
wenzelm
parents:
43548
diff
changeset
|
58 |
(* FIXME proper unicode -- produced on Scala side *) |
| 16196 | 59 |
val html_syms = Symtab.make |
|
34003
610e41138486
output_syms: permissive treatment of control symbols, cf. Scala version;
wenzelm
parents:
33986
diff
changeset
|
60 |
[("", (0, "")),
|
|
610e41138486
output_syms: permissive treatment of control symbols, cf. Scala version;
wenzelm
parents:
33986
diff
changeset
|
61 |
("\n", (0, "<br/>")),
|
|
33986
041dc6d8d344
output linefeed as </br> -- workaround problem with <pre> in Lobo Browser 0.98.4;
wenzelm
parents:
33985
diff
changeset
|
62 |
("'", (1, "'")),
|
| 23622 | 63 |
("\\<exclamdown>", (1, "¡")),
|
64 |
("\\<cent>", (1, "¢")),
|
|
65 |
("\\<pounds>", (1, "£")),
|
|
66 |
("\\<currency>", (1, "¤")),
|
|
67 |
("\\<yen>", (1, "¥")),
|
|
68 |
("\\<bar>", (1, "¦")),
|
|
69 |
("\\<section>", (1, "§")),
|
|
70 |
("\\<dieresis>", (1, "¨")),
|
|
71 |
("\\<copyright>", (1, "©")),
|
|
72 |
("\\<ordfeminine>", (1, "ª")),
|
|
73 |
("\\<guillemotleft>", (1, "«")),
|
|
74 |
("\\<not>", (1, "¬")),
|
|
75 |
("\\<hyphen>", (1, "­")),
|
|
76 |
("\\<registered>", (1, "®")),
|
|
77 |
("\\<inverse>", (1, "¯")),
|
|
78 |
("\\<degree>", (1, "°")),
|
|
79 |
("\\<plusminus>", (1, "±")),
|
|
80 |
("\\<twosuperior>", (1, "²")),
|
|
81 |
("\\<threesuperior>", (1, "³")),
|
|
82 |
("\\<acute>", (1, "´")),
|
|
83 |
("\\<paragraph>", (1, "¶")),
|
|
84 |
("\\<cdot>", (1, "·")),
|
|
85 |
("\\<cedilla>", (1, "¸")),
|
|
86 |
("\\<onesuperior>", (1, "¹")),
|
|
87 |
("\\<ordmasculine>", (1, "º")),
|
|
88 |
("\\<guillemotright>", (1, "»")),
|
|
89 |
("\\<onequarter>", (1, "¼")),
|
|
90 |
("\\<onehalf>", (1, "½")),
|
|
91 |
("\\<threequarters>", (1, "¾")),
|
|
92 |
("\\<questiondown>", (1, "¿")),
|
|
93 |
("\\<times>", (1, "×")),
|
|
94 |
("\\<div>", (1, "÷")),
|
|
95 |
("\\<circ>", (1, "o")),
|
|
96 |
("\\<Alpha>", (1, "Α")),
|
|
97 |
("\\<Beta>", (1, "Β")),
|
|
98 |
("\\<Gamma>", (1, "Γ")),
|
|
99 |
("\\<Delta>", (1, "Δ")),
|
|
100 |
("\\<Epsilon>", (1, "Ε")),
|
|
101 |
("\\<Zeta>", (1, "Ζ")),
|
|
102 |
("\\<Eta>", (1, "Η")),
|
|
103 |
("\\<Theta>", (1, "Θ")),
|
|
104 |
("\\<Iota>", (1, "Ι")),
|
|
105 |
("\\<Kappa>", (1, "Κ")),
|
|
106 |
("\\<Lambda>", (1, "Λ")),
|
|
107 |
("\\<Mu>", (1, "Μ")),
|
|
108 |
("\\<Nu>", (1, "Ν")),
|
|
109 |
("\\<Xi>", (1, "Ξ")),
|
|
110 |
("\\<Omicron>", (1, "Ο")),
|
|
111 |
("\\<Pi>", (1, "Π")),
|
|
112 |
("\\<Rho>", (1, "Ρ")),
|
|
113 |
("\\<Sigma>", (1, "Σ")),
|
|
114 |
("\\<Tau>", (1, "Τ")),
|
|
115 |
("\\<Upsilon>", (1, "Υ")),
|
|
116 |
("\\<Phi>", (1, "Φ")),
|
|
117 |
("\\<Chi>", (1, "Χ")),
|
|
118 |
("\\<Psi>", (1, "Ψ")),
|
|
119 |
("\\<Omega>", (1, "Ω")),
|
|
120 |
("\\<alpha>", (1, "α")),
|
|
121 |
("\\<beta>", (1, "β")),
|
|
122 |
("\\<gamma>", (1, "γ")),
|
|
123 |
("\\<delta>", (1, "δ")),
|
|
124 |
("\\<epsilon>", (1, "ε")),
|
|
125 |
("\\<zeta>", (1, "ζ")),
|
|
126 |
("\\<eta>", (1, "η")),
|
|
127 |
("\\<theta>", (1, "ϑ")),
|
|
128 |
("\\<iota>", (1, "ι")),
|
|
129 |
("\\<kappa>", (1, "κ")),
|
|
130 |
("\\<lambda>", (1, "λ")),
|
|
131 |
("\\<mu>", (1, "μ")),
|
|
132 |
("\\<nu>", (1, "ν")),
|
|
133 |
("\\<xi>", (1, "ξ")),
|
|
134 |
("\\<omicron>", (1, "ο")),
|
|
135 |
("\\<pi>", (1, "π")),
|
|
136 |
("\\<rho>", (1, "ρ")),
|
|
137 |
("\\<sigma>", (1, "σ")),
|
|
138 |
("\\<tau>", (1, "τ")),
|
|
139 |
("\\<upsilon>", (1, "υ")),
|
|
140 |
("\\<phi>", (1, "φ")),
|
|
141 |
("\\<chi>", (1, "χ")),
|
|
142 |
("\\<psi>", (1, "ψ")),
|
|
143 |
("\\<omega>", (1, "ω")),
|
|
144 |
("\\<bullet>", (1, "•")),
|
|
145 |
("\\<dots>", (1, "…")),
|
|
146 |
("\\<wp>", (1, "℘")),
|
|
147 |
("\\<forall>", (1, "∀")),
|
|
148 |
("\\<partial>", (1, "∂")),
|
|
149 |
("\\<exists>", (1, "∃")),
|
|
150 |
("\\<emptyset>", (1, "∅")),
|
|
151 |
("\\<nabla>", (1, "∇")),
|
|
152 |
("\\<in>", (1, "∈")),
|
|
153 |
("\\<notin>", (1, "∉")),
|
|
154 |
("\\<Prod>", (1, "∏")),
|
|
155 |
("\\<Sum>", (1, "∑")),
|
|
156 |
("\\<star>", (1, "∗")),
|
|
157 |
("\\<propto>", (1, "∝")),
|
|
158 |
("\\<infinity>", (1, "∞")),
|
|
159 |
("\\<angle>", (1, "∠")),
|
|
160 |
("\\<and>", (1, "∧")),
|
|
161 |
("\\<or>", (1, "∨")),
|
|
162 |
("\\<inter>", (1, "∩")),
|
|
163 |
("\\<union>", (1, "∪")),
|
|
164 |
("\\<sim>", (1, "∼")),
|
|
165 |
("\\<cong>", (1, "≅")),
|
|
166 |
("\\<approx>", (1, "≈")),
|
|
167 |
("\\<noteq>", (1, "≠")),
|
|
168 |
("\\<equiv>", (1, "≡")),
|
|
169 |
("\\<le>", (1, "≤")),
|
|
170 |
("\\<ge>", (1, "≥")),
|
|
171 |
("\\<subset>", (1, "⊂")),
|
|
172 |
("\\<supset>", (1, "⊃")),
|
|
173 |
("\\<subseteq>", (1, "⊆")),
|
|
174 |
("\\<supseteq>", (1, "⊇")),
|
|
175 |
("\\<oplus>", (1, "⊕")),
|
|
176 |
("\\<otimes>", (1, "⊗")),
|
|
177 |
("\\<bottom>", (1, "⊥")),
|
|
178 |
("\\<lceil>", (1, "⌈")),
|
|
179 |
("\\<rceil>", (1, "⌉")),
|
|
180 |
("\\<lfloor>", (1, "⌊")),
|
|
181 |
("\\<rfloor>", (1, "⌋")),
|
|
182 |
("\\<langle>", (1, "⟨")),
|
|
183 |
("\\<rangle>", (1, "⟩")),
|
|
184 |
("\\<lozenge>", (1, "◊")),
|
|
185 |
("\\<spadesuit>", (1, "♠")),
|
|
186 |
("\\<clubsuit>", (1, "♣")),
|
|
187 |
("\\<heartsuit>", (1, "♥")),
|
|
188 |
("\\<diamondsuit>", (1, "♦")),
|
|
189 |
("\\<lbrakk>", (2, "[|")),
|
|
190 |
("\\<rbrakk>", (2, "|]")),
|
|
191 |
("\\<Longrightarrow>", (3, "==>")),
|
|
192 |
("\\<Rightarrow>", (2, "=>")),
|
|
193 |
("\\<And>", (2, "!!")),
|
|
194 |
("\\<Colon>", (2, "::")),
|
|
195 |
("\\<lparr>", (2, "(|")),
|
|
196 |
("\\<rparr>", (2, "|)),")),
|
|
197 |
("\\<longleftrightarrow>", (3, "<->")),
|
|
198 |
("\\<longrightarrow>", (3, "-->")),
|
|
199 |
("\\<rightarrow>", (2, "->")),
|
|
|
43592
e67d104c0c50
HTML: render control symbols more like Isabelle/Scala/jEdit;
wenzelm
parents:
43548
diff
changeset
|
200 |
("\\<^bsub>", (0, hidden "⇘" ^ "<sub>")),
|
|
e67d104c0c50
HTML: render control symbols more like Isabelle/Scala/jEdit;
wenzelm
parents:
43548
diff
changeset
|
201 |
("\\<^esub>", (0, hidden "⇙" ^ "</sub>")),
|
|
e67d104c0c50
HTML: render control symbols more like Isabelle/Scala/jEdit;
wenzelm
parents:
43548
diff
changeset
|
202 |
("\\<^bsup>", (0, hidden "⇗" ^ "<sup>")),
|
|
e67d104c0c50
HTML: render control symbols more like Isabelle/Scala/jEdit;
wenzelm
parents:
43548
diff
changeset
|
203 |
("\\<^esup>", (0, hidden "⇖" ^ "</sup>"))];
|
| 17178 | 204 |
|
| 16196 | 205 |
fun output_sym s = |
| 23622 | 206 |
if Symbol.is_raw s then (1, Symbol.decode_raw s) |
| 20742 | 207 |
else |
|
33983
cfbf1ff6170d
output "'" as "'" which is a bit more portable ("'" is defined in XML/XHTML, but not in old-style HTML4);
wenzelm
parents:
33222
diff
changeset
|
208 |
(case Symtab.lookup html_syms s of |
|
cfbf1ff6170d
output "'" as "'" which is a bit more portable ("'" is defined in XML/XHTML, but not in old-style HTML4);
wenzelm
parents:
33222
diff
changeset
|
209 |
SOME x => x |
| 26709 | 210 |
| NONE => (size s, XML.text s)); |
| 6324 | 211 |
|
| 33985 | 212 |
fun output_markup (bg, en) s1 s2 = |
213 |
let val (n, txt) = output_sym s2 |
|
214 |
in (n, hidden s1 ^ enclose bg en txt) end; |
|
| 14534 | 215 |
|
| 33985 | 216 |
val output_sub = output_markup ("<sub>", "</sub>");
|
217 |
val output_sup = output_markup ("<sup>", "</sup>");
|
|
218 |
val output_bold = output_markup (span "bold"); |
|
219 |
||
| 41482 | 220 |
fun output_syms [] (result, width) = (implode (rev result), width) |
221 |
| output_syms (s1 :: rest) (result, width) = |
|
222 |
let |
|
223 |
val (s2, ss) = (case rest of [] => ("", []) | s2 :: ss => (s2, ss));
|
|
224 |
val ((w, s), r) = |
|
|
43592
e67d104c0c50
HTML: render control symbols more like Isabelle/Scala/jEdit;
wenzelm
parents:
43548
diff
changeset
|
225 |
if s1 = "\\<^sub>" then (output_sub "⇩" s2, ss) |
|
e67d104c0c50
HTML: render control symbols more like Isabelle/Scala/jEdit;
wenzelm
parents:
43548
diff
changeset
|
226 |
else if s1 = "\\<^isub>" then (output_sub "⇣" s2, ss) |
|
e67d104c0c50
HTML: render control symbols more like Isabelle/Scala/jEdit;
wenzelm
parents:
43548
diff
changeset
|
227 |
else if s1 = "\\<^sup>" then (output_sup "⇧" s2, ss) |
|
e67d104c0c50
HTML: render control symbols more like Isabelle/Scala/jEdit;
wenzelm
parents:
43548
diff
changeset
|
228 |
else if s1 = "\\<^isup>" then (output_sup "⇡" s2, ss) |
|
e67d104c0c50
HTML: render control symbols more like Isabelle/Scala/jEdit;
wenzelm
parents:
43548
diff
changeset
|
229 |
else if s1 = "\\<^bold>" then (output_bold "❙" s2, ss) |
| 41482 | 230 |
else (output_sym s1, rest); |
231 |
in output_syms r (s :: result, width + w) end; |
|
| 6338 | 232 |
in |
| 6324 | 233 |
|
| 41482 | 234 |
fun output_width str = output_syms (Symbol.explode str) ([], 0); |
| 6338 | 235 |
val output = #1 o output_width; |
236 |
||
| 26709 | 237 |
val _ = Output.add_mode htmlN output_width Symbol.encode_raw; |
238 |
||
| 6338 | 239 |
end; |
240 |
||
| 6324 | 241 |
|
242 |
||
243 |
(** HTML markup **) |
|
244 |
||
245 |
type text = string; |
|
246 |
||
247 |
||
248 |
(* atoms *) |
|
249 |
||
250 |
val plain = output; |
|
| 19265 | 251 |
val name = enclose "<span class=\"name\">" "</span>" o output; |
252 |
val keyword = enclose "<span class=\"keyword\">" "</span>" o output; |
|
| 23622 | 253 |
val command = enclose "<span class=\"command\">" "</span>" o output; |
| 19265 | 254 |
val file_name = enclose "<span class=\"filename\">" "</span>" o output; |
|
21858
05f57309170c
avoid conflict with Alice keywords: renamed pack -> implode, unpack -> explode, any -> many, avoided assert;
wenzelm
parents:
20742
diff
changeset
|
255 |
val file_path = file_name o Url.implode; |
| 6324 | 256 |
|
257 |
||
258 |
(* misc *) |
|
259 |
||
| 28840 | 260 |
fun href_name s txt = "<a href=" ^ quote s ^ ">" ^ txt ^ "</a>"; |
|
21858
05f57309170c
avoid conflict with Alice keywords: renamed pack -> implode, unpack -> explode, any -> many, avoided assert;
wenzelm
parents:
20742
diff
changeset
|
261 |
fun href_path path txt = href_name (Url.implode path) txt; |
| 6376 | 262 |
|
| 15531 | 263 |
fun href_opt_path NONE txt = txt |
264 |
| href_opt_path (SOME p) txt = href_path p txt; |
|
| 6376 | 265 |
|
| 12413 | 266 |
fun para txt = "\n<p>" ^ txt ^ "</p>\n"; |
| 27830 | 267 |
fun preform txt = "<pre>" ^ txt ^ "</pre>"; |
| 6324 | 268 |
val verbatim = preform o output; |
269 |
||
270 |
||
271 |
(* document *) |
|
272 |
||
273 |
fun begin_document title = |
|
|
40946
3f697c636fa1
eliminated fragile HTML.with_charset -- always use utf-8;
wenzelm
parents:
39616
diff
changeset
|
274 |
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n\ |
|
3f697c636fa1
eliminated fragile HTML.with_charset -- always use utf-8;
wenzelm
parents:
39616
diff
changeset
|
275 |
\<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \ |
|
3f697c636fa1
eliminated fragile HTML.with_charset -- always use utf-8;
wenzelm
parents:
39616
diff
changeset
|
276 |
\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\ |
|
3f697c636fa1
eliminated fragile HTML.with_charset -- always use utf-8;
wenzelm
parents:
39616
diff
changeset
|
277 |
\<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\ |
|
3f697c636fa1
eliminated fragile HTML.with_charset -- always use utf-8;
wenzelm
parents:
39616
diff
changeset
|
278 |
\<head>\n\ |
|
3f697c636fa1
eliminated fragile HTML.with_charset -- always use utf-8;
wenzelm
parents:
39616
diff
changeset
|
279 |
\<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n\ |
|
3f697c636fa1
eliminated fragile HTML.with_charset -- always use utf-8;
wenzelm
parents:
39616
diff
changeset
|
280 |
\<title>" ^ plain (title ^ " (" ^ Distribution.version ^ ")") ^ "</title>\n\
|
|
3f697c636fa1
eliminated fragile HTML.with_charset -- always use utf-8;
wenzelm
parents:
39616
diff
changeset
|
281 |
\<link media=\"all\" rel=\"stylesheet\" type=\"text/css\" href=\"isabelle.css\"/>\n\ |
|
3f697c636fa1
eliminated fragile HTML.with_charset -- always use utf-8;
wenzelm
parents:
39616
diff
changeset
|
282 |
\</head>\n\ |
|
3f697c636fa1
eliminated fragile HTML.with_charset -- always use utf-8;
wenzelm
parents:
39616
diff
changeset
|
283 |
\\n\ |
|
3f697c636fa1
eliminated fragile HTML.with_charset -- always use utf-8;
wenzelm
parents:
39616
diff
changeset
|
284 |
\<body>\n\ |
|
3f697c636fa1
eliminated fragile HTML.with_charset -- always use utf-8;
wenzelm
parents:
39616
diff
changeset
|
285 |
\<div class=\"head\">\ |
|
3f697c636fa1
eliminated fragile HTML.with_charset -- always use utf-8;
wenzelm
parents:
39616
diff
changeset
|
286 |
\<h1>" ^ plain title ^ "</h1>\n"; |
| 6324 | 287 |
|
| 14541 | 288 |
val end_document = "\n</div>\n</body>\n</html>\n"; |
| 6324 | 289 |
|
| 6338 | 290 |
|
291 |
(* session index *) |
|
292 |
||
|
51399
6ac3c29a300e
discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents:
50233
diff
changeset
|
293 |
fun begin_session_index session docs graph = |
|
6ac3c29a300e
discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents:
50233
diff
changeset
|
294 |
begin_document ("Session " ^ plain session) ^
|
| 6754 | 295 |
para ("View " ^ href_path graph "theory dependencies" ^
|
| 27829 | 296 |
implode (map (fn (p, name) => "<br/>\nView " ^ href_path p name) docs)) ^ |
|
37941
1d812ff95a14
refrain from generating <hr/> and from "hiding" it in isabelle.css -- the latter might be used in other situations as well;
wenzelm
parents:
37940
diff
changeset
|
297 |
"\n</div>\n<div class=\"theories\">\n<h2>Theories</h2>\n<ul>\n"; |
| 6338 | 298 |
|
| 6649 | 299 |
fun choice chs s = space_implode " " (map (fn (s', lnk) => |
300 |
enclose "[" "]" (if s = s' then keyword s' else href_name lnk s')) chs); |
|
301 |
||
|
51399
6ac3c29a300e
discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents:
50233
diff
changeset
|
302 |
fun back_link (path, name) = para (href_path path "Back" ^ " to index of " ^ plain name); |
|
6ac3c29a300e
discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents:
50233
diff
changeset
|
303 |
|
| 9415 | 304 |
fun applet_pages session back = |
| 6649 | 305 |
let |
| 9415 | 306 |
val sizes = |
307 |
[("small", "small.html", ("500", "400")),
|
|
308 |
("medium", "medium.html", ("650", "520")),
|
|
309 |
("large", "large.html", ("800", "640"))];
|
|
| 6649 | 310 |
|
| 9415 | 311 |
fun applet_page (size, name, (width, height)) = |
| 6754 | 312 |
let |
313 |
val browser_size = "Set browser size: " ^ |
|
| 9415 | 314 |
choice (map (fn (y, z, _) => (y, z)) sizes) size; |
| 6754 | 315 |
in |
316 |
(name, begin_document ("Theory dependencies of " ^ session) ^
|
|
317 |
back_link back ^ |
|
| 9415 | 318 |
para browser_size ^ |
|
37941
1d812ff95a14
refrain from generating <hr/> and from "hiding" it in isabelle.css -- the latter might be used in other situations as well;
wenzelm
parents:
37940
diff
changeset
|
319 |
"\n</div>\n<div class=\"graphbrowser\">\n\ |
| 17080 | 320 |
\<applet code=\"GraphBrowser/GraphBrowser.class\" \ |
| 14541 | 321 |
\archive=\"GraphBrowser.jar\" \ |
|
27832
992c6d984925
<applet>: more XHTML 1.0 Transitional conformance;
wenzelm
parents:
27830
diff
changeset
|
322 |
\width=" ^ quote width ^ " height=" ^ quote height ^ ">\n\ |
|
992c6d984925
<applet>: more XHTML 1.0 Transitional conformance;
wenzelm
parents:
27830
diff
changeset
|
323 |
\<param name=\"graphfile\" value=\"" ^ "session.graph" ^ "\"/>\n\ |
|
37941
1d812ff95a14
refrain from generating <hr/> and from "hiding" it in isabelle.css -- the latter might be used in other situations as well;
wenzelm
parents:
37940
diff
changeset
|
324 |
\</applet>" ^ end_document) |
| 6649 | 325 |
end; |
| 9415 | 326 |
in map applet_page sizes end; |
| 6649 | 327 |
|
328 |
||
|
51399
6ac3c29a300e
discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents:
50233
diff
changeset
|
329 |
fun theory_entry (p, s) = "<li>" ^ href_path p (plain s) ^ "</li>\n"; |
| 6324 | 330 |
|
331 |
||
332 |
(* theory *) |
|
333 |
||
|
27861
911bf8e58c4c
removed obsolete verbatim_source, results, chapter, section etc.;
wenzelm
parents:
27832
diff
changeset
|
334 |
val theory_source = enclose |
|
37941
1d812ff95a14
refrain from generating <hr/> and from "hiding" it in isabelle.css -- the latter might be used in other situations as well;
wenzelm
parents:
37940
diff
changeset
|
335 |
"\n</div>\n<div class=\"source\">\n<pre>" |
|
1d812ff95a14
refrain from generating <hr/> and from "hiding" it in isabelle.css -- the latter might be used in other situations as well;
wenzelm
parents:
37940
diff
changeset
|
336 |
"</pre>\n"; |
| 6324 | 337 |
|
338 |
||
339 |
local |
|
| 27490 | 340 |
fun file (href, path, loadit) = |
341 |
href_path href (if loadit then file_path path else enclose "(" ")" (file_path path));
|
|
| 6361 | 342 |
|
|
51399
6ac3c29a300e
discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents:
50233
diff
changeset
|
343 |
fun theory A = |
|
6ac3c29a300e
discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents:
50233
diff
changeset
|
344 |
begin_document ("Theory " ^ A) ^ "\n" ^ command "theory" ^ " " ^ name A;
|
|
16267
0773b17922d8
present new-style theory header, with 'imports' and 'uses';
wenzelm
parents:
16196
diff
changeset
|
345 |
|
|
0773b17922d8
present new-style theory header, with 'imports' and 'uses';
wenzelm
parents:
16196
diff
changeset
|
346 |
fun imports Bs = |
|
0773b17922d8
present new-style theory header, with 'imports' and 'uses';
wenzelm
parents:
16196
diff
changeset
|
347 |
keyword "imports" ^ " " ^ space_implode " " (map (uncurry href_opt_path o apsnd name) Bs); |
|
0773b17922d8
present new-style theory header, with 'imports' and 'uses';
wenzelm
parents:
16196
diff
changeset
|
348 |
|
| 27829 | 349 |
fun uses Ps = keyword "uses" ^ " " ^ space_implode " " (map file Ps) ^ "<br/>\n"; |
| 6324 | 350 |
in |
351 |
||
|
51399
6ac3c29a300e
discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents:
50233
diff
changeset
|
352 |
fun begin_theory A Bs Ps body = |
|
6ac3c29a300e
discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents:
50233
diff
changeset
|
353 |
theory A ^ "<br/>\n" ^ |
| 27829 | 354 |
imports Bs ^ "<br/>\n" ^ |
|
16267
0773b17922d8
present new-style theory header, with 'imports' and 'uses';
wenzelm
parents:
16196
diff
changeset
|
355 |
(if null Ps then "" else uses Ps) ^ |
|
0773b17922d8
present new-style theory header, with 'imports' and 'uses';
wenzelm
parents:
16196
diff
changeset
|
356 |
body; |
|
0773b17922d8
present new-style theory header, with 'imports' and 'uses';
wenzelm
parents:
16196
diff
changeset
|
357 |
|
| 6324 | 358 |
end; |
359 |
||
360 |
||
|
37940
4857eab31298
generic external source files -- nothing special about ML here;
wenzelm
parents:
37146
diff
changeset
|
361 |
(* external file *) |
| 6324 | 362 |
|
|
37940
4857eab31298
generic external source files -- nothing special about ML here;
wenzelm
parents:
37146
diff
changeset
|
363 |
fun external_file path str = |
|
21858
05f57309170c
avoid conflict with Alice keywords: renamed pack -> implode, unpack -> explode, any -> many, avoided assert;
wenzelm
parents:
20742
diff
changeset
|
364 |
begin_document ("File " ^ Url.implode path) ^
|
|
37941
1d812ff95a14
refrain from generating <hr/> and from "hiding" it in isabelle.css -- the latter might be used in other situations as well;
wenzelm
parents:
37940
diff
changeset
|
365 |
"\n</div><div class=\"external_source\">\n" ^ |
| 14571 | 366 |
verbatim str ^ |
|
37941
1d812ff95a14
refrain from generating <hr/> and from "hiding" it in isabelle.css -- the latter might be used in other situations as well;
wenzelm
parents:
37940
diff
changeset
|
367 |
"\n</div>\n<div class=\"external_footer\">" ^ |
| 14541 | 368 |
end_document; |
| 6324 | 369 |
|
| 7572 | 370 |
end; |