asciidoctor / asciidoctor-gradle-examples

A collection of example projects that demonstrates how to use the Asciidoctor Gradle plugin
http://asciidoctor.github.io/asciidoctor-gradle-examples
Other
147 stars 136 forks source link

could you explain the build script snippet #51

Open oneslideicywater opened 4 years ago

oneslideicywater commented 4 years ago
// what's this asciidoctj for?
asciidoctorj {
    version = '1.5.5'
}

asciidoctor {
// there seem to be a syntax error in ItelliJ idea,what's "\" is for?
// but weird it works. are the lines below "\" is a Map? 
    attributes \
        'build-gradle': file('build.gradle'),
        'sourcedir': project.sourceSets.main.java.srcDirs[0],
        'endpoint-url': 'http://example.org',
        'source-highlighter': 'coderay',
        'imagesdir': './images',
        //'toc': 'left',
        'icons': 'font',
        'setanchors': '',
        'idprefix': '',
        'idseparator': '-'
        //'docinfo1': ''
}

I also refer to Ascidoc plugin which is quite different from the syntax in your build script!

ggrossetie commented 4 years ago

Hello @oneslideicywater

// what's this asciidoctorj for?

asciidoctorj is the processor, see https://github.com/asciidoctor/asciidoctorj The block defines the version we want to use but it's optional (ie. when you apply the plugin it comes with a default version).

there seem to be a syntax error in IntelliJ idea,what's "\" is for? but weird it works. are the lines below "\" is a Map?

IntelliJ does like the \ but it's still a valid Gradle file. I believe the backslash is to use a nice indentation but you can remove it and use:

asciidoctor {
    attributes 'build-gradle': file('build.gradle'),
        'sourcedir': project.sourceSets.main.java.srcDirs[0],
        'endpoint-url': 'http://example.org',
        'source-highlighter': 'coderay'
        // ...
}