1 minute to read
createReferenceDoc
Before You Begin
Install pandoc.
About This Task
This task creates a reference docx file used by pandoc during docbook-to-docx conversion.
Use task convertToDocx
to edit this file so it uses your preferred styles.
Important
|
The contents of the reference docx are ignored, but its stylesheets and document properties (including margins, page size, header and footer) are used in the new docx. For more information, see Pandoc User’s Guide: Options affecting specific writers (--reference-doc) And if you have problems with changing the default table style: see https://github.com/jgm/pandoc/issues/3275. |
Config.groovy Notes
The 'referenceDocFile' property must be set to your custom reference file in Config.groovy:
inputPath = '.'
// use a style reference file in the input path for conversion from docbook to docx
referenceDocFile = "${inputPath}/my-ref-file.docx"
Source
Show source code of scripts/pandoc.gradle
or go directly to GitHub · docToolchain/scripts/pandoc.gradle.
task createReferenceDoc (
group: 'docToolchain helper',
description: 'creates a docx file to be used as a format style reference in task convertToDocx. Needs pandoc installed.',
type: Exec
) {
workingDir "$docDir"
executable = "pandoc"
args = ["-o", "${docDir}/${referenceDocFile}",
"--print-default-data-file",
"reference.docx"]
doFirst {
if(!(referenceDocFile?.trim())) {
throw new GradleException("Option `referenceDocFile` is not defined in config.groovy or has an empty value.")
}
}
}
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.