aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.idea/codeStyles/Project.xml15
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt11
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt19
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt4
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt4
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/signatures/JavadocSignatureProvider.kt2
-rw-r--r--plugins/javadoc/src/main/resources/views/class.korte2
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt2
8 files changed, 34 insertions, 25 deletions
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 31d977a0..69ebce06 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -3,18 +3,9 @@
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
- <package name="java.util" alias="false" withSubpackages="false" />
- <package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
- <package name="io.ktor" alias="false" withSubpackages="true" />
- </value>
- </option>
- <option name="PACKAGES_IMPORT_LAYOUT">
- <value>
- <package name="" alias="false" withSubpackages="true" />
- <package name="java" alias="false" withSubpackages="true" />
- <package name="javax" alias="false" withSubpackages="true" />
- <package name="kotlin" alias="false" withSubpackages="true" />
- <package name="" alias="true" withSubpackages="true" />
+ <package name="java.util" withSubpackages="false" static="false" />
+ <package name="kotlinx.android.synthetic" withSubpackages="true" static="false" />
+ <package name="io.ktor" withSubpackages="true" static="false" />
</value>
</option>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt
index 45d8c61f..4e5f2689 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt
@@ -37,13 +37,14 @@ open class JavadocPageCreator(
fun pageForPackage(p: DPackage) =
JavadocPackagePageNode(p.name, contentForPackage(p), setOf(p.dri), p,
- p.classlikes.mapNotNull { pageForClasslike(it) } // TODO: nested classlikes
+ p.classlikes.mapNotNull { pageForClasslike(it) }
)
fun pageForClasslike(c: DClasslike): JavadocClasslikePageNode? =
c.highestJvmSourceSet?.let { jvm ->
+ var children = c.classlikes.mapNotNull { pageForClasslike(it) }
JavadocClasslikePageNode(
- name = c.name.orEmpty(),
+ name = c.dri.classNames.orEmpty(),
content = contentForClasslike(c),
dri = setOf(c.dri),
brief = c.brief(),
@@ -60,7 +61,7 @@ open class JavadocPageCreator(
PropertyContainer.withAll(it.indexesInDocumentation())
)
}.orEmpty(),
- classlikes = c.classlikes.mapNotNull { pageForClasslike(it) },
+ classlikes = children,
properties = c.properties.map {
JavadocPropertyNode(
it.dri,
@@ -71,6 +72,7 @@ open class JavadocPageCreator(
)
},
documentable = c,
+ children = children,
extra = ((c as? WithExtraProperties<Documentable>)?.extra
?: PropertyContainer.empty()) + c.indexesInDocumentation()
)
@@ -102,7 +104,8 @@ open class JavadocPageCreator(
p.jvmSourceSets.toDisplaySourceSets()
) {
title("Package ${p.name}", p.brief(), dri = setOf(p.dri), kind = ContentKind.Packages)
- val rootList = p.classlikes.groupBy { it::class }.map { (key, value) ->
+ fun allClasslikes(c: DClasslike): List<DClasslike> = c.classlikes.flatMap { allClasslikes(it) } + c
+ val rootList = p.classlikes.map { allClasslikes(it) }.flatten().groupBy { it::class }.map { (key, value) ->
JavadocList(key.tabTitle, key.colTitle, value.map { c ->
RowJavadocListEntry(
LinkJavadocListEntry(c.name ?: "", setOf(c.dri), JavadocContentKind.Class, sourceSets),
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
index 4b775f29..a7e10bd5 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
@@ -90,7 +90,8 @@ object IndexGenerator : PageTransformer {
elements.getOrPut(it.name[0].toUpperCase(), ::mutableSetOf).add(it)
}
val keys = elements.keys.sortedBy { it }
- return input.modified(children = input.children + elements.entries.mapIndexed { i, (_, set) ->
+ val sortedElements = elements.entries.sortedBy { (a, _) -> a }
+ return input.modified(children = input.children + sortedElements.mapIndexed { i, (_, set) ->
IndexPage(i + 1, set.sortedBy { it.getId().toLowerCase() }, keys, input.sourceSets())
})
}
@@ -127,10 +128,18 @@ object DeprecatedPageCreator : PageTransformer {
node.children.filterIsInstance<NavigableJavadocNode>().forEach(::verifyDeprecation)
is JavadocClasslikePageNode -> {
node.classlikes.forEach(::verifyDeprecation)
- node.methods.forEach { it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedMethods) }
- node.constructors.forEach { it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedConstructors) }
- node.properties.forEach { it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedFields) }
- node.entries.forEach { it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedEnumConstants) }
+ node.methods.forEach {
+ it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedMethods)
+ }
+ node.constructors.forEach {
+ it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedConstructors)
+ }
+ node.properties.forEach {
+ it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedFields)
+ }
+ node.entries.forEach {
+ it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedEnumConstants)
+ }
node.takeIf { it.isDeprecated() }?.putAs(
if ((node.documentable as? WithSupertypes)?.isException == true) DeprecatedPageSection.DeprecatedExceptions
else when (node.kind) {
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt
index f7305152..15bb625a 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt
@@ -236,6 +236,10 @@ internal class JavadocContentToTemplateMapTranslator(
return mapOf(
"modifiers" to node.signature.modifiers?.let { htmlForContentNode(it, contextNode) },
"signature" to node.name,
+ "address" to locationProvider.resolve(
+ contextNode.children.first { (it as? JavadocClasslikePageNode)?.dri?.first() == node.dri.first() },
+ contextNode
+ ).formatToEndWithHtml(),
"description" to htmlForContentNodes(node.description, node)
)
}
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt
index 9e599285..6c2fed58 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt
@@ -72,8 +72,10 @@ class SearchScriptsCreator(private val locationProvider: LocationProvider) {
url = locationProvider.resolveOrThrow(it).formatToEndWithHtml()
)
} + SearchRecord.allPackages
+ fun allClasses(c: JavadocClasslikePageNode): List<JavadocClasslikePageNode> =
+ c.children.filterIsInstance<JavadocClasslikePageNode>().flatMap { allClasses(it) } + c
val types = input.flatMap {
- it.children.filterIsInstance<JavadocClasslikePageNode>().map { classlike -> it to classlike }
+ it.children.filterIsInstance<JavadocClasslikePageNode>().flatMap { allClasses(it) }.map { classlike -> it to classlike }
}
val updated = accumulator.copy(packageRecords = packages)
return processTypes(types, updated)
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/signatures/JavadocSignatureProvider.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/signatures/JavadocSignatureProvider.kt
index 55a311d9..2183fd1c 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/signatures/JavadocSignatureProvider.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/signatures/JavadocSignatureProvider.kt
@@ -59,7 +59,7 @@ class JavadocSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLo
}
}
signatureWithoutModifiers {
- link(c.name!!, c.dri)
+ link(c.dri.classNames!!, c.dri)
if (c is WithGenerics) {
list(c.generics, prefix = "<", suffix = ">") {
+buildSignature(it)
diff --git a/plugins/javadoc/src/main/resources/views/class.korte b/plugins/javadoc/src/main/resources/views/class.korte
index fcb866cb..c9b1d7ef 100644
--- a/plugins/javadoc/src/main/resources/views/class.korte
+++ b/plugins/javadoc/src/main/resources/views/class.korte
@@ -63,7 +63,7 @@
{% for classlike in classlikes %}
<tr class="{{ rowColor(loop.index0) }}">
<td class="colFirst"><code>{{ classlike.modifiers }}</code></td>
- <th class="colSecond" scope="row"><code>{{ classlike.signature }}</span></code>
+ <th class="colSecond" scope="row"><code><a href="{{ classlike.address }}">{{ classlike.signature }}</a></span></code>
</th>
<td class="colLast">{{ classlike.description|raw }}</td>
</tr>
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt
index 9b2c4121..801213c2 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt
@@ -10,7 +10,7 @@ internal class JavadocIndexTest : AbstractJavadocTemplateMapTest() {
@Test
fun `generates correct number of index pages`() {
testIndexPages { indexPages ->
- assertEquals(13, indexPages.size)
+ assertEquals(12, indexPages.size)
}
}