260 (case try get_entries dir of |
260 (case try get_entries dir of |
261 NONE => warning ("Browser info: cannot access session index of " ^ Path.print dir) |
261 NONE => warning ("Browser info: cannot access session index of " ^ Path.print dir) |
262 | SOME es => (put_entries ((remove (op =) name es) @ [name]) dir; create_index dir))); |
262 | SOME es => (put_entries ((remove (op =) name es) @ [name]) dir; create_index dir))); |
263 |
263 |
264 |
264 |
265 (* document versions *) |
265 (* document variants *) |
266 |
266 |
267 fun read_version str = |
267 fun read_variant str = |
268 (case space_explode "=" str of |
268 (case space_explode "=" str of |
269 [name] => (name, "") |
269 [name] => (name, "") |
270 | [name, tags] => (name, tags) |
270 | [name, tags] => (name, tags) |
271 | _ => error ("Malformed document version specification: " ^ quote str)); |
271 | _ => error ("Malformed document variant specification: " ^ quote str)); |
272 |
272 |
273 fun read_versions strs = |
273 fun read_variants strs = |
274 rev (distinct (eq_fst (op =)) (rev ((documentN, "") :: map read_version strs))) |
274 rev (distinct (eq_fst (op =)) (rev ((documentN, "") :: map read_variant strs))) |
275 |> filter_out (fn (_, s) => s = "-"); |
275 |> filter_out (fn (_, s) => s = "-"); |
276 |
276 |
277 |
277 |
278 (* init session *) |
278 (* init session *) |
279 |
279 |
280 fun name_of_session elems = space_implode "/" ("Isabelle" :: elems); |
280 fun name_of_session elems = space_implode "/" ("Isabelle" :: elems); |
281 |
281 |
282 fun init build info doc doc_graph doc_versions path name doc_prefix2 |
282 fun init build info doc doc_graph doc_variants path name doc_prefix2 |
283 (remote_path, first_time) verbose thys = CRITICAL (fn () => |
283 (remote_path, first_time) verbose thys = CRITICAL (fn () => |
284 if not build andalso not info andalso doc = "" andalso is_none doc_prefix2 then |
284 if not build andalso not info andalso doc = "" andalso is_none doc_prefix2 then |
285 (browser_info := empty_browser_info; session_info := NONE) |
285 (browser_info := empty_browser_info; session_info := NONE) |
286 else |
286 else |
287 let |
287 let |
294 if doc = "" then (NONE, []) |
294 if doc = "" then (NONE, []) |
295 else if not (File.exists document_path) then |
295 else if not (File.exists document_path) then |
296 (if verbose then Output.raw_stderr "Warning: missing document directory\n" else (); |
296 (if verbose then Output.raw_stderr "Warning: missing document directory\n" else (); |
297 (NONE, [])) |
297 (NONE, [])) |
298 else (SOME (Path.append html_prefix document_path, html_prefix), |
298 else (SOME (Path.append html_prefix document_path, html_prefix), |
299 read_versions doc_versions); |
299 read_variants doc_variants); |
300 |
300 |
301 val parent_index_path = Path.append Path.parent index_path; |
301 val parent_index_path = Path.append Path.parent index_path; |
302 val index_up_lnk = if first_time then |
302 val index_up_lnk = if first_time then |
303 Url.append (the remote_path) (Url.File (Path.append sess_prefix parent_index_path)) |
303 Url.append (the remote_path) (Url.File (Path.append sess_prefix parent_index_path)) |
304 else Url.File parent_index_path; |
304 else Url.File parent_index_path; |