blob: 6bfa9446a7ddf14d8f2acded3637fb35575f4314 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package org.jetbrains.dokka
import java.io.File
public fun FoldersLocationService(root: String): FoldersLocationService = FoldersLocationService(File(root))
public class FoldersLocationService(val root: File) : LocationService {
override fun location(node: DocumentationNode): Location {
val parts = node.path.map { escapeUri(it.name) }
val folder = if (node.members.none()) {
// leaf node, use file in owner's folder
parts.joinToString("/", limit = parts.size - 1, truncated = "") + "/" + parts.last()
} else {
parts.joinToString("/") + (if (parts.none()) "" else "/") + "index"
}
return Location(File(root, folder))
}
}
|