src/Pure/Thy/present.ML
changeset 27491 c8178a6a6480
parent 27329 91c0c894e1b4
child 27862 8f727f7c8c1d
equal deleted inserted replaced
27490:ac1d6e87aa52 27491:c8178a6a6480
   181     (Symtab.update (name, info) theories, files, tex_index, html_index, graph));
   181     (Symtab.update (name, info) theories, files, tex_index, html_index, graph));
   182 
   182 
   183 fun change_theory_info name f =
   183 fun change_theory_info name f =
   184   change_browser_info (fn (info as (theories, files, tex_index, html_index, graph)) =>
   184   change_browser_info (fn (info as (theories, files, tex_index, html_index, graph)) =>
   185     (case Symtab.lookup theories name of
   185     (case Symtab.lookup theories name of
   186       NONE => (warning ("Browser info: cannot access theory document " ^ quote name); info)
   186       NONE => error ("Browser info: cannot access theory document " ^ quote name)
   187     | SOME info => (Symtab.update (name, map_theory_info f info) theories, files,
   187     | SOME info => (Symtab.update (name, map_theory_info f info) theories, files,
   188         tex_index, html_index, graph)));
   188         tex_index, html_index, graph)));
   189 
   189 
   190 
   190 
   191 fun add_file file =
   191 fun add_file file =
   472           let
   472           let
   473             val base = Path.base path;
   473             val base = Path.base path;
   474             val base_html = html_ext base;
   474             val base_html = html_ext base;
   475             val _ = add_file (Path.append html_prefix base_html,
   475             val _ = add_file (Path.append html_prefix base_html,
   476               HTML.ml_file (Url.File base) (File.read path));
   476               HTML.ml_file (Url.File base) (File.read path));
   477           in (SOME (Url.File base_html), Url.File raw_path, loadit) end
   477             in (Url.File base_html, Url.File raw_path, loadit) end
   478       | NONE =>
   478       | NONE => error ("Browser info: expected to find ML file" ^ quote (Path.implode raw_path)));
   479           (warning ("Browser info: expected to find ML file" ^ quote (Path.implode raw_path));
   479 
   480             (NONE, Url.File raw_path, loadit)));
   480     val files_html = map prep_file files;
   481 
   481 
   482     fun prep_html_source (tex_source, html_source, html) =
   482     fun prep_html_source (tex_source, html_source, html) =
   483       let
   483       let
   484         val txt = HTML.begin_theory (Url.File index_path, session)
   484         val txt = HTML.begin_theory (Url.File index_path, session)
   485           name parent_specs (map prep_file files) (Buffer.content html_source)
   485           name parent_specs files_html (Buffer.content html_source)
   486       in (tex_source, Buffer.empty, Buffer.add txt html) end;
   486       in (tex_source, Buffer.empty, Buffer.add txt html) end;
   487 
   487 
   488     val entry =
   488     val entry =
   489      {name = name, ID = ID_of path name, dir = sess_name, unfold = true,
   489      {name = name, ID = ID_of path name, dir = sess_name, unfold = true,
   490       path = Path.implode (html_path name),
   490       path = Path.implode (html_path name),