23 string -> (bool * Path.T) option -> Url.T option * bool -> bool -> unit |
23 string -> (bool * Path.T) option -> Url.T option * bool -> bool -> unit |
24 val finish: unit -> unit |
24 val finish: unit -> unit |
25 val init_theory: string -> unit |
25 val init_theory: string -> unit |
26 val verbatim_source: string -> (unit -> Symbol.symbol list) -> unit |
26 val verbatim_source: string -> (unit -> Symbol.symbol list) -> unit |
27 val theory_output: string -> string -> unit |
27 val theory_output: string -> string -> unit |
28 val begin_theory: Path.T list -> string -> string list -> |
28 val begin_theory: Path.T -> string -> string list -> (Path.T * bool) list -> theory -> theory |
29 (Path.T * bool) list -> theory -> theory |
|
30 val add_hook: (string -> (string * thm list) list -> unit) -> unit |
29 val add_hook: (string -> (string * thm list) list -> unit) -> unit |
31 val results: string -> (string * thm list) list -> unit |
30 val results: string -> (string * thm list) list -> unit |
32 val theorem: string -> thm -> unit |
31 val theorem: string -> thm -> unit |
33 val theorems: string -> thm list -> unit |
32 val theorems: string -> thm list -> unit |
34 val chapter: string -> unit |
33 val chapter: string -> unit |
450 (Path.append (Path.make session) (html_path name))) |
449 (Path.append (Path.make session) (html_path name))) |
451 else Url.File (Path.append (mk_rel_path curr_session session) |
450 else Url.File (Path.append (mk_rel_path curr_session session) |
452 (html_path name))), name) |
451 (html_path name))), name) |
453 end; |
452 end; |
454 |
453 |
455 fun begin_theory dirs name raw_parents orig_files thy = |
454 fun begin_theory dir name raw_parents orig_files thy = |
456 with_session thy (fn {name = sess_name, session, path, html_prefix, remote_path, ...} => |
455 with_session thy (fn {name = sess_name, session, path, html_prefix, remote_path, ...} => |
457 let |
456 let |
458 val parents = map (parent_link remote_path path) raw_parents; |
457 val parents = map (parent_link remote_path path) raw_parents; |
459 val ml_path = ThyLoad.ml_path name; |
458 val ml_path = ThyLoad.ml_path name; |
460 val files = map (apsnd SOME) orig_files @ |
459 val files = map (apsnd SOME) orig_files @ |
461 (if is_some (ThyLoad.check_file dirs ml_path) then [(ml_path, NONE)] else []); |
460 (if is_some (ThyLoad.check_file dir ml_path) then [(ml_path, NONE)] else []); |
462 |
461 |
463 fun prep_file (raw_path, loadit) = |
462 fun prep_file (raw_path, loadit) = |
464 (case ThyLoad.check_ml dirs raw_path of |
463 (case ThyLoad.check_ml dir raw_path of |
465 SOME (path, _) => |
464 SOME (path, _) => |
466 let |
465 let |
467 val base = Path.base path; |
466 val base = Path.base path; |
468 val base_html = html_ext base; |
467 val base_html = html_ext base; |
469 in |
468 in |
470 add_file (Path.append html_prefix base_html, |
469 add_file (Path.append html_prefix base_html, |
471 HTML.ml_file (Url.File base) (File.read path)); |
470 HTML.ml_file (Url.File base) (File.read path)); |
472 (SOME (Url.File base_html), Url.File raw_path, loadit) |
471 (SOME (Url.File base_html), Url.File raw_path, loadit) |
473 end |
472 end |
474 | NONE => (warning ("Browser info: expected to find ML file" ^ quote (Path.implode raw_path)); |
473 | NONE => |
475 (NONE, Url.File raw_path, loadit))); |
474 (warning ("Browser info: expected to find ML file" ^ quote (Path.implode raw_path)); |
|
475 (NONE, Url.File raw_path, loadit))); |
476 |
476 |
477 val files_html = map prep_file files; |
477 val files_html = map prep_file files; |
478 |
478 |
479 fun prep_html_source (tex_source, html_source, html) = |
479 fun prep_html_source (tex_source, html_source, html) = |
480 let |
480 let |