src/Pure/Thy/presentation.scala
author wenzelm
Mon, 17 May 2021 16:15:25 +0200
changeset 73718 ecb31c3bf980
parent 73529 cf1a1e92bf34
child 74670 b2604cd4d131
permissions -rw-r--r--
clarified modules;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
73718
ecb31c3bf980 clarified modules;
wenzelm
parents: 73529
diff changeset
     1
/*  Title:      Pure/Thy/presentation.scala
50707
5b2bf7611662 maintain session index on Scala side, for more determistic results;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
5b2bf7611662 maintain session index on Scala side, for more determistic results;
wenzelm
parents:
diff changeset
     3
73718
ecb31c3bf980 clarified modules;
wenzelm
parents: 73529
diff changeset
     4
HTML presentation of PIDE document content.
50707
5b2bf7611662 maintain session index on Scala side, for more determistic results;
wenzelm
parents:
diff changeset
     5
*/
5b2bf7611662 maintain session index on Scala side, for more determistic results;
wenzelm
parents:
diff changeset
     6
5b2bf7611662 maintain session index on Scala side, for more determistic results;
wenzelm
parents:
diff changeset
     7
package isabelle
5b2bf7611662 maintain session index on Scala side, for more determistic results;
wenzelm
parents:
diff changeset
     8
5b2bf7611662 maintain session index on Scala side, for more determistic results;
wenzelm
parents:
diff changeset
     9
51402
b05cd411d3d3 include session description in chapter index;
wenzelm
parents: 51399
diff changeset
    10
import scala.collection.immutable.SortedMap
b05cd411d3d3 include session description in chapter index;
wenzelm
parents: 51399
diff changeset
    11
b05cd411d3d3 include session description in chapter index;
wenzelm
parents: 51399
diff changeset
    12
72652
07edf1952ab1 clarified modules;
wenzelm
parents: 72650
diff changeset
    13
object Presentation
50707
5b2bf7611662 maintain session index on Scala side, for more determistic results;
wenzelm
parents:
diff changeset
    14
{
72957
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
    15
  /** HTML documents **/
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
    16
73718
ecb31c3bf980 clarified modules;
wenzelm
parents: 73529
diff changeset
    17
  /* HTML context */
ecb31c3bf980 clarified modules;
wenzelm
parents: 73529
diff changeset
    18
72962
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    19
  val fonts_path = Path.explode("fonts")
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    20
72957
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
    21
  sealed case class HTML_Document(title: String, content: String)
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
    22
72959
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    23
  def html_context(fonts_url: String => String = HTML.fonts_url()): HTML_Context =
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    24
    new HTML_Context(fonts_url)
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    25
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    26
  final class HTML_Context private[Presentation](fonts_url: String => String)
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    27
  {
73340
0ffcad1f6130 tuned --- fewer warnings;
wenzelm
parents: 73317
diff changeset
    28
    def init_fonts(dir: Path): Unit =
72962
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    29
    {
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    30
      val fonts_dir = Isabelle_System.make_directory(dir + fonts_path)
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    31
      for (entry <- Isabelle_Fonts.fonts(hidden = true))
73317
df49ca5da9d0 clarified modules: more like ML;
wenzelm
parents: 73277
diff changeset
    32
        Isabelle_System.copy_file(entry.path, fonts_dir)
72962
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    33
    }
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    34
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    35
    def head(title: String, rest: XML.Body = Nil): XML.Tree =
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    36
      HTML.div("head", HTML.chapter(title) :: rest)
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    37
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    38
    def source(body: XML.Body): XML.Tree = HTML.pre("source", body)
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    39
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    40
    def contents(heading: String, items: List[XML.Body], css_class: String = "contents")
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    41
      : List[XML.Elem] =
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    42
    {
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    43
      if (items.isEmpty) Nil
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    44
      else List(HTML.div(css_class, List(HTML.section(heading), HTML.itemize(items))))
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    45
    }
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
    46
72959
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    47
    def output_document(title: String, body: XML.Body): String =
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    48
      HTML.output_document(
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    49
        List(
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    50
          HTML.style(HTML.fonts_css(fonts_url) + "\n\n" + File.read(HTML.isabelle_css)),
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    51
          HTML.title(title)),
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    52
        List(HTML.source(body)), css = "", structural = false)
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    53
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    54
    def html_document(title: String, body: XML.Body): HTML_Document =
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    55
      HTML_Document(title, output_document(title, body))
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    56
  }
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
    57
72957
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
    58
73055
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    59
  /* presentation elements */
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    60
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    61
  sealed case class Elements(
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    62
    html: Markup.Elements = Markup.Elements.empty,
73056
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
    63
    entity: Markup.Elements = Markup.Elements.empty,
73055
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    64
    language: Markup.Elements = Markup.Elements.empty)
72957
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
    65
73055
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    66
  val elements1: Elements =
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    67
    Elements(
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    68
      html =
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    69
        Rendering.foreground_elements ++ Rendering.text_color_elements +
73056
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
    70
        Markup.NUMERAL + Markup.COMMENT + Markup.ENTITY + Markup.LANGUAGE,
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
    71
      entity = Markup.Elements(Markup.THEORY))
73036
b028e8d22d8d clarified HTML presentation elements;
wenzelm
parents: 73028
diff changeset
    72
73055
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    73
  val elements2: Elements =
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    74
    Elements(
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    75
      html = elements1.html ++ Rendering.markdown_elements,
73056
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
    76
      language = Markup.Elements(Markup.Language.DOCUMENT))
73055
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    77
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    78
73718
ecb31c3bf980 clarified modules;
wenzelm
parents: 73529
diff changeset
    79
  /* HTML output */
73036
b028e8d22d8d clarified HTML presentation elements;
wenzelm
parents: 73028
diff changeset
    80
72957
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
    81
  private val div_elements =
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
    82
    Set(HTML.div.name, HTML.pre.name, HTML.par.name, HTML.list.name, HTML.enum.name,
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
    83
      HTML.descr.name)
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
    84
73056
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
    85
  def make_html(
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
    86
    elements: Elements,
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
    87
    entity_link: (Properties.T, XML.Body) => Option[XML.Tree],
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
    88
    xml: XML.Body): XML.Body =
73054
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
    89
  {
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
    90
    def html_div(html: XML.Body): Boolean =
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
    91
      html exists {
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
    92
        case XML.Elem(markup, body) => div_elements.contains(markup.name) || html_div(body)
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
    93
        case XML.Text(_) => false
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
    94
      }
72957
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
    95
73055
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    96
    def html_class(c: String, html: XML.Body): XML.Body =
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    97
      if (c == "") html
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    98
      else if (html_div(html)) List(HTML.div(c, html))
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
    99
      else List(HTML.span(c, html))
72957
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   100
73054
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   101
    def html_body(xml_body: XML.Body): XML.Body =
73055
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
   102
      xml_body flatMap {
73059
523806d71dea proper treatment of XML.Wrapped_Elem, e.g. Markup.class_parameter;
wenzelm
parents: 73057
diff changeset
   103
        case XML.Wrapped_Elem(markup, _, body) => html_body(List(XML.Elem(markup, body)))
73056
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   104
        case XML.Elem(Markup(Markup.ENTITY, props @ Markup.Kind(kind)), body) =>
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   105
          val body1 = html_body(body)
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   106
          if (elements.entity(kind)) {
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   107
            entity_link(props, body1) match {
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   108
              case Some(link) => List(link)
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   109
              case None => body1
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   110
            }
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   111
          }
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   112
          else body1
73055
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
   113
        case XML.Elem(Markup(Markup.LANGUAGE, Markup.Name(name)), body) =>
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
   114
          html_class(if (elements.language(name)) name else "", html_body(body))
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
   115
        case XML.Elem(Markup(Markup.MARKDOWN_PARAGRAPH, _), body) =>
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
   116
          List(HTML.par(html_body(body)))
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
   117
        case XML.Elem(Markup(Markup.MARKDOWN_ITEM, _), body) =>
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
   118
          List(HTML.item(html_body(body)))
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
   119
        case XML.Elem(Markup(Markup.Markdown_Bullet.name, _), _) => Nil
73054
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   120
        case XML.Elem(Markup.Markdown_List(kind), body) =>
73055
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
   121
          if (kind == Markup.ENUMERATE) List(HTML.enum(html_body(body)))
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
   122
          else List(HTML.list(html_body(body)))
73054
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   123
        case XML.Elem(markup, body) =>
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   124
          val name = markup.name
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   125
          val html =
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   126
            markup.properties match {
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   127
              case Markup.Kind(kind) if kind == Markup.COMMAND || kind == Markup.KEYWORD =>
73055
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
   128
                html_class(kind, html_body(body))
73054
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   129
              case _ =>
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   130
                html_body(body)
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   131
            }
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   132
          Rendering.foreground.get(name) orElse Rendering.text_color.get(name) match {
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   133
            case Some(c) => html_class(c.toString, html)
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   134
            case None => html_class(name, html)
72957
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   135
          }
73054
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   136
        case XML.Text(text) =>
73055
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
   137
          HTML.text(Symbol.decode(text))
73054
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   138
      }
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   139
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   140
    html_body(xml)
517b17e54d28 tuned signature;
wenzelm
parents: 73043
diff changeset
   141
  }
72957
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   142
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   143
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   144
  /* PIDE HTML document */
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   145
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   146
  def html_document(
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   147
    resources: Resources,
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   148
    snapshot: Document.Snapshot,
72962
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
   149
    html_context: HTML_Context,
73055
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
   150
    elements: Elements,
72959
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
   151
    plain_text: Boolean = false): HTML_Document =
72957
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   152
  {
73120
c3589f2dff31 more informative errors: simplify diagnosis of spurious failures reported by users;
wenzelm
parents: 73059
diff changeset
   153
    require(!snapshot.is_outdated, "document snapshot outdated")
72957
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   154
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   155
    val name = snapshot.node_name
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   156
    if (plain_text) {
72962
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
   157
      val title = "File " + Symbol.cartouche_decoded(name.path.file_name)
72959
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
   158
      val body = HTML.text(snapshot.node.source)
72962
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
   159
      html_context.html_document(title, body)
72957
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   160
    }
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   161
    else {
72962
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
   162
      resources.html_document(snapshot) getOrElse {
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
   163
        val title =
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
   164
          if (name.is_theory) "Theory " + quote(name.theory_base_name)
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
   165
          else "File " + Symbol.cartouche_decoded(name.path.file_name)
73056
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   166
        val body = make_html(elements, (_, _) => None, snapshot.xml_markup(elements = elements.html))
72962
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
   167
        html_context.html_document(title, body)
72957
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   168
      }
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   169
    }
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   170
  }
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   171
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   172
75fc90edc0a8 clarified signature and module structure;
wenzelm
parents: 72956
diff changeset
   173
73718
ecb31c3bf980 clarified modules;
wenzelm
parents: 73529
diff changeset
   174
  /** HTML presentation **/
72649
4ba5b1b08dd5 clarified signature: more explicit types;
wenzelm
parents: 72648
diff changeset
   175
72648
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   176
  /* presentation context */
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   177
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   178
  object Context
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   179
  {
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   180
    val none: Context = new Context { def enabled: Boolean = false }
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   181
    val standard: Context = new Context { def enabled: Boolean = true }
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   182
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   183
    def dir(path: Path): Context =
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   184
      new Context {
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   185
        def enabled: Boolean = true
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   186
        override def dir(store: Sessions.Store): Path = path
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   187
      }
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   188
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   189
    def make(s: String): Context =
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   190
      if (s == ":") standard else dir(Path.explode(s))
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   191
  }
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   192
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   193
  abstract class Context private
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   194
  {
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   195
    def enabled: Boolean
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   196
    def enabled(info: Sessions.Info): Boolean = enabled || info.browser_info
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   197
    def dir(store: Sessions.Store): Path = store.presentation_dir
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   198
    def dir(store: Sessions.Store, info: Sessions.Info): Path =
72670
4db9411c859c tuned signature;
wenzelm
parents: 72669
diff changeset
   199
      dir(store) + Path.explode(info.chapter_session)
72648
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   200
  }
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   201
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   202
72955
942bf91545fa clarified comments: file-system access is always unsynchronized;
wenzelm
parents: 72882
diff changeset
   203
  /* maintain chapter index */
50707
5b2bf7611662 maintain session index on Scala side, for more determistic results;
wenzelm
parents:
diff changeset
   204
51399
6ac3c29a300e discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents: 50707
diff changeset
   205
  private val sessions_path = Path.basic(".sessions")
50707
5b2bf7611662 maintain session index on Scala side, for more determistic results;
wenzelm
parents:
diff changeset
   206
51402
b05cd411d3d3 include session description in chapter index;
wenzelm
parents: 51399
diff changeset
   207
  private def read_sessions(dir: Path): List[(String, String)] =
b05cd411d3d3 include session description in chapter index;
wenzelm
parents: 51399
diff changeset
   208
  {
51416
e2505a192a7c do not absorb I/O errors;
wenzelm
parents: 51406
diff changeset
   209
    val path = dir + sessions_path
e2505a192a7c do not absorb I/O errors;
wenzelm
parents: 51406
diff changeset
   210
    if (path.is_file) {
e2505a192a7c do not absorb I/O errors;
wenzelm
parents: 51406
diff changeset
   211
      import XML.Decode._
65344
b99283eed13c clarified YXML vs. symbol encoding: operate on whole message;
wenzelm
parents: 65089
diff changeset
   212
      list(pair(string, string))(Symbol.decode_yxml(File.read(path)))
51416
e2505a192a7c do not absorb I/O errors;
wenzelm
parents: 51406
diff changeset
   213
    }
e2505a192a7c do not absorb I/O errors;
wenzelm
parents: 51406
diff changeset
   214
    else Nil
51402
b05cd411d3d3 include session description in chapter index;
wenzelm
parents: 51399
diff changeset
   215
  }
50707
5b2bf7611662 maintain session index on Scala side, for more determistic results;
wenzelm
parents:
diff changeset
   216
73340
0ffcad1f6130 tuned --- fewer warnings;
wenzelm
parents: 73317
diff changeset
   217
  private def write_sessions(dir: Path, sessions: List[(String, String)]): Unit =
51402
b05cd411d3d3 include session description in chapter index;
wenzelm
parents: 51399
diff changeset
   218
  {
b05cd411d3d3 include session description in chapter index;
wenzelm
parents: 51399
diff changeset
   219
    import XML.Encode._
b05cd411d3d3 include session description in chapter index;
wenzelm
parents: 51399
diff changeset
   220
    File.write(dir + sessions_path, YXML.string_of_body(list(pair(string, string))(sessions)))
b05cd411d3d3 include session description in chapter index;
wenzelm
parents: 51399
diff changeset
   221
  }
50707
5b2bf7611662 maintain session index on Scala side, for more determistic results;
wenzelm
parents:
diff changeset
   222
73340
0ffcad1f6130 tuned --- fewer warnings;
wenzelm
parents: 73317
diff changeset
   223
  def update_chapter_index(
0ffcad1f6130 tuned --- fewer warnings;
wenzelm
parents: 73317
diff changeset
   224
    browser_info: Path, chapter: String, new_sessions: List[(String, String)]): Unit =
51399
6ac3c29a300e discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents: 50707
diff changeset
   225
  {
72376
04bce3478688 clarified signature;
wenzelm
parents: 72375
diff changeset
   226
    val dir = Isabelle_System.make_directory(browser_info + Path.basic(chapter))
50707
5b2bf7611662 maintain session index on Scala side, for more determistic results;
wenzelm
parents:
diff changeset
   227
51399
6ac3c29a300e discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents: 50707
diff changeset
   228
    val sessions0 =
51406
950b897f95bb proper path -- I/O was hidden due to permissiveness;
wenzelm
parents: 51402
diff changeset
   229
      try { read_sessions(dir) }
51987
7d8e0e3c553b tuned signature;
wenzelm
parents: 51416
diff changeset
   230
      catch { case _: XML.Error => Nil }
51399
6ac3c29a300e discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents: 50707
diff changeset
   231
51402
b05cd411d3d3 include session description in chapter index;
wenzelm
parents: 51399
diff changeset
   232
    val sessions = (SortedMap.empty[String, String] ++ sessions0 ++ new_sessions).toList
65988
8040d2563593 modernized generated HTML;
wenzelm
parents: 65404
diff changeset
   233
    write_sessions(dir, sessions)
51402
b05cd411d3d3 include session description in chapter index;
wenzelm
parents: 51399
diff changeset
   234
65988
8040d2563593 modernized generated HTML;
wenzelm
parents: 65404
diff changeset
   235
    val title = "Isabelle/" + chapter + " sessions"
8040d2563593 modernized generated HTML;
wenzelm
parents: 65404
diff changeset
   236
    HTML.write_document(dir, "index.html",
73523
2cd23d587db9 further clarification of Isabelle distribution identification -- avoid odd patching of sources;
wenzelm
parents: 73474
diff changeset
   237
      List(HTML.title(title + Isabelle_System.isabelle_heading())),
65988
8040d2563593 modernized generated HTML;
wenzelm
parents: 65404
diff changeset
   238
      HTML.chapter(title) ::
8040d2563593 modernized generated HTML;
wenzelm
parents: 65404
diff changeset
   239
       (if (sessions.isEmpty) Nil
8040d2563593 modernized generated HTML;
wenzelm
parents: 65404
diff changeset
   240
        else
65992
50daca61efd6 tuned signature;
wenzelm
parents: 65989
diff changeset
   241
          List(HTML.div("sessions",
50daca61efd6 tuned signature;
wenzelm
parents: 65989
diff changeset
   242
            List(HTML.description(
65988
8040d2563593 modernized generated HTML;
wenzelm
parents: 65404
diff changeset
   243
              sessions.map({ case (name, description) =>
69318
f3351bb4390e clarified presentation;
wenzelm
parents: 69255
diff changeset
   244
                val descr = Symbol.trim_blank_lines(description)
65989
68cd15585f46 tuned layout;
wenzelm
parents: 65988
diff changeset
   245
                (List(HTML.link(name + "/index.html", HTML.text(name))),
69318
f3351bb4390e clarified presentation;
wenzelm
parents: 69255
diff changeset
   246
                  if (descr == "") Nil
f3351bb4390e clarified presentation;
wenzelm
parents: 69255
diff changeset
   247
                  else HTML.break ::: List(HTML.pre(HTML.text(descr)))) })))))))
51399
6ac3c29a300e discontinued "isabelle usedir" option -r (reset session path);
wenzelm
parents: 50707
diff changeset
   248
  }
61372
cf40b6b1de54 more Present operations on Scala side;
wenzelm
parents: 60077
diff changeset
   249
73340
0ffcad1f6130 tuned --- fewer warnings;
wenzelm
parents: 73317
diff changeset
   250
  def make_global_index(browser_info: Path): Unit =
61372
cf40b6b1de54 more Present operations on Scala side;
wenzelm
parents: 60077
diff changeset
   251
  {
cf40b6b1de54 more Present operations on Scala side;
wenzelm
parents: 60077
diff changeset
   252
    if (!(browser_info + Path.explode("index.html")).is_file) {
72375
e48d93811ed7 clarified signature;
wenzelm
parents: 72309
diff changeset
   253
      Isabelle_System.make_directory(browser_info)
73317
df49ca5da9d0 clarified modules: more like ML;
wenzelm
parents: 73277
diff changeset
   254
      Isabelle_System.copy_file(Path.explode("~~/lib/logo/isabelle.gif"),
61372
cf40b6b1de54 more Present operations on Scala side;
wenzelm
parents: 60077
diff changeset
   255
        browser_info + Path.explode("isabelle.gif"))
73528
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   256
      val title = "The " + XML.text(Isabelle_System.isabelle_name()) + " Library"
61372
cf40b6b1de54 more Present operations on Scala side;
wenzelm
parents: 60077
diff changeset
   257
      File.write(browser_info + Path.explode("index.html"),
73529
cf1a1e92bf34 more standard header, with utf-8 encoding;
wenzelm
parents: 73528
diff changeset
   258
        HTML.header +
cf1a1e92bf34 more standard header, with utf-8 encoding;
wenzelm
parents: 73528
diff changeset
   259
"""
73528
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   260
<head>
73529
cf1a1e92bf34 more standard header, with utf-8 encoding;
wenzelm
parents: 73528
diff changeset
   261
  """ + HTML.head_meta + """
73528
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   262
  <title>""" + title + """</title>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   263
</head>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   264
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   265
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#000099" alink="#404040">
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   266
  <center>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   267
    <table width="100%" border="0" cellspacing="10" cellpadding="0">
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   268
      <tr>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   269
        <td width="20%" valign="middle" align="center"><a href="http://isabelle.in.tum.de/"><img align="bottom" src="isabelle.gif" width="100" height="86" alt="[Isabelle]" border="0" /></a></td>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   270
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   271
        <td width="80%" valign="middle" align="center">
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   272
          <table width="90%" border="0" cellspacing="0" cellpadding="20">
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   273
            <tr>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   274
              <td valign="middle" align="center" bgcolor="#AACCCC"><font face="Helvetica,Arial" size="+2">""" + title + """</font></td>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   275
            </tr>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   276
          </table>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   277
        </td>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   278
      </tr>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   279
    </table>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   280
  </center>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   281
  <hr />
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   282
  <ul>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   283
    <li>Higher-Order Logic</li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   284
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   285
    <li style="list-style: none">
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   286
      <ul>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   287
        <li><a href="HOL/index.html">HOL (Higher-Order Logic)</a>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   288
        is a version of classical higher-order logic resembling
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   289
        that of the <a href="http://www.cl.cam.ac.uk/Research/HVG/HOL/">HOL System</a>.
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   290
        </li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   291
      </ul>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   292
    </li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   293
  </ul>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   294
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   295
  <ul>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   296
    <li>First-Order Logic</li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   297
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   298
    <li style="list-style: none">
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   299
      <ul>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   300
        <li><a href="FOL/index.html">FOL (Many-sorted First-Order Logic)</a>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   301
        provides basic classical and intuitionistic first-order logic. It is
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   302
        polymorphic.
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   303
        </li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   304
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   305
        <li><a href="ZF/index.html">ZF (Set Theory)</a>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   306
        offers a formulation of Zermelo-Fraenkel set theory on top of FOL.
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   307
        </li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   308
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   309
        <li><a href="CCL/index.html">CCL (Classical Computational Logic)</a></li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   310
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   311
        <li><a href="LCF/index.html">LCF (Logic of Computable Functions)</a></li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   312
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   313
        <li><a href="FOLP/index.html">FOLP (FOL with Proof Terms)</a></li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   314
      </ul>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   315
    </li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   316
  </ul>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   317
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   318
  <ul>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   319
    <li>Miscellaneous</li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   320
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   321
    <li style="list-style: none">
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   322
      <ul>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   323
        <li><a href="Sequents/index.html">Sequents (first-order, modal and linear logics)</a></li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   324
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   325
        <li><a href="CTT/index.html">CTT (Constructive Type Theory)</a>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   326
        is an extensional version of Martin-L&ouml;f's Type Theory.</li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   327
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   328
        <li><a href="Cube/index.html">Cube (The Lambda Cube)</a></li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   329
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   330
        <li><a href="Pure/index.html">The Pure logical framework</a></li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   331
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   332
        <li><a href="Doc/index.html">Sources of Documentation</a></li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   333
      </ul>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   334
    </li>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   335
  </ul>
c337c798f64c clarified HTML template (see also 04cb7e02ca38): avoid odd patching of sources;
wenzelm
parents: 73523
diff changeset
   336
</body>
73529
cf1a1e92bf34 more standard header, with utf-8 encoding;
wenzelm
parents: 73528
diff changeset
   337
""" + HTML.footer)
61372
cf40b6b1de54 more Present operations on Scala side;
wenzelm
parents: 60077
diff changeset
   338
    }
cf40b6b1de54 more Present operations on Scala side;
wenzelm
parents: 60077
diff changeset
   339
  }
cf40b6b1de54 more Present operations on Scala side;
wenzelm
parents: 60077
diff changeset
   340
cf40b6b1de54 more Present operations on Scala side;
wenzelm
parents: 60077
diff changeset
   341
72622
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   342
  /* present session */
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   343
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   344
  val session_graph_path = Path.explode("session_graph.pdf")
72959
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
   345
  val readme_path = Path.explode("README.html")
a093b8fc9e21 tuned signature: more explicit types;
wenzelm
parents: 72957
diff changeset
   346
  val files_path = Path.explode("files")
72622
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   347
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   348
  def html_name(name: Document.Node.Name): String = name.theory_base_name + ".html"
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   349
73042
22f5a6283477 tuned signature;
wenzelm
parents: 73041
diff changeset
   350
  def theory_link(deps: Sessions.Deps, session0: String,
73057
45a34cc581b8 more robust and permissive;
wenzelm
parents: 73056
diff changeset
   351
    name: Document.Node.Name, body: XML.Body): Option[XML.Tree] =
73042
22f5a6283477 tuned signature;
wenzelm
parents: 73041
diff changeset
   352
  {
22f5a6283477 tuned signature;
wenzelm
parents: 73041
diff changeset
   353
    val session1 = deps(session0).theory_qualifier(name)
73057
45a34cc581b8 more robust and permissive;
wenzelm
parents: 73056
diff changeset
   354
    val info0 = deps.sessions_structure.get(session0)
45a34cc581b8 more robust and permissive;
wenzelm
parents: 73056
diff changeset
   355
    val info1 = deps.sessions_structure.get(session1)
45a34cc581b8 more robust and permissive;
wenzelm
parents: 73056
diff changeset
   356
    if (info0.isDefined && info1.isDefined) {
45a34cc581b8 more robust and permissive;
wenzelm
parents: 73056
diff changeset
   357
      Some(HTML.link(info0.get.relative_path(info1.get) + html_name(name), body))
45a34cc581b8 more robust and permissive;
wenzelm
parents: 73056
diff changeset
   358
    }
45a34cc581b8 more robust and permissive;
wenzelm
parents: 73056
diff changeset
   359
    else None
73042
22f5a6283477 tuned signature;
wenzelm
parents: 73041
diff changeset
   360
  }
22f5a6283477 tuned signature;
wenzelm
parents: 73041
diff changeset
   361
72648
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   362
  def session_html(
72962
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
   363
    resources: Resources,
72648
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   364
    session: String,
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72634
diff changeset
   365
    deps: Sessions.Deps,
72683
b5e6f0d137a7 clarified signature: prefer Database_Context;
wenzelm
parents: 72682
diff changeset
   366
    db_context: Sessions.Database_Context,
72992
bcba32fd89de more interrupts;
wenzelm
parents: 72989
diff changeset
   367
    progress: Progress = new Progress,
73022
38528017e4c8 more verbosity for potentially bulky presentation;
wenzelm
parents: 72992
diff changeset
   368
    verbose: Boolean = false,
72962
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
   369
    html_context: HTML_Context,
73055
3e4df2e689ff clarified signature;
wenzelm
parents: 73054
diff changeset
   370
    elements: Elements,
73340
0ffcad1f6130 tuned --- fewer warnings;
wenzelm
parents: 73317
diff changeset
   371
    presentation: Context): Unit =
61372
cf40b6b1de54 more Present operations on Scala side;
wenzelm
parents: 60077
diff changeset
   372
  {
72622
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   373
    val info = deps.sessions_structure(session)
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   374
    val options = info.options
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   375
    val base = deps(session)
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   376
72683
b5e6f0d137a7 clarified signature: prefer Database_Context;
wenzelm
parents: 72682
diff changeset
   377
    val session_dir = presentation.dir(db_context.store, info)
72962
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
   378
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
   379
    html_context.init_fonts(session_dir)
72622
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   380
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   381
    Bytes.write(session_dir + session_graph_path,
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   382
      graphview.Graph_File.make_pdf(options, base.session_graph_display))
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   383
72673
8ff7a0e394f9 clarified PDF/HTML presentation, based on pdf blobs from session database (e.g. from earlier builds);
wenzelm
parents: 72670
diff changeset
   384
    val documents =
72683
b5e6f0d137a7 clarified signature: prefer Database_Context;
wenzelm
parents: 72682
diff changeset
   385
      for {
b5e6f0d137a7 clarified signature: prefer Database_Context;
wenzelm
parents: 72682
diff changeset
   386
        doc <- info.document_variants
73718
ecb31c3bf980 clarified modules;
wenzelm
parents: 73529
diff changeset
   387
        document <- db_context.input_database(session)(Document_Build.read_document(_, _, doc.name))
73022
38528017e4c8 more verbosity for potentially bulky presentation;
wenzelm
parents: 72992
diff changeset
   388
      } yield {
38528017e4c8 more verbosity for potentially bulky presentation;
wenzelm
parents: 72992
diff changeset
   389
        if (verbose) progress.echo("Presenting document " + session + "/" + doc.name)
38528017e4c8 more verbosity for potentially bulky presentation;
wenzelm
parents: 72992
diff changeset
   390
        Bytes.write(session_dir + doc.path.pdf, document.pdf)
38528017e4c8 more verbosity for potentially bulky presentation;
wenzelm
parents: 72992
diff changeset
   391
        doc
38528017e4c8 more verbosity for potentially bulky presentation;
wenzelm
parents: 72992
diff changeset
   392
      }
72673
8ff7a0e394f9 clarified PDF/HTML presentation, based on pdf blobs from session database (e.g. from earlier builds);
wenzelm
parents: 72670
diff changeset
   393
73041
wenzelm
parents: 73036
diff changeset
   394
    val view_links =
72622
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   395
    {
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   396
      val deps_link =
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   397
        HTML.link(session_graph_path, HTML.text("theory dependencies"))
61372
cf40b6b1de54 more Present operations on Scala side;
wenzelm
parents: 60077
diff changeset
   398
72622
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   399
      val readme_links =
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   400
        if ((info.dir + readme_path).is_file) {
73317
df49ca5da9d0 clarified modules: more like ML;
wenzelm
parents: 73277
diff changeset
   401
          Isabelle_System.copy_file(info.dir + readme_path, session_dir + readme_path)
72622
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   402
          List(HTML.link(readme_path, HTML.text("README")))
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   403
        }
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   404
        else Nil
62971
087e36ce0593 back to exact copy of non-text file (amending dcc8e1d34b18);
wenzelm
parents: 62631
diff changeset
   405
72622
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   406
      val document_links =
72673
8ff7a0e394f9 clarified PDF/HTML presentation, based on pdf blobs from session database (e.g. from earlier builds);
wenzelm
parents: 72670
diff changeset
   407
        documents.map(doc => HTML.link(doc.path.pdf, HTML.text(doc.name)))
72622
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   408
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   409
      Library.separate(HTML.break ::: HTML.nl,
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   410
        (deps_link :: readme_links ::: document_links).
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   411
          map(link => HTML.text("View ") ::: List(link))).flatten
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   412
    }
62971
087e36ce0593 back to exact copy of non-text file (amending dcc8e1d34b18);
wenzelm
parents: 62631
diff changeset
   413
72989
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   414
    val theories: List[XML.Body] =
72962
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
   415
    {
af2d0e07493b present auxiliary files with PIDE markup;
wenzelm
parents: 72959
diff changeset
   416
      var seen_files = List.empty[(Path, String, Document.Node.Name)]
73056
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   417
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   418
      def entity_link(props: Properties.T, body: XML.Body): Option[XML.Tree] =
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   419
        (props, props, props) match {
73057
45a34cc581b8 more robust and permissive;
wenzelm
parents: 73056
diff changeset
   420
          case (Markup.Kind(Markup.THEORY), Markup.Name(theory), Position.Def_File(thy_file)) =>
45a34cc581b8 more robust and permissive;
wenzelm
parents: 73056
diff changeset
   421
            val node_name = resources.file_node(Path.explode(thy_file), theory = theory)
45a34cc581b8 more robust and permissive;
wenzelm
parents: 73056
diff changeset
   422
            theory_link(deps, session, node_name, body)
73056
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   423
          case _ => None
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   424
        }
696819fe2424 present theory using PIDE markup;
wenzelm
parents: 73055
diff changeset
   425
73215
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   426
      sealed case class Theory(
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   427
        name: Document.Node.Name,
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   428
        command: Command,
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   429
        files_html: List[(Path, XML.Tree)],
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   430
        html: XML.Tree)
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   431
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   432
      def read_theory(name: Document.Node.Name): Option[Theory] =
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   433
      {
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   434
        progress.expose_interrupt()
73216
60c32e2c5577 clarified messages;
wenzelm
parents: 73215
diff changeset
   435
        if (verbose) progress.echo("Presenting theory " + name)
73215
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   436
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   437
        for (command <- Build_Job.read_theory(db_context, resources, session, name.theory))
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   438
        yield {
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   439
          val snapshot = Document.State.init.snippet(command)
73214
5de4a6ae6065 more parallel;
wenzelm
parents: 73120
diff changeset
   440
73215
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   441
          val files_html =
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   442
            for {
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   443
              (src_path, xml) <- snapshot.xml_markup_blobs(elements = elements.html)
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   444
              if xml.nonEmpty
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   445
            }
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   446
            yield {
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   447
              progress.expose_interrupt()
73216
60c32e2c5577 clarified messages;
wenzelm
parents: 73215
diff changeset
   448
              if (verbose) progress.echo("Presenting file " + src_path)
60c32e2c5577 clarified messages;
wenzelm
parents: 73215
diff changeset
   449
73215
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   450
              (src_path, html_context.source(make_html(elements, entity_link, xml)))
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   451
            }
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   452
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   453
          val html =
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   454
            html_context.source(
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   455
              make_html(elements, entity_link, snapshot.xml_markup(elements = elements.html)))
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   456
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   457
          Theory(name, command, files_html, html)
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   458
        }
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   459
      }
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   460
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   461
      for (thy <- Par_List.map(read_theory, base.session_theories).flatten)
72669
5e7916535860 generate theory HTML in Isabelle/Scala;
wenzelm
parents: 72665
diff changeset
   462
      yield {
72989
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   463
        val files =
73215
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   464
          for { (src_path, file_html) <- thy.files_html }
73043
759b6869377d misc tuning and clarification;
wenzelm
parents: 73042
diff changeset
   465
          yield {
72989
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   466
            val file_name = (files_path + src_path.squash.html).implode
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   467
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   468
            seen_files.find(p => p._1 == src_path || p._2 == file_name) match {
73215
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   469
              case None => seen_files ::= (src_path, file_name, thy.name)
72989
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   470
              case Some((_, _, thy_name1)) =>
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   471
                error("Incoherent use of file name " + src_path + " as " + quote(file_name) +
73215
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   472
                  " in theory " + thy_name1 + " vs. " + thy.name)
72989
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   473
            }
72669
5e7916535860 generate theory HTML in Isabelle/Scala;
wenzelm
parents: 72665
diff changeset
   474
72989
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   475
            val file_path = session_dir + Path.explode(file_name)
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   476
            html_context.init_fonts(file_path.dir)
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   477
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   478
            val file_title = "File " + Symbol.cartouche_decoded(src_path.implode_short)
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   479
            HTML.write_document(file_path.dir, file_path.file_name,
73215
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   480
              List(HTML.title(file_title)), List(html_context.head(file_title), file_html))
72989
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   481
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   482
            List(HTML.link(file_name, HTML.text(file_title)))
73043
759b6869377d misc tuning and clarification;
wenzelm
parents: 73042
diff changeset
   483
          }
72989
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   484
73215
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   485
        val thy_title = "Theory " + thy.name.theory_base_name
72989
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   486
73215
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   487
        HTML.write_document(session_dir, html_name(thy.name),
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   488
          List(HTML.title(thy_title)), List(html_context.head(thy_title), thy.html))
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   489
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   490
        List(HTML.link(html_name(thy.name),
a81ec42bac45 more parallel;
wenzelm
parents: 73214
diff changeset
   491
          HTML.text(thy.name.theory_base_name) :::
72989
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   492
            (if (files.isEmpty) Nil else List(HTML.itemize(files)))))
72669
5e7916535860 generate theory HTML in Isabelle/Scala;
wenzelm
parents: 72665
diff changeset
   493
      }
72989
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   494
    }
61500
56a167b31a7f Isabelle fonts via external component;
wenzelm
parents: 61484
diff changeset
   495
72622
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   496
    val title = "Session " + session
830222403681 HTML presentation in Isabelle/Scala, based on theory html exports from Isabelle/ML;
wenzelm
parents: 72600
diff changeset
   497
    HTML.write_document(session_dir, "index.html",
73523
2cd23d587db9 further clarification of Isabelle distribution identification -- avoid odd patching of sources;
wenzelm
parents: 73474
diff changeset
   498
      List(HTML.title(title + Isabelle_System.isabelle_heading())),
73041
wenzelm
parents: 73036
diff changeset
   499
      html_context.head(title, List(HTML.par(view_links))) ::
72989
5906162c8dd4 clarified presentation of files for each theory;
wenzelm
parents: 72963
diff changeset
   500
        html_context.contents("Theories", theories))
61372
cf40b6b1de54 more Present operations on Scala side;
wenzelm
parents: 60077
diff changeset
   501
  }
50707
5b2bf7611662 maintain session index on Scala side, for more determistic results;
wenzelm
parents:
diff changeset
   502
}