Last active
June 15, 2021 00:19
-
-
Save aalmiray/7369b977a68baca32e13 to your computer and use it in GitHub Desktop.
Simple Gradle build file for Asciidoctor + Diagram + PDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2' | |
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.6' | |
classpath 'com.github.jruby-gradle:jruby-gradle-plugin:0.1.11' | |
classpath 'com.github.ben-manes:gradle-versions-plugin:0.7' | |
classpath 'com.bluepapa32:gradle-watch-plugin:0.1.4' | |
} | |
} | |
apply plugin: 'org.asciidoctor.convert' | |
apply plugin: 'com.github.jruby-gradle.base' | |
apply plugin: 'com.github.ben-manes.versions' | |
apply plugin: 'com.bluepapa32.watch' | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
gems 'rubygems:asciidoctor-diagram:1.2.1' | |
} | |
asciidoctor { | |
// let jruby-gradle download and install gems | |
dependsOn jrubyPrepareGems | |
// include the diagram gem | |
requires = ['asciidoctor-diagram'] | |
gemPath = jrubyPrepareGems.outputDir | |
options doctype: 'book' | |
// let's convert to PDF while we're at it | |
backends = ['html5', 'pdf'] | |
attributes 'source-highlighter' : 'coderay', | |
'coderay-linenums-mode' : 'table', | |
toc : 'left', | |
icon : 'font', | |
linkattrs : true, | |
encoding : 'utf-8' | |
resources { | |
from('src/docs/asciidoc') { | |
include '**/*.png' | |
} | |
} | |
} | |
// any changes made to the watched sources will trigger an execution of the 'asciidoctor' task | |
watch { | |
asciidoc { | |
files fileTree(dir: 'src/docs/asciidoc', include: '**/*.adoc') | |
tasks 'asciidoctor' | |
} | |
} |
Thanks for this, and looking forward to 1.5.3 :)
Thanks for this excellent template!
Could it be that the attribute 'icon' should be named 'icons'? At least that's what I had to change to make admonition icons rendered correctly with Font Awesome.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Be advised that asciidoctorj 1.5.3 will enable the usage of asciidoctor-diagram without the need of the jruby-gradle plugin 😄