privatedef contents_lines(): List[(Path, String)] = for {
dir <- dirs()
catalog = dir + Path.basic("Contents") if catalog.is_file
line <- Library.trim_split_lines(File.read(catalog))
} yield (dir, line)
object Contents { def apply(sections: List[Section]): Contents = new Contents(sections)
def examples(ml_settings: ML_Settings): Contents = { val env = Isabelle_System.Settings(putenv = List(ml_settings.ml_sources_root))
Contents.section("Examples", true,
Path.split(Isabelle_System.getenv_strict("ISABELLE_DOCS_EXAMPLES")).map(file =>
plain_file(file, env = env) match { case Some(entry) => entry case None => error("Bad entry in ISABELLE_DOCS_EXAMPLES: " + file)
}))
}
def main_contents(): Contents = { val result = new mutable.ListBuffer[Section] val entries = new mutable.ListBuffer[Entry] var section: Option[Section] = None
def flush(): Unit = if (section.nonEmpty) {
result += section.get.copy(entries = entries.toList)
entries.clear()
section = None
}
val Section_ = """^(\S.*)\s*$""".r val Entry_ = """^\s+(\S+)\s+(.+)\s*$""".r
for ((dir, line) <- contents_lines()) {
line match { case Section_(text) =>
Library.try_unsuffix("!", text) match { case None => begin(Section(text, false, Nil)) case Some(txt) => begin(Section(txt, true, Nil))
} case Entry_(name, title) => val path = dir + Path.basic(name)
entries += Entry(name, if (path.is_file) path else path.pdf, title = title) case _ =>
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.