diff --git a/build.sbt b/build.sbt index 7bb4b1a..d98e4bf 100644 --- a/build.sbt +++ b/build.sbt @@ -6,7 +6,7 @@ name := "sbt-site" organization := "com.typesafe.sbt" -version := "1.3.2" +version := "1.3.3-SNAPSHOT" crossSbtVersions := List("0.13.17", "1.0.4") licenses += ("BSD 3-Clause", url("https://opensource.org/licenses/BSD-3-Clause")) @@ -28,7 +28,8 @@ libraryDependencies ++= Seq( "org.foundweekends" %% "pamflet-library" % "0.7.1", "org.yaml" % "snakeyaml" % "1.13", "com.typesafe" % "config" % "1.2.1", // Last version to support Java 1.6 - "org.asciidoctor" % "asciidoctorj" % "1.5.4" + "org.asciidoctor" % "asciidoctorj" % "1.5.4.1", + "org.asciidoctor" % "asciidoctorj-diagram" % "1.5.4.1" ) addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.3.2") diff --git a/src/main/scala/com/typesafe/sbt/site/asciidoctor/AsciidoctorPlugin.scala b/src/main/scala/com/typesafe/sbt/site/asciidoctor/AsciidoctorPlugin.scala index 381b05b..6ff9f7d 100644 --- a/src/main/scala/com/typesafe/sbt/site/asciidoctor/AsciidoctorPlugin.scala +++ b/src/main/scala/com/typesafe/sbt/site/asciidoctor/AsciidoctorPlugin.scala @@ -43,6 +43,7 @@ object AsciidoctorPlugin extends AutoPlugin { val oldContextClassLoader = Thread.currentThread().getContextClassLoader Thread.currentThread().setContextClassLoader(this.getClass.getClassLoader) val asciidoctor = Factory.create() + asciidoctor.requireLibrary("asciidoctor-diagram") if (!output.exists) output.mkdirs() val options = new Options options.setToDir(output.getAbsolutePath) diff --git a/src/sbt-test/asciidoctor/can-use-asciidoctor/build.sbt b/src/sbt-test/asciidoctor/can-use-asciidoctor/build.sbt index 6ec3fd6..02f2b13 100644 --- a/src/sbt-test/asciidoctor/can-use-asciidoctor/build.sbt +++ b/src/sbt-test/asciidoctor/can-use-asciidoctor/build.sbt @@ -13,6 +13,8 @@ TaskKey[Unit]("checkContent") := { val dest = (target in makeSite).value / (siteSubdirName in Asciidoctor).value val index = dest / "index.html" assert(index.exists, s"${index.getAbsolutePath} did not exist") + val diagram = dest / "asciidoctor-diagram-process.png" + assert(diagram.exists, s"${diagram.getAbsolutePath} did not exist") val content = IO.readLines(index) assert(content.exists(_.contains("sbt")), s"Did not find expected content in:\n${content.mkString("\n")}") } diff --git a/src/sbt-test/asciidoctor/can-use-asciidoctor/src/asciidoctor/index.adoc b/src/sbt-test/asciidoctor/can-use-asciidoctor/src/asciidoctor/index.adoc index 1cc3dbe..97376e1 100644 --- a/src/sbt-test/asciidoctor/can-use-asciidoctor/src/asciidoctor/index.adoc +++ b/src/sbt-test/asciidoctor/can-use-asciidoctor/src/asciidoctor/index.adoc @@ -13,3 +13,23 @@ This is passed from the sbt build: {project-version} [source,ruby] puts "Hello, World!" + +[ditaa,asciidoctor-diagram-process] +.... + +-------------+ + | Asciidoctor |-------+ + | diagram | | + +-------------+ | PNG out + ^ | + | ditaa in | + | v + +--------+ +--------+----+ /---------------\ + | |---+ Asciidoctor +--->| | + | Text | +-------------+ | Beautiful | + |Document| | !magic! | | Output | + | {d}| | | | | + +---+----+ +-------------+ \---------------/ + : ^ + | Lots of work | + +-----------------------------------+ +....