Skip to content

Instantly share code, notes, and snippets.

Created April 2, 2017 09:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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" ::
val singlePageCmd: List[String] = xsltool :: dbOptions ++
List("-o", "handbook/index.html",
s"$dbPath/onechunk.xsl", file.toString)
val multiPageCmd: List[String] = xsltool :: dbOptions ++
List("-o", "handbook-pages/",
s"$dbPath/chunk.xsl", file.toString)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment