-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
103 lines (83 loc) · 2.29 KB
/
build.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
buildscript {
repositories {
maven {
url "http://maven.aliyun.com/nexus/content/groups/public/"
}
jcenter()
mavenCentral()
}
}
plugins {
// id "org.asciidoctor.jvm.convert" version "2.3.0"
// id "org.asciidoctor.jvm.pdf" version "2.3.0"
id "org.asciidoctor.jvm.convert" version "3.0.0-alpha.3"
id "org.asciidoctor.jvm.pdf" version "3.0.0-alpha.3"
}
allprojects {
repositories {
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
maven { url "https://dl.bintray.com/someok/maven" }
jcenter()
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
version = '1.0.0'
// 将 asciidoctor 和 asciidoctorPdf 两个 task 中通用的 attributes 统一放置在一起
asciidoctorj {
modules {
pdf.version = '1.5.0-beta.2'
}
// 语法高亮,可选项有 coderay, highlightjs, prettify, pygments
// 为保证生成的 html5 和 pdf 均有语法高亮,所以启用 coderay
// 使用其它几个选项还需要做不少额外的工作,没有必要
attributes 'source-highlighter': 'coderay'
}
asciidoctor {
logDocuments true
sources {
include 'example.adoc'
}
baseDirFollowsSourceDir()
// 强制每次都重新生成
outputs.upToDateWhen { false }
outputOptions {
backends = ['html5']
}
// 下述几个属性可将 css 从内嵌到 html5 页面改为外联的 css 文件
// attributes 'linkcss': true
// attributes 'stylesdir': 'css/'
// attributes 'stylesheet': 'asciidoctor.css'
}
pdfThemes {
// 思源黑体
local 'KaiGenGothicCN', {
styleDir = file('data/themes')
styleName = 'KaiGenGothicCN'
}
// 思源宋体
local 'SourceHanSerifCN', {
styleDir = file('data/themes')
styleName = 'SourceHanSerifCN'
}
}
asciidoctorPdf {
logDocuments true
sources {
include 'example.adoc'
}
baseDirFollowsSourceDir()
// 强制每次都重新生成
outputs.upToDateWhen { false }
fontsDir file('data/fonts')
// theme 'KaiGenGothicCN'
theme 'SourceHanSerifCN'
}
// 同时生成 html5 和 pdf
task generateAll {
dependsOn asciidoctor, asciidoctorPdf
doLast {
println 'generate html5 and pdf over!'
}
}