src/Pure/Thy/html.ML
author skalberg
Sun, 13 Feb 2005 17:15:14 +0100
changeset 15531 08c8dad8e399
parent 15336 cb35ae957c65
child 15801 d2f5ca3c048d
permissions -rw-r--r--
Deleted Library.option type.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/Thy/HTML.ML
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
9415
daa2296f23ea removed all_sessions;
wenzelm
parents: 9045
diff changeset
     3
    Author:     Markus Wenzel and Stefan Berghofer, TU Muenchen
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
     4
9415
daa2296f23ea removed all_sessions;
wenzelm
parents: 9045
diff changeset
     5
HTML presentation elements.
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
     6
*)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
     7
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
     8
signature HTML =
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
     9
sig
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    10
  val output: string -> string
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    11
  val output_width: string -> string * real
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    12
  type text (* = string *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    13
  val plain: string -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    14
  val name: string -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    15
  val keyword: string -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    16
  val file_name: string -> text
6649
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
    17
  val file_path: Url.T -> text
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    18
  val href_name: string -> text -> text
6649
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
    19
  val href_path: Url.T -> text -> text
6376
wenzelm
parents: 6361
diff changeset
    20
  val href_opt_name: string option -> text -> text
6649
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
    21
  val href_opt_path: Url.T option -> text -> text
6376
wenzelm
parents: 6361
diff changeset
    22
  val para: text -> text
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    23
  val preform: text -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    24
  val verbatim: string -> text
7725
760021510e6b begin_index: document;
wenzelm
parents: 7634
diff changeset
    25
  val begin_index: Url.T * string -> Url.T * string -> Url.T option
760021510e6b begin_index: document;
wenzelm
parents: 7634
diff changeset
    26
    -> Url.T option -> Url.T -> text
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    27
  val end_index: text
9415
daa2296f23ea removed all_sessions;
wenzelm
parents: 9045
diff changeset
    28
  val applet_pages: string -> Url.T * string -> (string * string) list
6649
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
    29
  val theory_entry: Url.T * string -> text
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
    30
  val session_entries: (Url.T * string) list -> text
8190
wenzelm
parents: 8088
diff changeset
    31
  val verbatim_source: Symbol.symbol list -> text
6649
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
    32
  val begin_theory: Url.T * string -> string -> (Url.T option * string) list ->
7408
1ec1567c1307 added theorems;
wenzelm
parents: 6754
diff changeset
    33
    (Url.T option * Url.T * bool option) list -> text -> text
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    34
  val end_theory: text
6649
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
    35
  val ml_file: Url.T -> string -> text
13531
5825aef91ac5 simplified results;
wenzelm
parents: 12413
diff changeset
    36
  val results: string -> (string * thm list) list -> text
8088
6ae943d080de chapter;
wenzelm
parents: 7831
diff changeset
    37
  val chapter: string -> text
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    38
  val section: string -> text
7634
c326808da921 more sections;
wenzelm
parents: 7572
diff changeset
    39
  val subsection: string -> text
c326808da921 more sections;
wenzelm
parents: 7572
diff changeset
    40
  val subsubsection: string -> text
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    41
  val setup: (theory -> theory) list
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    42
end;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    43
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    44
structure HTML: HTML =
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    45
struct
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    46
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    47
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    48
(** HTML print modes **)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    49
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    50
(* mode *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    51
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    52
val htmlN = "HTML";
10573
1751ab881289 append print modes;
wenzelm
parents: 9963
diff changeset
    53
fun html_mode f x = setmp print_mode (htmlN :: ! print_mode) f x;
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    54
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    55
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    56
(* symbol output *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    57
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    58
local
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    59
  val escape = fn "<" => "&lt;" | ">" => "&gt;" | "&" => "&amp;" | c => c;
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    60
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    61
  val output_sym =
9963
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    62
    fn "\\<spacespace>" => (2.0, "&nbsp;&nbsp;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    63
     | "\\<exclamdown>" => (1.0, "&iexcl;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    64
     | "\\<cent>" => (1.0, "&cent;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    65
     | "\\<pounds>" => (1.0, "&pound;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    66
     | "\\<currency>" => (1.0, "&curren;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    67
     | "\\<yen>" => (1.0, "&yen;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    68
     | "\\<bar>" => (1.0, "&brvbar;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    69
     | "\\<section>" => (1.0, "&sect;")
10837
7d640de604e4 added \<dieresis>, \<acute>, \<cedilla>, \<emptyset>;
wenzelm
parents: 10831
diff changeset
    70
     | "\\<dieresis>" => (1.0, "&uml;")
9963
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    71
     | "\\<copyright>" => (1.0, "&copy;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    72
     | "\\<ordfeminine>" => (1.0, "&ordf;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    73
     | "\\<guillemotleft>" => (1.0, "&laquo;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    74
     | "\\<not>" => (1.0, "&not;")
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    75
     | "\\<hyphen>" => (1.0, "&shy;")
9963
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    76
     | "\\<registered>" => (1.0, "&reg;")
10831
024bdf8e52a4 replaced \<macron> by \<inverse>;
wenzelm
parents: 10573
diff changeset
    77
     | "\\<inverse>" => (1.0, "&macr;")
9963
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    78
     | "\\<degree>" => (1.0, "&deg;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    79
     | "\\<plusminus>" => (1.0, "&plusmn;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    80
     | "\\<twosuperior>" => (1.0, "&sup2;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    81
     | "\\<threesuperior>" => (1.0, "&sup3;")
10837
7d640de604e4 added \<dieresis>, \<acute>, \<cedilla>, \<emptyset>;
wenzelm
parents: 10831
diff changeset
    82
     | "\\<acute>" => (1.0, "&acute;")
9963
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    83
     | "\\<paragraph>" => (1.0, "&para;")
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    84
     | "\\<cdot>" => (1.0, "&middot;")
10837
7d640de604e4 added \<dieresis>, \<acute>, \<cedilla>, \<emptyset>;
wenzelm
parents: 10831
diff changeset
    85
     | "\\<cedilla>" => (1.0, "&cedil;")
9963
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    86
     | "\\<onesuperior>" => (1.0, "&sup1;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    87
     | "\\<ordmasculine>" => (1.0, "&ordm;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    88
     | "\\<guillemotright>" => (1.0, "&raquo;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    89
     | "\\<onequarter>" => (1.0, "&frac14;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    90
     | "\\<onehalf>" => (1.0, "&frac12;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    91
     | "\\<threequarters>" => (1.0, "&frac34;")
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    92
     | "\\<questiondown>" => (1.0, "&iquest;")
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    93
     | "\\<times>" => (1.0, "&times;")
9963
6342d9c7fe46 handle more symbols;
wenzelm
parents: 9415
diff changeset
    94
     | "\\<div>" => (1.0, "&divide;")
15336
cb35ae957c65 render \<circ> as o not &circ; (which is ^)
kleing
parents: 14992
diff changeset
    95
     | "\\<circ>" => (1.0, "o")
14552
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
    96
     | "\\<Alpha>" => (1.0, "&Alpha;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
    97
     | "\\<Beta>" => (1.0, "&Beta;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
    98
     | "\\<Gamma>" => (1.0, "&Gamma;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
    99
     | "\\<Delta>" => (1.0, "&Delta;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   100
     | "\\<Epsilon>" => (1.0, "&Epsilon;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   101
     | "\\<Zeta>" => (1.0, "&Zeta;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   102
     | "\\<Eta>" => (1.0, "&Eta;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   103
     | "\\<Theta>" => (1.0, "&Theta;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   104
     | "\\<Iota>" => (1.0, "&Iota;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   105
     | "\\<Kappa>" => (1.0, "&Kappa;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   106
     | "\\<Lambda>" => (1.0, "&Lambda;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   107
     | "\\<Mu>" => (1.0, "&Mu;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   108
     | "\\<Nu>" => (1.0, "&Nu;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   109
     | "\\<Xi>" => (1.0, "&Xi;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   110
     | "\\<Omicron>" => (1.0, "&Omicron;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   111
     | "\\<Pi>" => (1.0, "&Pi;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   112
     | "\\<Rho>" => (1.0, "&Rho;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   113
     | "\\<Sigma>" => (1.0, "&Sigma;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   114
     | "\\<Tau>" => (1.0, "&Tau;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   115
     | "\\<Upsilon>" => (1.0, "&Upsilon;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   116
     | "\\<Phi>" => (1.0, "&Phi;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   117
     | "\\<Chi>" => (1.0, "&Chi;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   118
     | "\\<Psi>" => (1.0, "&Psi;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   119
     | "\\<Omega>" => (1.0, "&Omega;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   120
     | "\\<alpha>" => (1.0, "&alpha;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   121
     | "\\<beta>" => (1.0, "&beta;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   122
     | "\\<gamma>" => (1.0, "&gamma;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   123
     | "\\<delta>" => (1.0, "&delta;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   124
     | "\\<epsilon>" => (1.0, "&epsilon;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   125
     | "\\<zeta>" => (1.0, "&zeta;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   126
     | "\\<eta>" => (1.0, "&eta;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   127
     | "\\<theta>" => (1.0, "&thetasym;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   128
     | "\\<iota>" => (1.0, "&iota;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   129
     | "\\<kappa>" => (1.0, "&kappa;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   130
     | "\\<lambda>" => (1.0, "&lambda;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   131
     | "\\<mu>" => (1.0, "&mu;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   132
     | "\\<nu>" => (1.0, "&nu;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   133
     | "\\<xi>" => (1.0, "&xi;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   134
     | "\\<omicron>" => (1.0, "&omicron;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   135
     | "\\<pi>" => (1.0, "&pi;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   136
     | "\\<rho>" => (1.0, "&rho;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   137
     | "\\<sigma>" => (1.0, "&sigma;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   138
     | "\\<tau>" => (1.0, "&tau;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   139
     | "\\<upsilon>" => (1.0, "&upsilon;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   140
     | "\\<phi>" => (1.0, "&phi;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   141
     | "\\<chi>" => (1.0, "&chi;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   142
     | "\\<psi>" => (1.0, "&psi;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   143
     | "\\<omega>" => (1.0, "&omega;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   144
     | "\\<buller>" => (1.0, "&bull;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   145
     | "\\<dots>" => (1.0, "&hellip;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   146
     | "\\<Re>" => (1.0, "&real;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   147
     | "\\<Im>" => (1.0, "&image;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   148
     | "\\<wp>" => (1.0, "&weierp;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   149
     | "\\<forall>" => (1.0, "&forall;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   150
     | "\\<partial>" => (1.0, "&part;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   151
     | "\\<exists>" => (1.0, "&exist;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   152
     | "\\<emptyset>" => (1.0, "&empty;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   153
     | "\\<nabla>" => (1.0, "&nabla;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   154
     | "\\<in>" => (1.0, "&isin;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   155
     | "\\<notin>" => (1.0, "&notin;")
14565
c6dc17aab88a use more symbols in HTML output
kleing
parents: 14558
diff changeset
   156
     | "\\<Prod>" => (1.0, "&prod;")
c6dc17aab88a use more symbols in HTML output
kleing
parents: 14558
diff changeset
   157
     | "\\<Sum>" => (1.0, "&sum;")
14552
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   158
     | "\\<star>" => (1.0, "&lowast;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   159
     | "\\<propto>" => (1.0, "&prop;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   160
     | "\\<infinity>" => (1.0, "&infin;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   161
     | "\\<angle>" => (1.0, "&ang;")
14571
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   162
     | "\\<and>" => (1.0, "&and;")
14552
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   163
     | "\\<or>" => (1.0, "&or;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   164
     | "\\<inter>" => (1.0, "&cap;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   165
     | "\\<union>" => (1.0, "&cup;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   166
     | "\\<sim>" => (1.0, "&sim;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   167
     | "\\<cong>" => (1.0, "&cong;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   168
     | "\\<approx>" => (1.0, "&asymp;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   169
     | "\\<noteq>" => (1.0, "&ne;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   170
     | "\\<equiv>" => (1.0, "&equiv;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   171
     | "\\<le>" => (1.0, "&le;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   172
     | "\\<ge>" => (1.0, "&ge;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   173
     | "\\<subset>" => (1.0, "&sub;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   174
     | "\\<supset>" => (1.0, "&sup;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   175
     | "\\<subseteq>" => (1.0, "&sube;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   176
     | "\\<supseteq>" => (1.0, "&supe;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   177
     | "\\<oplus>" => (1.0, "&oplus;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   178
     | "\\<otimes>" => (1.0, "&otimes;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   179
     | "\\<bottom>" => (1.0, "&perp;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   180
     | "\\<lceil>" => (1.0, "&lceil;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   181
     | "\\<rceil>" => (1.0, "&rceil;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   182
     | "\\<lfloor>" => (1.0, "&lfloor;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   183
     | "\\<rfloor>" => (1.0, "&rfloor;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   184
     | "\\<langle>" => (1.0, "&lang;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   185
     | "\\<rangle>" => (1.0, "&rang;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   186
     | "\\<lozenge>" => (1.0, "&loz;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   187
     | "\\<spadesuit>" => (1.0, "&spades;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   188
     | "\\<clubsuit>" => (1.0, "&clubs;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   189
     | "\\<heartsuit>" => (1.0, "&hearts;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   190
     | "\\<diamondsuit>" => (1.0, "&diams;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   191
     | "\\<lbrakk>" => (2.0, "[|")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   192
     | "\\<rbrakk>" => (2.0, "|]")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   193
     | "\\<Longrightarrow>" => (3.0, "==&gt;")
14571
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   194
     | "\\<Rightarrow>" => (2.0, "=&gt;")
14552
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   195
     | "\\<And>" => (2.0, "!!")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   196
     | "\\<Colon>" => (2.0, "::")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   197
     | "\\<lparr>" => (2.0, "(|")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   198
     | "\\<rparr>" => (2.0, "|)")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   199
     | "\\<longleftrightarrow>" => (3.0, "&lt;-&gt;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   200
     | "\\<longrightarrow>" => (3.0, "--&gt;")
e88f52b775a5 convert symbols to HTML 4.0 character entities,
kleing
parents: 14541
diff changeset
   201
     | "\\<rightarrow>" => (2.0, "-&gt;")
14534
7a46bdcd92f2 treat sub/super scripts
kleing
parents: 14083
diff changeset
   202
     | "\\<^bsub>" => (0.0, "<sub>")
7a46bdcd92f2 treat sub/super scripts
kleing
parents: 14083
diff changeset
   203
     | "\\<^esub>" => (0.0, "</sub>")
7a46bdcd92f2 treat sub/super scripts
kleing
parents: 14083
diff changeset
   204
     | "\\<^bsup>" => (0.0, "<sup>")
7a46bdcd92f2 treat sub/super scripts
kleing
parents: 14083
diff changeset
   205
     | "\\<^esup>" => (0.0, "</sup>")
14571
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   206
     | "\\<^sub>" => (0.0, "\\<^sub>")
14534
7a46bdcd92f2 treat sub/super scripts
kleing
parents: 14083
diff changeset
   207
     | "\\<^sup>" => (0.0, "\\<^sup>")
14571
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   208
     | "\\<^isub>" => (0.0, "\\<^isub>")
14534
7a46bdcd92f2 treat sub/super scripts
kleing
parents: 14083
diff changeset
   209
     | "\\<^isup>" => (0.0, "\\<^isup>")
14839
c994f1c57fc7 handle raw symbols; Output.add_mode; more robust handling of sub/superscript;
wenzelm
parents: 14775
diff changeset
   210
     | s =>
c994f1c57fc7 handle raw symbols; Output.add_mode; more robust handling of sub/superscript;
wenzelm
parents: 14775
diff changeset
   211
         if Symbol.is_raw s then (1.0, Symbol.decode_raw s)
c994f1c57fc7 handle raw symbols; Output.add_mode; more robust handling of sub/superscript;
wenzelm
parents: 14775
diff changeset
   212
         else (real (size s), implode (map escape (explode s)));
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   213
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   214
  fun add_sym (width, (w: real, s)) = (width + w, s);
14534
7a46bdcd92f2 treat sub/super scripts
kleing
parents: 14083
diff changeset
   215
14571
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   216
  fun script (0, "\\<^sub>") = (1, "<sub>")
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   217
    | script (0, "\\<^isub>") = (1, "<sub>")
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   218
    | script (0, "\\<^sup>") = (2, "<sup>")
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   219
    | script (0, "\\<^isup>") = (2, "<sup>")
14839
c994f1c57fc7 handle raw symbols; Output.add_mode; more robust handling of sub/superscript;
wenzelm
parents: 14775
diff changeset
   220
    | script (0, x) = (0, x)
c994f1c57fc7 handle raw symbols; Output.add_mode; more robust handling of sub/superscript;
wenzelm
parents: 14775
diff changeset
   221
    | script (1, x) = (0, x ^ "</sub>")
c994f1c57fc7 handle raw symbols; Output.add_mode; more robust handling of sub/superscript;
wenzelm
parents: 14775
diff changeset
   222
    | script (2, x) = (0, x ^ "</sup>");
14534
7a46bdcd92f2 treat sub/super scripts
kleing
parents: 14083
diff changeset
   223
14839
c994f1c57fc7 handle raw symbols; Output.add_mode; more robust handling of sub/superscript;
wenzelm
parents: 14775
diff changeset
   224
  fun scripts ss = #2 (foldl_map script (0, ss @ [""]));
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   225
in
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   226
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   227
fun output_width str =
14992
a16bc5abad45 tuned output;
wenzelm
parents: 14981
diff changeset
   228
  if not (exists_string (equal "\\" orf equal "<" orf equal ">" orf equal "&") str)
a16bc5abad45 tuned output;
wenzelm
parents: 14981
diff changeset
   229
  then Symbol.default_output str
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   230
  else
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   231
    let val (width, syms) = foldl_map add_sym (0.0, map output_sym (Symbol.explode str))
14534
7a46bdcd92f2 treat sub/super scripts
kleing
parents: 14083
diff changeset
   232
    in (implode (scripts syms), width) end;
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   233
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   234
val output = #1 o output_width;
14571
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   235
val output_symbols = scripts o map (#2 o output_sym);
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   236
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   237
end;
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   238
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   239
14973
0613f64653b7 Symbol.encode_raw;
wenzelm
parents: 14839
diff changeset
   240
val _ = Output.add_mode htmlN (output_width, Symbol.default_indent, Symbol.encode_raw);
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   241
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   242
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   243
(* token translations *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   244
14541
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   245
fun style stl =
14598
7009f59711e3 Replaced quote by Library.quote, since quote now refers to Symbol.quote
berghofe
parents: 14571
diff changeset
   246
  apfst (enclose ("<span class=" ^ Library.quote stl ^ ">") "</span>") o output_width;
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   247
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   248
val html_trans =
14541
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   249
 [("class", style "tclass"),
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   250
  ("tfree", style "tfree"),
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   251
  ("tvar",  style "tvar"),
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   252
  ("free",  style "free"),
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   253
  ("bound", style "bound"),
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   254
  ("var",   style "var"),
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   255
  ("xstr",  style "xstr")];
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   256
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   257
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   258
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   259
(** HTML markup **)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   260
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   261
type text = string;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   262
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   263
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   264
(* atoms *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   265
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   266
val plain = output;
14541
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   267
fun name s = "<span class=\"name\">" ^ output s ^ "</span>";
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   268
fun keyword s = "<span class=\"keyword\">" ^ output s ^ "</span>";
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   269
fun file_name s = "<span class=\"filename\">" ^ output s ^ "</span>";
6649
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
   270
val file_path = file_name o Url.pack;
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   271
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   272
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   273
(* misc *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   274
14598
7009f59711e3 Replaced quote by Library.quote, since quote now refers to Symbol.quote
berghofe
parents: 14571
diff changeset
   275
fun href_name s txt = "<a href=" ^ Library.quote s ^ ">" ^ txt ^ "</a>";
6649
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
   276
fun href_path path txt = href_name (Url.pack path) txt;
6376
wenzelm
parents: 6361
diff changeset
   277
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15336
diff changeset
   278
fun href_opt_name NONE txt = txt
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15336
diff changeset
   279
  | href_opt_name (SOME s) txt = href_name s txt;
6376
wenzelm
parents: 6361
diff changeset
   280
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15336
diff changeset
   281
fun href_opt_path NONE txt = txt
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15336
diff changeset
   282
  | href_opt_path (SOME p) txt = href_path p txt;
6376
wenzelm
parents: 6361
diff changeset
   283
12413
f879fcc9412d tuned line breaks in HTML source;
wenzelm
parents: 12151
diff changeset
   284
fun para txt = "\n<p>" ^ txt ^ "</p>\n";
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   285
fun preform txt = "<pre>" ^ txt ^ "</pre>";
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   286
val verbatim = preform o output;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   287
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   288
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   289
(* document *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   290
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   291
fun begin_document title =
14083
aed5d25c4a0c Added DOCTYPE and Content-type to HTML documents.
webertj
parents: 13531
diff changeset
   292
  "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n\
aed5d25c4a0c Added DOCTYPE and Content-type to HTML documents.
webertj
parents: 13531
diff changeset
   293
  \\n\
aed5d25c4a0c Added DOCTYPE and Content-type to HTML documents.
webertj
parents: 13531
diff changeset
   294
  \<html>\n\
6405
wenzelm
parents: 6376
diff changeset
   295
  \<head>\n\
14083
aed5d25c4a0c Added DOCTYPE and Content-type to HTML documents.
webertj
parents: 13531
diff changeset
   296
  \<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n\
6405
wenzelm
parents: 6376
diff changeset
   297
  \<title>" ^ plain (title ^ " (" ^ version ^ ")") ^ "</title>\n\
14541
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   298
  \<link rel=\"stylesheet\" type=\"text/css\" href=\"isabelle.css\">\n\
6405
wenzelm
parents: 6376
diff changeset
   299
  \</head>\n\
wenzelm
parents: 6376
diff changeset
   300
  \\n\
wenzelm
parents: 6376
diff changeset
   301
  \<body>\n\
14541
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   302
  \<div class=\"head\">\
6405
wenzelm
parents: 6376
diff changeset
   303
  \<h1>" ^ plain title ^ "</h1>\n"
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   304
14541
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   305
val end_document = "\n</div>\n</body>\n</html>\n";
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   306
6754
c23c542a32e5 tuned markup;
wenzelm
parents: 6649
diff changeset
   307
fun gen_link how (path, name) = para (href_path path how ^ " to index of " ^ plain name);
c23c542a32e5 tuned markup;
wenzelm
parents: 6649
diff changeset
   308
val up_link = gen_link "Up";
c23c542a32e5 tuned markup;
wenzelm
parents: 6649
diff changeset
   309
val back_link = gen_link "Back";
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   310
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   311
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   312
(* session index *)
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   313
7725
760021510e6b begin_index: document;
wenzelm
parents: 7634
diff changeset
   314
fun begin_index up (index_path, session) opt_readme opt_doc graph =
6754
c23c542a32e5 tuned markup;
wenzelm
parents: 6649
diff changeset
   315
  begin_document ("Index of " ^ session) ^ up_link up ^
c23c542a32e5 tuned markup;
wenzelm
parents: 6649
diff changeset
   316
  para ("View " ^ href_path graph "theory dependencies" ^
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15336
diff changeset
   317
    (case opt_readme of NONE => "" | SOME p => "<br>\nView " ^ href_path p "README") ^
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15336
diff changeset
   318
    (case opt_doc of NONE => "" | SOME p => "<br>\nView " ^ href_path p "document")) ^
14541
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   319
  "\n</div>\n<hr>\n<div class=\"theories\">\n<h2>Theories</h2>\n<ul>\n";
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   320
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   321
val end_index = end_document;
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   322
6649
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
   323
fun choice chs s = space_implode " " (map (fn (s', lnk) =>
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
   324
  enclose "[" "]" (if s = s' then keyword s' else href_name lnk s')) chs);
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
   325
9415
daa2296f23ea removed all_sessions;
wenzelm
parents: 9045
diff changeset
   326
fun applet_pages session back =
6649
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
   327
  let
9415
daa2296f23ea removed all_sessions;
wenzelm
parents: 9045
diff changeset
   328
    val sizes =
daa2296f23ea removed all_sessions;
wenzelm
parents: 9045
diff changeset
   329
     [("small", "small.html", ("500", "400")),
daa2296f23ea removed all_sessions;
wenzelm
parents: 9045
diff changeset
   330
      ("medium", "medium.html", ("650", "520")),
daa2296f23ea removed all_sessions;
wenzelm
parents: 9045
diff changeset
   331
      ("large", "large.html", ("800", "640"))];
6649
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
   332
9415
daa2296f23ea removed all_sessions;
wenzelm
parents: 9045
diff changeset
   333
    fun applet_page (size, name, (width, height)) =
6754
c23c542a32e5 tuned markup;
wenzelm
parents: 6649
diff changeset
   334
      let
c23c542a32e5 tuned markup;
wenzelm
parents: 6649
diff changeset
   335
        val browser_size = "Set browser size: " ^
9415
daa2296f23ea removed all_sessions;
wenzelm
parents: 9045
diff changeset
   336
          choice (map (fn (y, z, _) => (y, z)) sizes) size;
6754
c23c542a32e5 tuned markup;
wenzelm
parents: 6649
diff changeset
   337
      in
c23c542a32e5 tuned markup;
wenzelm
parents: 6649
diff changeset
   338
        (name, begin_document ("Theory dependencies of " ^ session) ^
c23c542a32e5 tuned markup;
wenzelm
parents: 6649
diff changeset
   339
          back_link back ^
9415
daa2296f23ea removed all_sessions;
wenzelm
parents: 9045
diff changeset
   340
          para browser_size ^
14541
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   341
          "\n</div>\n<hr>\n<div class=\"graphbrowser\">\n<applet code=\"GraphBrowser/GraphBrowser.class\" \
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   342
          \archive=\"GraphBrowser.jar\" \
9045
a5bfcd4c2a5e Removed codebase attribute from applet_pages.
berghofe
parents: 8808
diff changeset
   343
          \width=" ^ width ^ " height=" ^ height ^ ">\n\
9415
daa2296f23ea removed all_sessions;
wenzelm
parents: 9045
diff changeset
   344
          \<param name=\"graphfile\" value=\"" ^ "session.graph" ^ "\">\n\
6754
c23c542a32e5 tuned markup;
wenzelm
parents: 6649
diff changeset
   345
          \</applet>\n<hr>" ^ end_document)
6649
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
   346
      end;
9415
daa2296f23ea removed all_sessions;
wenzelm
parents: 9045
diff changeset
   347
  in map applet_page sizes end;
6649
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
   348
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
   349
6405
wenzelm
parents: 6376
diff changeset
   350
fun entry (p, s) = "<li>" ^ href_path p (plain s) ^ "\n";
wenzelm
parents: 6376
diff changeset
   351
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   352
val theory_entry = entry;
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   353
6405
wenzelm
parents: 6376
diff changeset
   354
fun session_entries [] = "</ul>"
wenzelm
parents: 6376
diff changeset
   355
  | session_entries es =
14541
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   356
      "</ul>\n</div>\n<hr>\n<div class=\"sessions\">\n<h2>Sessions</h2>\n<ul>\n" ^ implode (map entry es) ^ "</ul>";
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   357
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   358
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   359
(* theory *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   360
14571
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   361
fun verbatim_source ss =
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   362
  "\n</div>\n<hr>\n<div class=\"source\">\n<pre>" ^
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   363
  implode (output_symbols ss)  ^
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   364
  "</pre>\n</div>\n<hr>\n<div class=\"theorems\">\n";
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   365
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   366
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   367
local
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15336
diff changeset
   368
  fun encl NONE = enclose "[" "]"
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15336
diff changeset
   369
    | encl (SOME false) = enclose "(" ")"
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15336
diff changeset
   370
    | encl (SOME true) = I;
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   371
7408
1ec1567c1307 added theorems;
wenzelm
parents: 6754
diff changeset
   372
  fun file (opt_ref, path, loadit) = href_opt_path opt_ref (encl loadit (file_path path));
7831
2a13c396201d files: separate by " ";
wenzelm
parents: 7725
diff changeset
   373
  val files = space_implode " " o map file;
6376
wenzelm
parents: 6361
diff changeset
   374
  val parents = space_implode " + " o map (uncurry href_opt_path o apsnd name);
6361
3a45ad4a95eb theory: include parent links;
wenzelm
parents: 6347
diff changeset
   375
6376
wenzelm
parents: 6361
diff changeset
   376
  fun theory up A =
wenzelm
parents: 6361
diff changeset
   377
    begin_document ("Theory " ^ A) ^ "\n" ^ up_link up ^
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   378
    keyword "theory" ^ " " ^ name A ^ " = ";
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   379
in
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   380
6376
wenzelm
parents: 6361
diff changeset
   381
fun begin_theory up A Bs [] body = theory up A ^ parents Bs ^ ":\n" ^ body
12413
f879fcc9412d tuned line breaks in HTML source;
wenzelm
parents: 12151
diff changeset
   382
  | begin_theory up A Bs Ps body = theory up A ^ parents Bs ^ "<br>\n" ^ keyword "files" ^
6376
wenzelm
parents: 6361
diff changeset
   383
      " " ^ files Ps ^ ":" ^ "\n" ^ body;
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   384
end;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   385
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   386
val end_theory = end_document;
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   387
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   388
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   389
(* ML file *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   390
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   391
fun ml_file path str =
6649
2156012be986 Reimplemented graph generator.
berghofe
parents: 6405
diff changeset
   392
  begin_document ("File " ^ Url.pack path) ^
14571
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   393
  "\n</div>\n<hr><div class=\"mlsource\">\n" ^
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   394
  verbatim str ^
b88d5f9e02e1 fixed width;
wenzelm
parents: 14565
diff changeset
   395
  "\n</div>\n<hr>\n<div class=\"mlfooter\">\n" ^
14541
0a7743e2f8dd use css
kleing
parents: 14534
diff changeset
   396
  end_document;
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   397
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   398
7408
1ec1567c1307 added theorems;
wenzelm
parents: 6754
diff changeset
   399
(* theorems *)
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   400
7572
6e6dafacbc28 present results;
wenzelm
parents: 7408
diff changeset
   401
local
6e6dafacbc28 present results;
wenzelm
parents: 7408
diff changeset
   402
7408
1ec1567c1307 added theorems;
wenzelm
parents: 6754
diff changeset
   403
val string_of_thm =
14839
c994f1c57fc7 handle raw symbols; Output.add_mode; more robust handling of sub/superscript;
wenzelm
parents: 14775
diff changeset
   404
  Output.output o Pretty.setmp_margin 80 Pretty.string_of o
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   405
    Display.pretty_thm_no_quote o #1 o Drule.freeze_thaw;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   406
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   407
fun thm th = preform (prefix_lines "  " (html_mode string_of_thm th));
7408
1ec1567c1307 added theorems;
wenzelm
parents: 6754
diff changeset
   408
7572
6e6dafacbc28 present results;
wenzelm
parents: 7408
diff changeset
   409
fun thm_name "" = ""
6e6dafacbc28 present results;
wenzelm
parents: 7408
diff changeset
   410
  | thm_name a = " " ^ name (a ^ ":");
6e6dafacbc28 present results;
wenzelm
parents: 7408
diff changeset
   411
6e6dafacbc28 present results;
wenzelm
parents: 7408
diff changeset
   412
in
6e6dafacbc28 present results;
wenzelm
parents: 7408
diff changeset
   413
13531
5825aef91ac5 simplified results;
wenzelm
parents: 12413
diff changeset
   414
fun result k (a, ths) = para (cat_lines ((keyword k ^ thm_name a) :: map thm ths));
7572
6e6dafacbc28 present results;
wenzelm
parents: 7408
diff changeset
   415
13531
5825aef91ac5 simplified results;
wenzelm
parents: 12413
diff changeset
   416
fun results _ [] = ""
5825aef91ac5 simplified results;
wenzelm
parents: 12413
diff changeset
   417
  | results k (res :: ress) = cat_lines (result k res :: map (result "and") ress);
7572
6e6dafacbc28 present results;
wenzelm
parents: 7408
diff changeset
   418
6e6dafacbc28 present results;
wenzelm
parents: 7408
diff changeset
   419
end;
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   420
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   421
7634
c326808da921 more sections;
wenzelm
parents: 7572
diff changeset
   422
(* sections *)
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   423
8088
6ae943d080de chapter;
wenzelm
parents: 7831
diff changeset
   424
fun chapter heading = "\n\n<h1>" ^ plain heading ^ "</h1>\n";
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   425
fun section heading = "\n\n<h2>" ^ plain heading ^ "</h2>\n";
7634
c326808da921 more sections;
wenzelm
parents: 7572
diff changeset
   426
fun subsection heading = "\n\n<h3>" ^ plain heading ^ "</h3>\n";
c326808da921 more sections;
wenzelm
parents: 7572
diff changeset
   427
fun subsubsection heading = "\n\n<h4>" ^ plain heading ^ "</h4>\n";
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   428
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   429
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   430
(** theory setup **)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   431
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   432
val setup =
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   433
 [Theory.add_mode_tokentrfuns htmlN html_trans];
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   434
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   435
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   436
end;