Skip to content

Commit

Permalink
Merge pull request #129 from oalyman/add_asciidoctor-diagram
Browse files Browse the repository at this point in the history
Add asciidoctor-diagram support

Fixes #76
  • Loading branch information
jonas authored May 18, 2018
2 parents 01e7dc7 + 15f2fe0 commit 8398c13
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
5 changes: 3 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/sbt-test/asciidoctor/can-use-asciidoctor/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")}")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
+-----------------------------------+
....

0 comments on commit 8398c13

Please sign in to comment.