src/Pure/PIDE/resources.scala
changeset 74756 a6c7a257b713
parent 74755 510296c0d8d1
child 75393 87ebf5a50283
equal deleted inserted replaced
74755:510296c0d8d1 74756:a6c7a257b713
    17   def empty: Resources =
    17   def empty: Resources =
    18     new Resources(Sessions.Structure.empty, Sessions.Structure.empty.bootstrap)
    18     new Resources(Sessions.Structure.empty, Sessions.Structure.empty.bootstrap)
    19 
    19 
    20   def file_node(file: Path, dir: String = "", theory: String = ""): Document.Node.Name =
    20   def file_node(file: Path, dir: String = "", theory: String = ""): Document.Node.Name =
    21     empty.file_node(file, dir = dir, theory = theory)
    21     empty.file_node(file, dir = dir, theory = theory)
       
    22 
       
    23   def hidden_node(name: Document.Node.Name): Boolean =
       
    24     !name.is_theory || name.theory == Sessions.root_name || File_Format.registry.is_theory(name)
       
    25 
       
    26   def html_document(snapshot: Document.Snapshot): Option[Presentation.HTML_Document] =
       
    27     File_Format.registry.get(snapshot.node_name).flatMap(_.html_document(snapshot))
    22 }
    28 }
    23 
    29 
    24 class Resources(
    30 class Resources(
    25   val sessions_structure: Sessions.Structure,
    31   val sessions_structure: Sessions.Structure,
    26   val session_base: Sessions.Base,
    32   val session_base: Sessions.Base,
    61     File_Format.registry.get(name).flatMap(_.make_theory_name(resources, name))
    67     File_Format.registry.get(name).flatMap(_.make_theory_name(resources, name))
    62 
    68 
    63   def make_theory_content(thy_name: Document.Node.Name): Option[String] =
    69   def make_theory_content(thy_name: Document.Node.Name): Option[String] =
    64     File_Format.registry.get_theory(thy_name).flatMap(_.make_theory_content(resources, thy_name))
    70     File_Format.registry.get_theory(thy_name).flatMap(_.make_theory_content(resources, thy_name))
    65 
    71 
    66   def is_hidden(name: Document.Node.Name): Boolean =
       
    67     !name.is_theory || name.theory == Sessions.root_name || File_Format.registry.is_theory(name)
       
    68 
       
    69   def html_document(snapshot: Document.Snapshot): Option[Presentation.HTML_Document] =
       
    70     File_Format.registry.get(snapshot.node_name).flatMap(_.html_document(snapshot))
       
    71 
       
    72 
    72 
    73   /* file-system operations */
    73   /* file-system operations */
    74 
    74 
    75   def append(dir: String, source_path: Path): String =
    75   def append(dir: String, source_path: Path): String =
    76     (Path.explode(dir) + source_path).expand.implode
    76     (Path.explode(dir) + source_path).expand.implode