src/Pure/Thy/present.ML
changeset 7757 b2538dccc21e
parent 7752 7ee322caf59c
child 7763 fdf7c941a22b
equal deleted inserted replaced
7756:f9f8660de23f 7757:b2538dccc21e
    15   include BASIC_PRESENT
    15   include BASIC_PRESENT
    16   val init: bool -> string -> string list -> string -> Url.T option * bool -> unit
    16   val init: bool -> string -> string list -> string -> Url.T option * bool -> unit
    17   val finish: unit -> unit
    17   val finish: unit -> unit
    18   val init_theory: string -> unit
    18   val init_theory: string -> unit
    19   val verbatim_source: string -> (unit -> string list) -> unit
    19   val verbatim_source: string -> (unit -> string list) -> unit
    20   val token_source: string -> (unit -> (OuterLex.token * string option) list) -> unit
    20   type token
       
    21   val basic_token: OuterLex.token -> token
       
    22   val markup_token: string * string -> token
       
    23   val token_source: string -> (unit -> token list) -> unit
    21   val begin_theory: string -> string list -> (Path.T * bool) list -> theory -> theory
    24   val begin_theory: string -> string list -> (Path.T * bool) list -> theory -> theory
    22   val result: string -> string -> thm -> unit
    25   val result: string -> string -> thm -> unit
    23   val results: string -> string -> thm list -> unit
    26   val results: string -> string -> thm list -> unit
    24   val theorem: string -> thm -> unit
    27   val theorem: string -> thm -> unit
    25   val theorems: string -> thm list -> unit
    28   val theorems: string -> thm list -> unit
   323     (fn {name, html_prefix, doc_prefix, graph_path, all_graph_path, path, ...} =>
   326     (fn {name, html_prefix, doc_prefix, graph_path, all_graph_path, path, ...} =>
   324   let
   327   let
   325     val {theories, tex_index, html_index, graph, all_graph} = ! browser_info;
   328     val {theories, tex_index, html_index, graph, all_graph} = ! browser_info;
   326 
   329 
   327     fun finish_node (a, {tex_source, html_source = _, html}) =
   330     fun finish_node (a, {tex_source, html_source = _, html}) =
   328      (apsome (fn p => Buffer.write (Path.append p (tex_path a)) tex_source) doc_prefix;
   331      (apsome (fn p => Buffer.write_nonempty (Path.append p (tex_path a)) tex_source) doc_prefix;
   329       Buffer.write (Path.append html_prefix (html_path a)) (Buffer.add HTML.end_theory html));
   332       Buffer.write (Path.append html_prefix (html_path a)) (Buffer.add HTML.end_theory html));
   330   in
   333   in
   331     seq finish_node (Symtab.dest theories);
   334     seq finish_node (Symtab.dest theories);
   332     Buffer.write (Path.append html_prefix pre_index_path) html_index;
   335     Buffer.write (Path.append html_prefix pre_index_path) html_index;
   333     apsome (fn p => Buffer.write (Path.append p doc_index_path) tex_index) doc_prefix;
   336     apsome (fn p => Buffer.write (Path.append p doc_index_path) tex_index) doc_prefix;
   344 
   347 
   345 fun init_theory name = with_session () (fn _ => init_theory_info name empty_theory_info);
   348 fun init_theory name = with_session () (fn _ => init_theory_info name empty_theory_info);
   346 
   349 
   347 fun verbatim_source name mk_text =
   350 fun verbatim_source name mk_text =
   348   with_session () (fn _ => add_html_source name (HTML.verbatim_source (mk_text ())));
   351   with_session () (fn _ => add_html_source name (HTML.verbatim_source (mk_text ())));
       
   352 
       
   353 
       
   354 type token = Latex.token;
       
   355 val basic_token = Latex.Basic;
       
   356 val markup_token = Latex.Markup;
   349 
   357 
   350 fun token_source name mk_toks =
   358 fun token_source name mk_toks =
   351   with_session () (fn _ => add_tex_source name (Latex.token_source (mk_toks ())));
   359   with_session () (fn _ => add_tex_source name (Latex.token_source (mk_toks ())));
   352 
   360 
   353 
   361