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