prefer relative src_path (if possible) -- in contrast to 9ce0aa145d21:
authorwenzelm
Fri, 06 Jan 2023 17:58:49 +0100
changeset 76937 099486b09c0e
parent 76936 ee785742c694
child 76938 2e849cebd65e
prefer relative src_path (if possible) -- in contrast to 9ce0aa145d21:
src/Pure/Thy/browser_info.scala
--- a/src/Pure/Thy/browser_info.scala	Fri Jan 06 17:20:53 2023 +0100
+++ b/src/Pure/Thy/browser_info.scala	Fri Jan 06 17:58:49 2023 +0100
@@ -614,6 +614,8 @@
           node_context(theory.thy_file, session_dir).
             make_html(thy_elements, snapshot.xml_markup(elements = thy_elements.html)))
 
+      val master_dir = Path.explode(snapshot.node_name.master_dir)
+
       val files =
         for {
           blob_name <- snapshot.node_files.tail
@@ -623,15 +625,18 @@
         yield {
           progress.expose_interrupt()
 
-          val file_name = blob_name.node
-          if (verbose) progress.echo("Presenting file " + quote(file_name))
+          val file = blob_name.node
+          if (verbose) progress.echo("Presenting file " + quote(file))
 
-          val file_html = session_dir + context.file_html(file_name)
+          val file_html = session_dir + context.file_html(file)
           val file_dir = file_html.dir
           val html_link = HTML.relative_href(file_html, base = Some(session_dir))
-          val html = context.source(node_context(file_name, file_dir).make_html(thy_elements, xml))
+          val html = context.source(node_context(file, file_dir).make_html(thy_elements, xml))
 
-          val file_title = "File " + Symbol.cartouche_decoded(file_name)
+          val path = Path.explode(file)
+          val src_path = File.relative_path(master_dir, path).getOrElse(path)
+
+          val file_title = "File " + Symbol.cartouche_decoded(src_path.implode_short)
           HTML.write_document(file_dir, file_html.file_name,
             List(HTML.title(file_title)), List(context.head(file_title), html),
             root = Some(context.root_dir))