Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert a Docbook-structured Scaml file to single-page/multi-page HTML Raw
// convert the HAML/SCAML layout file to Docbook XML
val engine = new org.fusesource.scalate.TemplateEngine
val output = engine.layout("src/main/docbook/handbook.scaml")
val file = (target in Compile).value / "handbook.xml"
IO.write(file, output)
// create Docbook HTML
import scala.sys.process._
// TODO make this independent of local user's environment
val xsltool = "xsltproc"
val dbPath = "/usr/share/xml/docbook/stylesheet/nwalsh5/1.79.0/html"
val dbOptions = "--stringparam" :: "section.autolabel" :: "1" ::
"--stringparam" :: "section.label.includes.component.label" :: "1" ::
"--stringparam" :: "chunker.output.encoding" :: "UTF-8" ::
Nil
val singlePageCmd: List[String] = xsltool :: dbOptions ++
List("-o", "handbook/index.html",
s"$dbPath/onechunk.xsl", file.toString)
singlePageCmd.!
val multiPageCmd: List[String] = xsltool :: dbOptions ++
List("-o", "handbook-pages/",
s"$dbPath/chunk.xsl", file.toString)
multiPageCmd.!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.