asciidoctor / asciidoctor-gradle-plugin

A Gradle plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
https://asciidoctor.github.io/asciidoctor-gradle-plugin/
Apache License 2.0
285 stars 120 forks source link

Attributes (source-highlighter, revealjs_hash) are ignored by org.asciidoctor.jvm.revealjs plugin #632

Open ghilainm opened 2 years ago

ghilainm commented 2 years ago

I have added attributes to the revealjs configuration but they seem to be totally ignored.

I could not use the rouge source-highlither and the hash does not seem to be taken into account.

I tried various ways but no way to get it to work.

Could you add an example in the documentation or clarify how it is supposed to work? Maybe it is simply not supported.

By the way, it does not work either to specify standard option (slide number and so on) via attributes as they seem to be overridden by the plugin. Maybe that should be part of documentation also.

Command line: ./gradlew clean asciidoctorRevealJs --no-build-cache --debug Gradle: distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip

Gradle file:

plugins {
    id("org.asciidoctor.jvm.convert") version "3.3.2"
    id("org.asciidoctor.jvm.revealjs") version "3.3.2"
    id("org.asciidoctor.jvm.gems") version "3.3.2"
}

repositories {
    mavenCentral()
}

val repositoriesInternal = repositories as ExtensionAware
repositoriesInternal.extensions.configure(com.github.jrubygradle.api.core.RepositoryHandlerExtension::class) {
    gems()
}

asciidoctorj {
    modules.diagram.use()
    modules.diagram.setVersion("2.2.1")
    setVersion("2.5.2")
}

tasks.asciidoctor {
    baseDirFollowsSourceFile()
}

revealjs {
    version = "4.1.0"
    templateGitHub {
        setOrganisation("hakimel")
        setRepository("reveal.js")
        setTag("3.9.2")
    }
}

tasks.asciidoctorRevealJs {
    group = "documentation "
    baseDirFollowsSourceFile()
    sourceDir("${project.projectDir}/src/docs/asciidoc")
    sources {
        include("demo-*.adoc")
    }
    theme = "black"
    attributes.putAll(mapOf(
        "revealjs_hash" to "true",
        "source-highlighter" to "rouge"
    ))
    revealjsOptions {
        setSlideNumber(true)
        setProgressBar(true)
        setPushToHistory(true)
    }
}

tasks.build.configure {
    dependsOn(tasks.asciidoctorRevealJs, tasks.asciidoctor)
}