blob: 277169fdff3b7bc62c232e630827828157e65a44 (
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
26
27
|
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(node: DocumentationNode, link: DocumentationNode, extension: String): Location {
val ownerFolder = location(node).file.getParentFile()!!
val memberPath = location(link).file.appendExtension(extension)
return Location(ownerFolder.getRelativePath(memberPath))
}
fun LocationService.relativeLocation(location: Location, link: DocumentationNode, extension: String): Location {
val ownerFolder = location.file.getParentFile()!!
val memberPath = location(link).file.appendExtension(extension)
return Location(ownerFolder.getRelativePath(memberPath))
}
|