blob: 3c3ed3e19f879a5d28d12f3474014cdee638a615 (
plain)
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
|
package org.jetbrains.dokka
import java.io.File
public data class Location(val file: File) {
public val path : String
get() = file.path
}
public trait LocationService {
fun location(node: DocumentationNode): Location
}
public fun escapeUri(path: String): String = path.replace('<', '-').replace('>', '-')
fun LocationService.relativeLocation(owner: DocumentationNode, node: DocumentationNode, extension: String): Location {
return relativeLocation(location(owner), node, extension)
}
fun LocationService.relativeLocation(owner: Location, node: DocumentationNode, extension: String): Location {
val ownerFolder = owner.file.getParentFile()!!
val memberPath = location(node).file.appendExtension(extension)
return Location(ownerFolder.getRelativePath(memberPath))
}
|