aboutsummaryrefslogtreecommitdiff
path: root/plugins/javadoc/src/main/kotlin
diff options
context:
space:
mode:
authorAlex Saveau <asaveau@google.com>2020-07-14 20:39:22 +0000
committerMarcin Aman <maman@virtuslab.com>2020-07-22 19:48:43 +0200
commitaca4731ccad3d57aa8b4f6fab250ed3a72e394c4 (patch)
tree5708fb99fdfcc7f53b0d0f64a598ca18aa6e4097 /plugins/javadoc/src/main/kotlin
parent3a33418e26dc3c70521e89e8ec01f2eb045a6f02 (diff)
downloaddokka-aca4731ccad3d57aa8b4f6fab250ed3a72e394c4.tar.gz
dokka-aca4731ccad3d57aa8b4f6fab250ed3a72e394c4.tar.bz2
dokka-aca4731ccad3d57aa8b4f6fab250ed3a72e394c4.zip
Follow Javadoc file path convention
The current file path looks like `/androidx.fragment.app/package-summary.html` which is non-standard. This CL changes the path to look like `/androidx/fragment/app/package-summary.html`.
Diffstat (limited to 'plugins/javadoc/src/main/kotlin')
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/location/JavadocLocationProvider.kt11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/location/JavadocLocationProvider.kt b/plugins/javadoc/src/main/kotlin/javadoc/location/JavadocLocationProvider.kt
index 49278b06..0ce20c78 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/location/JavadocLocationProvider.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/location/JavadocLocationProvider.kt
@@ -18,7 +18,10 @@ class JavadocLocationProvider(pageRoot: RootPageNode, dokkaContext: DokkaContext
private val pathIndex = IdentityHashMap<PageNode, List<String>>().apply {
fun registerPath(page: PageNode, prefix: List<String> = emptyList()) {
- val newPrefix = prefix + page.takeIf { it is JavadocPackagePageNode }?.name.orEmpty()
+ val packagePath = page.takeIf { it is JavadocPackagePageNode }?.name.orEmpty()
+ .replace(".", "/")
+ val newPathPrefix = prefix + packagePath
+
val path = (prefix + when (page) {
is AllClassesPage -> listOf("allclasses")
is TreeViewPage -> if (page.classes == null)
@@ -28,14 +31,14 @@ class JavadocLocationProvider(pageRoot: RootPageNode, dokkaContext: DokkaContext
is ContentPage -> if (page.dri.isNotEmpty() && page.dri.first().classNames != null)
listOfNotNull(page.dri.first().classNames)
else if (page is JavadocPackagePageNode)
- listOf(page.name, "package-summary")
+ listOf(packagePath, "package-summary")
else
listOf("index")
else -> emptyList()
}).filterNot { it.isEmpty() }
put(page, path)
- page.children.forEach { registerPath(it, newPrefix) }
+ page.children.forEach { registerPath(it, newPathPrefix) }
}
put(pageRoot, listOf("index"))
@@ -123,4 +126,4 @@ class JavadocLocationProvider(pageRoot: RootPageNode, dokkaContext: DokkaContext
override fun ancestors(node: PageNode): List<PageNode> {
TODO("Not yet implemented")
}
-} \ No newline at end of file
+}