From a0bfdbd8cc365cb11c26e81ee7587f0ec25df79d Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Mon, 14 Jul 2014 15:00:33 +0400 Subject: Location services, formatting services, initial self-documentation output. --- src/Locations/LocationService.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/Locations/LocationService.kt (limited to 'src/Locations/LocationService.kt') diff --git a/src/Locations/LocationService.kt b/src/Locations/LocationService.kt new file mode 100644 index 00000000..03f22d08 --- /dev/null +++ b/src/Locations/LocationService.kt @@ -0,0 +1,18 @@ +package org.jetbrains.dokka + +import java.io.File + +data class Location(val file: File) + +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): File { + val ownerFolder = location(node).file.getParentFile()!! + val memberPath = location(link).file.appendExtension(extension) + return ownerFolder.getRelativePath(memberPath) +} -- cgit