diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2008-06-09 13:11:17 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2008-06-09 13:11:17 +0000 |
commit | d6b6402e4cfc42757df3113beb1302e400c6cb26 (patch) | |
tree | db4d31b40c5142bf7b085a5c841eba63bdac2362 /src/manual | |
parent | 3e7f5eaa1f5719d723406d2367cb351db16bdcd8 (diff) | |
download | scala-d6b6402e4cfc42757df3113beb1302e400c6cb26.tar.gz scala-d6b6402e4cfc42757df3113beb1302e400c6cb26.tar.bz2 scala-d6b6402e4cfc42757df3113beb1302e400c6cb26.zip |
let supersabbus genarte man pages.
Diffstat (limited to 'src/manual')
-rw-r--r-- | src/manual/scala/tools/docutil/EmitHtml.scala | 5 | ||||
-rw-r--r-- | src/manual/scala/tools/docutil/EmitManPage.scala | 4 | ||||
-rw-r--r-- | src/manual/scala/tools/docutil/ManMaker.scala | 53 |
3 files changed, 62 insertions, 0 deletions
diff --git a/src/manual/scala/tools/docutil/EmitHtml.scala b/src/manual/scala/tools/docutil/EmitHtml.scala index 7db4523696..a16190804a 100644 --- a/src/manual/scala/tools/docutil/EmitHtml.scala +++ b/src/manual/scala/tools/docutil/EmitHtml.scala @@ -356,4 +356,9 @@ object EmitHtml { exit(1) } } + + def emitHtml(classname: String, outStream: java.io.OutputStream) { + out.setOut(outStream) + main(Array(classname)) + } } diff --git a/src/manual/scala/tools/docutil/EmitManPage.scala b/src/manual/scala/tools/docutil/EmitManPage.scala index 72ed289b1c..c9108a891e 100644 --- a/src/manual/scala/tools/docutil/EmitManPage.scala +++ b/src/manual/scala/tools/docutil/EmitManPage.scala @@ -177,4 +177,8 @@ object EmitManPage { exit(1) } + def emitManPage(classname: String, outStream: java.io.OutputStream) { + out.setOut(outStream) + main(Array(classname)) + } } diff --git a/src/manual/scala/tools/docutil/ManMaker.scala b/src/manual/scala/tools/docutil/ManMaker.scala new file mode 100644 index 0000000000..2ef87fb7ec --- /dev/null +++ b/src/manual/scala/tools/docutil/ManMaker.scala @@ -0,0 +1,53 @@ +package scala.tools.docutil + +import org.apache.tools.ant.Task + +import java.io.{File, FileOutputStream} + +class ManMaker extends Task { + + /** The command for which to generate the man page */ + private var command: List[String] = Nil + + /** The directory to put html pages in */ + private var htmlout: Option[File] = None + + /** The directory to put man pags in */ + private var manout: Option[File] = None + + + def setCommand(input: String) { + command = List.fromArray(input.split(",")).flatMap { s => + val st = s.trim() + if (st != "") List(st) else Nil + } + } + + def setHtmlout(input: File) { + htmlout = Some(input) + } + + def setManout(input: File) { + manout = Some(input) + } + + override def execute() { + if (command.isEmpty) error("Attribute 'command' is not set.") + if (htmlout.isEmpty) error("Attribute 'htmlout' is not set.") + if (manout.isEmpty) error("Attribute 'manout' is not set.") + + command foreach (cmd => { + val classname = "scala.man1."+ cmd + + val htmlFileName = htmlout.get.getPath + File.separator + + cmd + ".html" + val htmlFile = new java.io.FileOutputStream(htmlFileName) + EmitHtml.emitHtml(classname, htmlFile) + + val manFileName = manout.get.getPath + File.separator + + "man1" + File.separator + cmd + ".1" + val manFile = new FileOutputStream(manFileName) + EmitManPage.emitManPage(classname, manFile) + }) + } +} |