generateDeck

Timo Abele Johannes Thorn Pascal Euhus Jody Winter Jeremie Bresson Ralf D. Müller Dr. Stefan Pfeiffer

1 minute to read

About This Task

This task makes use of the asciidoctor-reveal.js backend to render your documents into an HTML-based presentation. It creates a PowerPoint presentation, then enriches it by adding reveal.js slide definitions in AsciiDoc to the speaker notes. For best results, use this task with the exportPPT task.

Configure RevealJs

docToolchain comes with some opinionated, sane defaults for RevealJs. You can overwrite any of them and provide further configuration as per asciidoctor-reveal.js documentation.

Source

Show source code of scripts/AsciiDocBasics.gradle or go directly to GitHub · docToolchain/scripts/AsciiDocBasics.gradle.
scripts/AsciiDocBasics.gradle
task generateDeck (
    type: AsciidoctorJRevealJSTask,
    group: 'docToolchain',
    description: 'use revealJs as asciidoc backend to create a presentation') {

    // corresponding Asciidoctor reveal.js config
    // :revealjs_theme:
    theme = 'black'

    revealjsOptions {
        // :revealjs_hideAddressBar:
        hideAddressBarOnMobile = 'true'
        // :revealjs_history:
        pushToHistory = 'true'
        // :revealjs_progress:
        progressBar = 'true'
        // :revealjs_slideNumber:
        slideNumber = 'true'
        // :revealjs_touch:
        touchMode = 'true'
        // :revealjs_transition:
        transition = 'linear'
    }

    attributes (
        'idprefix': 'slide-',
        'idseparator': '-',
        'docinfo1': '',
    )

    def sourceFilesREVEAL = findSourceFilesByType(['revealjs'])

    sources {
        sourceFilesREVEAL.each {
            include it.file
            logger.info it.file

            File useFile = new File(srcDir, it.file)
            if (!useFile.exists()) {
                throw new Exception ("""
                The file $useFile in REVEAL config does not exist!
                Please check the configuration 'inputFiles' in $mainConfigFile.""")
            }
        }
    }

    outputDir = file(targetDir+'/decks/')

    resources {
        from(sourceDir) {
            include 'images/**'
        }
        into("")
        logger.info "${docDir}/${config.outputPath}/images"
    }

    doFirst {
        if (sourceFilesREVEAL.size()==0) {
            throw new Exception ("""
            >> No source files defined for type 'revealjs'.
            >> Please specify at least one inputFile in your docToolchainConfig.groovy
            """)
        }
    }
}
generateDeck.dependsOn asciidoctorGemsPrepare