Using AsciiDoctor diagram from JBake (under Gradle)

261 views
Skip to first unread message

Sean Gilligan

unread,
Aug 21, 2015, 2:12:45 AM8/21/15
to JBake Users
I have successfully configured and used the AsciiDoctor Diagram feature using the Gradle AsciiDoctor plugin. See:
https://github.com/OmniLayer/OmniJ/blob/master/gradle/asciidoctor.gradle

I would really like to be able to do the same thing in a JBake site to generate diagrams from text.

Has anyone done this? If so, how would I configure it?

It looks like there was specific integration of JRuby Gems in the Gradle AsciiDoctor plugin (e.g. gemPath property in the asciidoctor closure)

Thanks in advance,

Sean

Jonathan Bullock

unread,
Sep 29, 2015, 8:04:32 AM9/29/15
to Sean Gilligan, JBake Users
Hi Sean,

Apologies for the delay in replying.

I believe Robert Panzer got this working: https://twitter.com/bobbytank42/status/564066267645378560

Jon

--
You received this message because you are subscribed to the Google Groups "JBake Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbake-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Frank Becker

unread,
Sep 20, 2016, 5:22:56 PM9/20/16
to JBake Users
Hi Sean,

this is a nice idea.
I have bad news and good news for you. It is not possible with 2.4.0 of jbake. In this version it is not possible to configure options for asciidoctor.
But it will be possible with 2.5.0. See https://github.com/jbake-org/jbake/pull/269.

I'll post an example on how to use asciidoctorj-diagram with the jbake gradle plugin.

Here is a short example of how to configure a gradle driven jbake project:

buildscript {
  repositories
{
      maven
{ url "http://dl.bintray.com/calmdev/gradle-plugins" } //<1>
      mavenLocal
()
      jcenter
()
 
}

  dependencies
{
    classpath
'me.champeau.gradle:jbake-gradle-plugin:0.3.0-alpha.1' //<2>
    classpath
'org.asciidoctor:asciidoctorj-diagram:1.5.0' //<3>
 
}
}

apply plugin
: 'me.champeau.jbake'

repositories
{
  mavenLocal
()
  jcenter
()
}

jbake
{
  version
= "2.5.0-SNAPSHOT"
  asciidoctorjVersion
= "1.5.4.1"
  configuration
['site.host'] = "http://example.org"
  configuration
['render.tags'] = true
  configuration
['site.contextPath'] = "/blog"
  configuration
['asciidoctor.option.requires'] = "asciidoctor-diagram"
  configuration
['asciidoctor.attributes'] = [
   
"sourceDir=${projectDir}",
   
"imagesdir=${config.server.contextPath}img",
   
"imagesoutdir=${bake.input}/assets/img/diagrams",
   
"source-highlighter=highlight.js",
   
"icons=font"
 
]
}

That's very cool :)
You can set the gempath and use the upstream ruby version if you want to.
Hope that helps.

Frank Becker

unread,
Sep 20, 2016, 5:33:13 PM9/20/16
to JBake Users
Ups. Sorry. The imagesoutdir should be ${bake.input}/assets/img/
The rendered img-tag uses imagesdir as src to the images rendered by ascidoctor-diagram.
Like <img src="/blog/img/asciidoctor-diagram-classes.png" alt="asciidoctor diagram classes" width="270" height="283">
for a diagram like

[plantuml, "asciidoctor-diagram-classes", "png"]
----
class BlockProcessor
class DiagramBlock
class DitaaBlock
class PlantUmlBlock

BlockProcessor <|-- DiagramBlock
DiagramBlock <|-- DitaaBlock
DiagramBlock <|-- PlantUmlBlock
----



Frank Becker

unread,
Sep 20, 2016, 6:37:37 PM9/20/16
to JBake Users
Here we go. An example of using asciidoctor-diagram with jbake.

https://www.calmdevelopment.de/blog/2016/09/jbake-asciidoctor-diagram.html


Am Freitag, 21. August 2015 08:12:45 UTC+2 schrieb Sean Gilligan:
Reply all
Reply to author
Forward
0 new messages