@@ -105,10 +105,9 @@ subprojects {
105
105
runCatching {
106
106
upload.GitHub .upload(
107
107
file,
108
- " https://api.github.com/repos/mamoe/mirai-repo/contents/shadow/${project.name} /$filename " ,
109
108
project,
110
109
" mirai-repo" ,
111
- " shadow/"
110
+ " shadow/${project.name} / $filename "
112
111
)
113
112
}.exceptionOrNull()?.let {
114
113
System .err.println (" GitHub Upload failed" )
@@ -138,27 +137,45 @@ subprojects {
138
137
val dokkaGitHubUpload by tasks.creating {
139
138
group = " mirai"
140
139
141
- dependsOn(tasks.getByName(" dokkaMarkdown " ))
140
+ dependsOn(tasks.getByName(" dokkaGfm " ))
142
141
doFirst {
143
- val baseDir = file(" ./build/dokka-markdown " )
142
+ val baseDir = file(" ./build/dokka-gfm/ ${project.name} " )
144
143
145
144
timeout.set(Duration .ofHours(6 ))
146
- file(" build/dokka-markdown /" ).walk()
145
+ file(" build/dokka-gfm /" ).walk()
147
146
.filter { it.isFile }
148
147
.map { old ->
149
148
if (old.name == " index.md" ) File (old.parentFile, " README.md" ).also { new -> old.renameTo(new) }
150
149
else old
151
150
}
152
151
.forEach { file ->
152
+ if (file.endsWith(" .md" )) {
153
+ file.writeText(
154
+ file.readText().replace(" index.md" , " README.md" , ignoreCase = true )
155
+ .replace(Regex (""" ```\n([\s\S]*?)```""" )) {
156
+ " \n " + """
157
+ ```kotlin
158
+ $it
159
+ ```
160
+ """ .trimIndent()
161
+ })
162
+ } /* else if (file.name == "README.md") {
163
+ file.writeText(file.readText().replace(Regex("""(\n\n\|\s)""")) {
164
+ "\n\n" + """"
165
+ |||
166
+ |:----------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
167
+ |
168
+ """.trimIndent()
169
+ })
170
+ }*/
153
171
val filename = file.toRelativeString(baseDir)
154
172
println (" Uploading file $filename " )
155
173
runCatching {
156
174
upload.GitHub .upload(
157
175
file,
158
- " https://api.github.com/repos/mamoe/mirai-doc/contents/${project.name} /$filename " ,
159
176
project,
160
177
" mirai-doc" ,
161
- " "
178
+ " ${project.name} / ${project.version} / $filename "
162
179
)
163
180
}.exceptionOrNull()?.let {
164
181
System .err.println (" GitHub Upload failed" )
0 commit comments