# HG changeset patch # User wenzelm # Date 921674474 -3600 # Node ID c87f3769203a1cc86a9afe60e37f19a6b809dc7f # Parent 4bea69e827d039345d1402de71a5a0a2f157922f tuned; diff -r 4bea69e827d0 -r c87f3769203a src/Pure/Thy/html.ML --- a/src/Pure/Thy/html.ML Wed Mar 17 13:40:21 1999 +0100 +++ b/src/Pure/Thy/html.ML Wed Mar 17 13:41:14 1999 +0100 @@ -15,9 +15,11 @@ val keyword: string -> text val file_name: string -> text val file_path: Path.T -> text - val para: text -> text val href_name: string -> text -> text val href_path: Path.T -> text -> text + val href_opt_name: string option -> text -> text + val href_opt_path: Path.T option -> text -> text + val para: text -> text val preform: text -> text val verbatim: string -> text val begin_document: string -> text @@ -113,9 +115,16 @@ (* misc *) -fun para txt = "\n

\n" ^ txt ^ "\n

\n"; fun href_name s txt = "" ^ txt ^ ""; fun href_path path txt = href_name (Path.pack path) txt; + +fun href_opt_name None txt = txt + | href_opt_name (Some s) txt = href_name s txt; + +fun href_opt_path None txt = txt + | href_opt_path (Some p) txt = href_path p txt; + +fun para txt = "\n

\n" ^ txt ^ "\n

\n"; fun preform txt = "
" ^ txt ^ "
"; val verbatim = preform o output; @@ -137,14 +146,14 @@ "\n\ \\n"; -fun back_link (back_path, back_name) = - para (href_path back_path "Back" ^ " to index of " ^ plain back_name); +fun up_link (up_path, up_name) = + para (href_path up_path "Up" ^ " to index of " ^ plain up_name); (* session index *) -fun begin_index back (index_path, session) opt_readme = - begin_document ("Index of " ^ session) ^ back_link back ^ +fun begin_index up (index_path, session) opt_readme = + begin_document ("Index of " ^ session) ^ up_link up ^ (case opt_readme of None => "" | Some p => href_path p "README" ^ " file") ^ "\n
\n\n

Theories

\n"; @@ -164,27 +173,20 @@ local - fun file (opt_ref, path, loadit) = - (case opt_ref of None => I | Some p => href_path p) - ((if not loadit then enclose "(" ")" else I) (file_path path)); - - fun colon_last [] = [] - | colon_last lst = let val (prfx, (x, y)) = split_last lst in prfx @ [(x, y ^ ":")] end; + fun file (opt_ref, path, loadit) = href_opt_path opt_ref + ((if not loadit then enclose "(" ")" else I) (file_path path)); - fun parent (None, s) = name s - | parent (Some p, s) = href_path p (name s); + val files = space_implode " + " o map file; + val parents = space_implode " + " o map (uncurry href_opt_path o apsnd name); - val parents = space_implode " + " o map parent; - - fun theory back A = - begin_document ("Theory " ^ A) ^ "\n" ^ back_link back ^ + fun theory up A = + begin_document ("Theory " ^ A) ^ "\n" ^ up_link up ^ keyword "theory" ^ " " ^ name A ^ " = "; in -fun begin_theory back A Bs [] body = theory back A ^ parents (colon_last Bs) ^ "\n" ^ body - | begin_theory back A Bs Ps body = - theory back A ^ parents Bs ^ "
" ^ keyword "files" ^ - " " ^ space_implode " + " (map file Ps) ^ ":" ^ "\n" ^ body; +fun begin_theory up A Bs [] body = theory up A ^ parents Bs ^ ":\n" ^ body + | begin_theory up A Bs Ps body = theory up A ^ parents Bs ^ "
" ^ keyword "files" ^ + " " ^ files Ps ^ ":" ^ "\n" ^ body; end; val end_theory = end_document; @@ -199,8 +201,7 @@ (* theorem *) -(* FIXME improve freeze_thaw (?) *) -val string_of_thm = +val string_of_thm = (* FIXME improve freeze_thaw (?) *) Pretty.setmp_margin 80 Pretty.string_of o Display.pretty_thm_no_quote o #1 o Drule.freeze_thaw;