-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdoc.gradle
46 lines (42 loc) · 1.29 KB
/
doc.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.7'
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16'
}
}
apply plugin: org.asciidoctor.gradle.AsciidoctorPlugin
asciidoctor {
sources {
include "index.asciidoc"
}
outputDir file("${buildDir}/asciidoc")
//TODO remove once a working combination of asciidoctorj, asciidoctorj-pdf and asciidoctor-gradle-plugin is found
if (JavaVersion.current().isJava9Compatible()) {
backends = ['html5']
}
else {
backends = ['html5', 'pdf']
}
logDocuments = true
options = [
doctype: 'book'
]
attributes docinfo: '',
toc2: '',
'compat-mode': '',
'allow-uri-read': '',
appversion: version,
'source-highlighter': 'coderay'
doLast {
file("$outputDir/pdf/index.pdf").renameTo ("$outputDir/pdf/{{cookiecutter.project_name}}-user-guide-${version}.pdf")
}
}
task docsZip(type: Zip, dependsOn: asciidoctor) {
baseName = '{{cookiecutter.project_name}}-docs'
from("${buildDir}/asciidoc/pdf/{{cookiecutter.project_name}}-user-guide-${version}.pdf") { into ("docs/") }
from("${buildDir}/asciidoc/html5/index.html") { into("docs/") }
from("${buildDir}/asciidoc/html5/images") { into("images/") }
}