src/Pure/Thy/html.ML
author wenzelm
Wed, 10 Mar 1999 10:53:02 +0100
changeset 6338 bf0d22535e47
parent 6324 3b7111b360b1
child 6347 ce7ab97a8e15
permissions -rw-r--r--
output: some symbol translations; removed insert_here, conclude_theory; added begin/end_index, theory_entry, session_entries;
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$
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
     3
    Author:     Markus Wenzel, TU Muenchen
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
     4
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
     5
HTML presentation primitives.
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
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    17
  val file_path: Path.T -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    18
  val para: text -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    19
  val href_name: string -> text -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    20
  val href_path: Path.T -> text -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    21
  val preform: text -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    22
  val verbatim: string -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    23
  val begin_document: string -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    24
  val end_document: text
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    25
  val begin_index: Path.T * string -> Path.T * string -> Path.T option -> text
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    26
  val end_index: text
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    27
  val theory_entry: Path.T * string -> text
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    28
  val session_entries: (Path.T * string) list -> text
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    29
  val source: (string, 'a) Source.source -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    30
  val begin_theory: Path.T * string -> string -> string list -> ((Path.T * Path.T) * bool) list
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    31
    -> text -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    32
  val end_theory: text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    33
  val ml_file: Path.T -> string -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    34
  val theorem: string -> thm -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    35
  val section: string -> text
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    36
  val setup: (theory -> theory) list
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    37
end;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    38
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    39
structure HTML: HTML =
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    40
struct
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    41
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    42
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    43
(** HTML print modes **)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    44
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    45
(* mode *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    46
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    47
val htmlN = "HTML";
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    48
fun html_mode f x = setmp print_mode [htmlN] f x;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    49
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    50
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    51
(* symbol output *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    52
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    53
local
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    54
  val escape = fn "<" => "&lt;" | ">" => "&gt;" | "&" => "&amp;" | c => c;
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    55
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    56
  val output_sym =
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    57
    fn "\\<not>" => (1.0, "&not;")
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    58
     | "\\<hyphen>" => (1.0, "&shy;")
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    59
     | "\\<cdot>" => (1.0, "&middot;")
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    60
     | "\\<times>" => (1.0, "&times;")
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    61
     | "\\<copyright>" => (1.0, "&copy;")
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    62
     | "\\<mu>" => (1.0, "&micro;")
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    63
     | s => (real (size s), implode (map escape (explode s)));
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    64
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    65
  fun add_sym (width, (w: real, s)) = (width + w, s);
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    66
in
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    67
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    68
fun output_width str =
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    69
  if not (exists_string (equal "<" orf equal ">" orf equal "&") str) then (str, real (size str))
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    70
  else
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    71
    let val (width, syms) = foldl_map add_sym (0.0, map output_sym (Symbol.explode str))
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    72
    in (implode syms, width) end;
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    73
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    74
val output = #1 o output_width;
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    75
val output_symbols = map (#2 o output_sym);
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    76
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    77
end;
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
    78
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    79
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    80
val _ = Symbol.add_mode htmlN output_width;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    81
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    82
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    83
(* token translations *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    84
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    85
fun tagit bg en = apfst (enclose bg en) o output_width;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    86
fun color col = tagit ("<font color=" ^ quote col ^ ">") "</font>";
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    87
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    88
val html_trans =
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    89
 [("class", color "red"),
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    90
  ("tfree", color "purple"),
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    91
  ("tvar",  color "purple"),
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    92
  ("free",  color "blue"),
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    93
  ("bound", color "green"),
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    94
  ("var",   color "blue"),
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    95
  ("xnum",  color "yellow"),
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    96
  ("xstr",  color "brown")];
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    97
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    98
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
    99
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   100
(** HTML markup **)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   101
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   102
type text = string;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   103
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   104
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   105
(* atoms *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   106
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   107
val plain = output;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   108
fun name s = "<i>" ^ output s ^ "</i>";
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   109
fun keyword s = "<b>" ^ output s ^ "</b>";
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   110
fun file_name s = "<tt>" ^ output s ^ "</tt>";
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   111
val file_path = file_name o Path.pack;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   112
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   113
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   114
(* misc *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   115
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   116
fun para txt = "\n<p>\n" ^ txt ^ "\n</p>\n";
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   117
fun href_name s txt = "<a href=" ^ quote s ^ ">" ^ txt ^ "</a>";
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   118
fun href_path path txt = href_name (Path.pack path) txt;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   119
fun preform txt = "<pre>" ^ txt ^ "</pre>";
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   120
val verbatim = preform o output;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   121
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   122
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   123
(* document *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   124
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   125
fun begin_document title =
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   126
  let val txt = plain title in
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   127
    "<html>\n\
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   128
    \<head>\n\
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   129
    \<title>" ^ txt ^ "</title>\n\
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   130
    \</head>\n\
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   131
    \\n\
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   132
    \<body>\n\
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   133
    \<h1>" ^ txt ^ "</h1>\n"
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   134
  end;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   135
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   136
val end_document =
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   137
  "</body>\n\
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   138
  \</html>\n";
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   139
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   140
fun back_link (back_path, back_name) =
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   141
  para (href_path back_path "Back" ^ " to index of " ^ plain back_name);
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   142
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   143
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   144
(* session index *)
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   145
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   146
fun begin_index back (index_path, session) opt_readme =
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   147
  begin_document ("Index of " ^ session) ^ back_link back ^
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   148
  (case opt_readme of None => "" | Some p => para (href_path p "README" ^ " file")) ^
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   149
  "\n<hr>\n\n<h2>Theories</h2>\n";
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   150
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   151
val end_index = end_document;
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   152
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   153
fun entry (p, s) = href_path p (plain s) ^ "<br>\n";
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   154
val theory_entry = entry;
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   155
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   156
fun session_entries [] = ""
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   157
  | session_entries es = "\n<hr>\n\n<h2>Sessions</h2>\n" ^ cat_lines (map entry es);
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   158
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   159
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   160
(* theory *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   161
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   162
fun output_source src = implode (output_symbols (Source.exhaust (Symbol.source false src)));
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   163
fun source src = "\n<hr>\n<pre>" ^ output_source src ^ "</pre>\n<hr>\n";
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   164
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   165
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   166
local
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   167
  fun file ((p, p'), loadit) =
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   168
    href_path p' ((if not loadit then enclose "(" ")" else I) (file_path p));
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   169
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   170
  fun suffix_last _ [] = []
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   171
    | suffix_last s lst = let val (xs, x) = split_last lst in xs @ [x ^ s] end;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   172
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   173
  val plus_names = space_implode " + " o map name;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   174
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   175
  fun theory back A =
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   176
    begin_document ("Theory " ^ A) ^ "\n" ^ back_link back ^
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   177
    keyword "theory" ^ " " ^ name A ^ " = ";
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   178
in
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   179
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   180
fun begin_theory back A Bs [] body = theory back A ^ plus_names (suffix_last ":" Bs) ^ "\n" ^ body
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   181
  | begin_theory back A Bs Ps body =
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   182
      theory back A ^ plus_names Bs ^
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   183
      "<br>" ^ keyword "files" ^ " " ^ space_implode " + " (map file Ps) ^ ":" ^ "\n" ^ body;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   184
end;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   185
6338
bf0d22535e47 output: some symbol translations;
wenzelm
parents: 6324
diff changeset
   186
val end_theory = end_document;
6324
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   187
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   188
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   189
(* ML file *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   190
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   191
fun ml_file path str =
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   192
  begin_document ("File " ^ Path.pack path) ^
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   193
  "\n<hr>\n" ^ verbatim str ^ "\n<hr>\n" ^ end_document;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   194
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   195
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   196
(* theorem *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   197
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   198
(* FIXME improve freeze_thaw (?) *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   199
val string_of_thm =
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   200
  Pretty.setmp_margin 80 Pretty.string_of o
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   201
    Display.pretty_thm_no_quote o #1 o Drule.freeze_thaw;
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   202
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   203
fun thm th = preform (prefix_lines "  " (html_mode string_of_thm th));
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   204
fun theorem a th = para (keyword "theorem" ^ " " ^ name (a ^ ":") ^ "\n" ^ thm th);
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   205
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   206
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   207
(* section *)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   208
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   209
fun section heading = "\n\n<h2>" ^ plain heading ^ "</h2>\n";
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   210
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   211
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   212
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   213
(** theory setup **)
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   214
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   215
val setup =
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   216
 [Theory.add_mode_tokentrfuns htmlN html_trans];
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   217
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   218
3b7111b360b1 HTML markup elements.
wenzelm
parents:
diff changeset
   219
end;