aboutsummaryrefslogtreecommitdiff
path: root/src/Locations
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-12-22 09:50:17 +0200
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-12-22 09:50:17 +0200
commit18399493263820cf6098603025802ddf862f1920 (patch)
treeb8c915c272cdc484df2b511ad50a9ff829c33612 /src/Locations
parentbd6cddd932c308519ce386197b93de145462bec2 (diff)
downloaddokka-18399493263820cf6098603025802ddf862f1920.tar.gz
dokka-18399493263820cf6098603025802ddf862f1920.tar.bz2
dokka-18399493263820cf6098603025802ddf862f1920.zip
Document some types in Dokka and fix to make them work.
Diffstat (limited to 'src/Locations')
-rw-r--r--src/Locations/LocationService.kt26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Locations/LocationService.kt b/src/Locations/LocationService.kt
index 3c3ed3e1..cb0a5670 100644
--- a/src/Locations/LocationService.kt
+++ b/src/Locations/LocationService.kt
@@ -2,22 +2,48 @@ package org.jetbrains.dokka
import java.io.File
+/**
+ * Represents locations in the documentation in the form of [path](File).
+ *
+ * Locations are provided by [LocationService.location] function.
+ *
+ * $file: [File] for this location
+ * $path: [String] representing path of this location
+ */
public data class Location(val file: File) {
public val path : String
get() = file.path
}
+/**
+ * Provides means of retrieving locations for [DocumentationNode](documentation nodes)
+ *
+ * `LocationService` determines where documentation for particular node should be generated
+ *
+ * * [FoldersLocationService] – represent packages and types as folders, members as files in those folders.
+ * * [SingleFolderLocationService] – all documentation is generated into single folder using fully qualified names
+ * for file names.
+ */
public trait LocationService {
+ /**
+ * Calculates location for particular node in output structure
+ */
fun location(node: DocumentationNode): Location
}
public fun escapeUri(path: String): String = path.replace('<', '-').replace('>', '-')
+/**
+ * Returns relative location between two nodes. Used for relative links in documentation.
+ */
fun LocationService.relativeLocation(owner: DocumentationNode, node: DocumentationNode, extension: String): Location {
return relativeLocation(location(owner), node, extension)
}
+/**
+ * Returns relative location between base location and a node. Used for relative links in documentation.
+ */
fun LocationService.relativeLocation(owner: Location, node: DocumentationNode, extension: String): Location {
val ownerFolder = owner.file.getParentFile()!!
val memberPath = location(node).file.appendExtension(extension)