Jody Winter Jeremie Bresson Ralf D. Müller Dr. Stefan Pfeiffer

1 minute to read

At a Glance


About This Task

This task makes use of the asciidoctor-reveal.js backend to render your documents into a 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.


task generateDeck (
        type: AsciidoctorTask,
        group: 'docToolchain',
        description: 'use revealJs as asciidoc backend to create a presentation') {

    attributes (
            'idprefix': 'slide-',
            'idseparator': '-',
            'docinfo1': '',
            'revealjs_theme': 'black@',
            'revealjs_progress': 'true@',
            'revealjs_touch': 'true@',
            'revealjs_hideAddressBar': 'true@',
            'revealjs_transition': 'linear@',
            'revealjs_history': 'true@',
            'revealjs_slideNumber': 'true@'
    options template_dirs : [new File(new File (projectDir,'/resources/asciidoctor-reveal.js'),'templates').absolutePath ]

    def sourceFilesREVEAL = sourceFiles.findAll {
        'revealjs' in it.formats
//    onlyIf {
//        sourceFilesREVEAL
//    }

    sources {
        sourceFilesREVEAL.each {
            include 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('resources') {
            include 'reveal.js/**'
        from(sourceDir) {
            include 'images/**'
        into("") "${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