src/Pure/Thy/present.ML
changeset 11057 e68becb804fe
parent 9917 5af7632388a0
child 11580 a8409fa3985c
equal deleted inserted replaced
11056:32a98609ce92 11057:e68becb804fe
     6 Theory presentation: HTML, graph files, (PDF)LaTeX documents.
     6 Theory presentation: HTML, graph files, (PDF)LaTeX documents.
     7 *)
     7 *)
     8 
     8 
     9 signature BASIC_PRESENT =
     9 signature BASIC_PRESENT =
    10 sig
    10 sig
       
    11   val no_document: ('a -> 'b) -> 'a -> 'b
    11   val section: string -> unit
    12   val section: string -> unit
    12 end;
    13 end;
    13 
    14 
    14 signature PRESENT =
    15 signature PRESENT =
    15 sig
    16 sig
   153 
   154 
   154 
   155 
   155 (* state *)
   156 (* state *)
   156 
   157 
   157 val browser_info = ref empty_browser_info;
   158 val browser_info = ref empty_browser_info;
   158 
       
   159 fun change_browser_info f = browser_info := map_browser_info f (! browser_info);
   159 fun change_browser_info f = browser_info := map_browser_info f (! browser_info);
       
   160 
       
   161 val suppress_tex_source = ref false;
       
   162 fun no_document f x = Library.setmp suppress_tex_source true f x;
   160 
   163 
   161 fun init_theory_info name info =
   164 fun init_theory_info name info =
   162   change_browser_info (fn (theories, tex_index, html_index, graph) =>
   165   change_browser_info (fn (theories, tex_index, html_index, graph) =>
   163     (Symtab.update ((name, info), theories), tex_index, html_index, graph));
   166     (Symtab.update ((name, info), theories), tex_index, html_index, graph));
   164 
   167 
   180 
   183 
   181 fun add_graph_entry e =
   184 fun add_graph_entry e =
   182   change_browser_info (fn (theories, tex_index, html_index, graph) =>
   185   change_browser_info (fn (theories, tex_index, html_index, graph) =>
   183     (theories, tex_index, html_index, ins_graph_entry e graph));
   186     (theories, tex_index, html_index, ins_graph_entry e graph));
   184 
   187 
   185 fun add_tex_source name txt = change_theory_info name (fn (tex_source, html_source, html) =>
   188 fun add_tex_source name txt =
   186   (Buffer.add txt tex_source, html_source, html));
   189   if ! suppress_tex_source then ()
       
   190   else change_theory_info name (fn (tex_source, html_source, html) =>
       
   191     (Buffer.add txt tex_source, html_source, html));
   187 
   192 
   188 fun add_html_source name txt = change_theory_info name (fn (tex_source, html_source, html) =>
   193 fun add_html_source name txt = change_theory_info name (fn (tex_source, html_source, html) =>
   189   (tex_source, Buffer.add txt html_source, html));
   194   (tex_source, Buffer.add txt html_source, html));
   190 
   195 
   191 fun add_html name txt = change_theory_info name (fn (tex_source, html_source, html) =>
   196 fun add_html name txt = change_theory_info name (fn (tex_source, html_source, html) =>