asciidoctor / asciidoctorj-groovy-dsl

A Groovy DSL that allows for easy definition of Asciidoctor extensions
Apache License 2.0
14 stars 3 forks source link

Quickstart start throws "unresolved dependency" error #15

Open gtoast opened 6 years ago

gtoast commented 6 years ago

The version number declared in the Quickstart code isn't valid. Running it throws an error about asciidoctorj-groovy-dsl being an "unresolved dependency". Here's a corrected version of the code, using the latest version of the dsl:

@GrabConfig(systemClassLoader=true)
@Grab(group='org.asciidoctor', module='asciidoctorj-groovy-dsl', version='1.6.0-alpha.1')
import org.asciidoctor.groovydsl.AsciidoctorExtensions
import org.asciidoctor.Asciidoctor

AsciidoctorExtensions.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, [:])
    }
}
Asciidoctor.Factory.create().render('''
[BIG]
Hello World
''', [:])
robertpanzer commented 6 years ago

Thank you for finding this! Would you like to submit a pull request?