generateDocbook

Johannes Thorn Jody Winter Jeremie Bresson Ralf D. Müller

1 minute to read

About This Task

A helper task, generateDocbook generates the intermediate format for convertToDocx<<>> and convertToEpub.

Source

Show source code of scripts/AsciiDocBasics.gradle or go directly to GitHub · docToolchain/scripts/AsciiDocBasics.gradle.
scripts/AsciiDocBasics.gradle
task generateDocbook (
        type: AsciidoctorTask,
        group: 'docToolchain',
        description: 'use docbook as asciidoc backend') {

    def sourceFilesDOCBOOK = findSourceFilesByType(['docbook', 'epub', 'docx'])
//    onlyIf {
//        sourceFilesDOCBOOK
//    }

    sources {
        sourceFilesDOCBOOK.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 DOCBOOK config does not exist!
                Please check the configuration 'inputFiles' in $mainConfigFile.""")
            }
        }
    }

    outputOptions {
        backends = ['docbook']
    }

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

    doFirst {
        if (sourceFilesDOCBOOK.size()==0) {
            throw new Exception ("""
            >> No source files defined for type of '[docbook, epub, docx]'.
            >> Please specify at least one inputFile in your docToolchainConfig.groovy
            """)
        }
    }
}