57 { |
59 { |
58 import XML.Encode._ |
60 import XML.Encode._ |
59 File.write(dir + sessions_path, YXML.string_of_body(list(pair(string, string))(sessions))) |
61 File.write(dir + sessions_path, YXML.string_of_body(list(pair(string, string))(sessions))) |
60 } |
62 } |
61 |
63 |
62 def update_chapter_index(info_path: Path, chapter: String, new_sessions: List[(String, String)]) |
64 def update_chapter_index(browser_info: Path, chapter: String, new_sessions: List[(String, String)]) |
63 { |
65 { |
64 val dir = info_path + Path.basic(chapter) |
66 val dir = browser_info + Path.basic(chapter) |
65 Isabelle_System.mkdirs(dir) |
67 Isabelle_System.mkdirs(dir) |
66 |
68 |
67 val sessions0 = |
69 val sessions0 = |
68 try { read_sessions(dir) } |
70 try { read_sessions(dir) } |
69 catch { case _: XML.Error => Nil } |
71 catch { case _: XML.Error => Nil } |
71 val sessions = (SortedMap.empty[String, String] ++ sessions0 ++ new_sessions).toList |
73 val sessions = (SortedMap.empty[String, String] ++ sessions0 ++ new_sessions).toList |
72 |
74 |
73 write_sessions(dir, sessions) |
75 write_sessions(dir, sessions) |
74 File.write(dir + index_path, HTML.chapter_index(chapter, sessions)) |
76 File.write(dir + index_path, HTML.chapter_index(chapter, sessions)) |
75 } |
77 } |
|
78 |
|
79 def make_global_index(browser_info: Path) |
|
80 { |
|
81 if (!(browser_info + Path.explode("index.html")).is_file) { |
|
82 Isabelle_System.mkdirs(browser_info) |
|
83 File.copy(Path.explode("~~/lib/logo/isabelle.gif"), |
|
84 browser_info + Path.explode("isabelle.gif")) |
|
85 File.write(browser_info + Path.explode("index.html"), |
|
86 File.read(Path.explode("~~/lib/html/library_index_header.template")) + |
|
87 File.read(Path.explode("~~/lib/html/library_index_content.template")) + |
|
88 File.read(Path.explode("~~/lib/html/library_index_footer.template"))) |
|
89 } |
|
90 } |
|
91 |
|
92 |
|
93 /* finish session */ |
|
94 |
|
95 def finish( |
|
96 progress: Progress, |
|
97 browser_info: Path, |
|
98 graph_file: JFile, |
|
99 info: Build.Session_Info, |
|
100 name: String) |
|
101 { |
|
102 val session_prefix = browser_info + Path.basic(info.chapter) + Path.basic(name) |
|
103 |
|
104 if (info.options.bool("browser_info")) { |
|
105 Isabelle_System.mkdirs(session_prefix) |
|
106 File.copy(graph_file, (session_prefix + Path.basic("session_graph.pdf")).file) |
|
107 File.copy(Path.explode("~~/etc/isabelle.css"), session_prefix) |
|
108 } |
|
109 } |
76 } |
110 } |