Closed robertpanzer closed 7 years ago
Also tested with the current Gradle plugin with this build file and it seems to work fine:
(Rendering the test document from the AsciidoctorGroovyDSLSpec.groovy
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3'
}
}
apply plugin: 'org.asciidoctor.convert'
asciidoctorj {
version = '1.6.0-alpha.3'
groovyDslVersion = '1.6.0-SNAPSHOT'
}
group 'org.asciidoctor'
version '1.0-SNAPSHOT'
repositories {
jcenter ()
mavenLocal()
}
asciidoctor {
extensions {
block(name: 'BIG', contexts: [':paragraph']) {
parent, reader, attributes ->
def upperLines = reader.readLines()
.collect {it.toUpperCase()}
.inject('') {a, b -> a + '\n' + b}
createBlock(parent, 'paragraph', [upperLines], attributes, [:])
}
block('small') {
parent, reader, attributes ->
def lowerLines = reader.readLines()
.collect {it.toLowerCase()}
.inject('') {a, b -> a + '\n' + b}
createBlock(parent, 'paragraph', [lowerLines], attributes, [:])
}
blockmacro('capitalize') {
parent, target, attributes ->
def capitalLines = target.toLowerCase()
.tokenize('_')
.collect { it.capitalize() }
.join(' ')
createBlock(parent, 'pass', [capitalLines], attributes)
}
inline_macro('man') {
parent, target, attributes ->
def options = ["type": ":link", "target": target + ".html"]
createPhraseNode(parent, "anchor", target, attributes, options).convert()
}
}
}
Moves the Groovy DSL to work on top of AsciidoctorJ 1.6.0-alpha.3