More accurate treatment of sty files: do not just copy from all examples.

This commit is contained in:
Makarius Wenzel 2022-10-24 21:58:10 +02:00
parent 15feeb7d92
commit 5ac41a72ac
1 changed files with 8 additions and 9 deletions

View File

@ -31,7 +31,6 @@
package isabelle.dof
import isabelle._
import java.io.{File => JFile}
object DOF_Document_Build
@ -59,22 +58,22 @@ object DOF_Document_Build
File.content(path, xml).output(latex_output(_, file_pos = path.implode_symbolic))
.write(directory.doc_dir)
}
val dof_home= Path.explode(Isabelle_System.getenv_strict("ISABELLE_DOF_HOME"));
val dof_home = Path.explode(Isabelle_System.getenv_strict("ISABELLE_DOF_HOME"));
// print(context.options.string("dof_url"));
// copy Isabelle/DOF LaTeX templates
val template_dir = dof_home + Path.explode("src/document-templates/")
val template_dir = dof_home + Path.explode("src/document-templates")
// TODO: error handling in case 1) template does not exist or 2) root.tex does already exist
val template = regex.replaceAllIn(context.options.string("dof_template"),"")
Isabelle_System.copy_file(template_dir + Path.explode("root-"+template+".tex"),
directory.doc_dir+Path.explode("root.tex"))
// copy Isabelle/DOF LaTeX styles
val doc_jdir = new JFile(directory.doc_dir.implode)
val styles = File.find_files(new JFile(dof_home.implode),((f:JFile) => f.getName().endsWith(".sty")), true)
for (sty <- styles) {
Isabelle_System.copy_file(sty, doc_jdir)
}
// copy Isabelle/DOF LaTeX styles
List(Path.explode("src/DOF/latex"), Path.explode("src/ontologies"))
.flatMap(dir =>
File.find_files((dof_home + dir).file,
file => file.getName.endsWith(".sty"), include_dirs = true))
.foreach(sty => Isabelle_System.copy_file(sty, directory.doc_dir.file))
// create ontology.sty
val ltx_styles = context.options.string("dof_ontologies").split(" +").map(s => regex.replaceAllIn(s,""))