--- a/src/Pure/General/http.scala Mon Feb 21 20:31:30 2022 +0100
+++ b/src/Pure/General/http.scala Mon Feb 21 20:50:01 2022 +0100
@@ -302,7 +302,7 @@
/** Isabelle services **/
def isabelle_services: List[Service] =
- List(new Welcome(), new Fonts(), new PDFjs())
+ List(new Welcome(), new Fonts(), new PDFjs(), new Docs())
/* welcome */
@@ -348,4 +348,23 @@
s = p.implode if s.startsWith("build/") || s.startsWith("web/")
} yield Response.read(path)
}
-}
\ No newline at end of file
+
+
+ /* docs */
+
+ class Docs(name: String = "docs") extends PDFjs(name)
+ {
+ private val doc_contents = isabelle.Doc.main_contents()
+
+ def doc_request(request: Request): Option[Response] =
+ for {
+ p <- request.uri_path if p.is_pdf
+ s = p.implode if s.startsWith("pdf/")
+ name = p.base.split_ext._1.implode
+ doc <- doc_contents.docs.find(_.name == name)
+ } yield Response.read(doc.path.pdf)
+
+ override def apply(request: Request): Option[Response] =
+ doc_request(request) orElse super.apply(request)
+ }
+}
--- a/src/Pure/General/path.scala Mon Feb 21 20:31:30 2022 +0100
+++ b/src/Pure/General/path.scala Mon Feb 21 20:50:01 2022 +0100
@@ -215,6 +215,7 @@
}
def is_java: Boolean = ends_with(".java")
def is_scala: Boolean = ends_with(".scala")
+ def is_pdf: Boolean = ends_with(".pdf")
def ext(e: String): Path =
if (e == "") this