aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/base/src/main/kotlin/DokkaBase.kt2
-rw-r--r--plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt2
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt2
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt2
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt28
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DriClashAwareName.kt9
-rw-r--r--plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt2
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt4
8 files changed, 31 insertions, 20 deletions
diff --git a/plugins/base/src/main/kotlin/DokkaBase.kt b/plugins/base/src/main/kotlin/DokkaBase.kt
index e709b48b..c7e05e8f 100644
--- a/plugins/base/src/main/kotlin/DokkaBase.kt
+++ b/plugins/base/src/main/kotlin/DokkaBase.kt
@@ -121,7 +121,7 @@ class DokkaBase : DokkaPlugin() {
}
val docTagToContentConverter by extending {
- commentsToContentConverter with DocTagToContentConverter
+ commentsToContentConverter with DocTagToContentConverter()
}
val pageMerger by extending {
diff --git a/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt b/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt
index 80a06a89..3c4f1dea 100644
--- a/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt
+++ b/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt
@@ -53,7 +53,7 @@ class MultimodulePageCreator(
val content = ContentGroup(
children =
if (displayedModuleDocumentation != null)
- DocTagToContentConverter.buildContent(displayedModuleDocumentation, dci, emptySet())
+ DocTagToContentConverter().buildContent(displayedModuleDocumentation, dci, emptySet())
else emptyList(),
dci = dci,
sourceSets = emptySet(),
diff --git a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
index 43c26dc5..b34d3d6e 100644
--- a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
@@ -72,7 +72,7 @@ object NavigationPageInstaller : PageTransformer {
}.sortedBy { it.name.toLowerCase() }
private val ContentPage.displayableName: String
- get() = if(documentable is DFunction){
+ get() = if (documentable is DFunction) {
"$name()"
} else {
name
diff --git a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
index 0fea6b4f..d05979e3 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
@@ -7,7 +7,7 @@ import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.model.toDisplaySourceSets
import org.jetbrains.dokka.pages.*
-object DocTagToContentConverter : CommentsToContentConverter {
+open class DocTagToContentConverter : CommentsToContentConverter {
override fun buildContent(
docTag: DocTag,
dci: DCI,
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
index c2b27d74..b2a9d5d2 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
@@ -18,7 +18,6 @@ import kotlin.reflect.full.isSubclassOf
import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.base.resolvers.anchors.SymbolAnchorHint
import org.jetbrains.dokka.base.transformers.documentables.ClashingDriIdentifier
-import org.jetbrains.dokka.model.properties.plus
private typealias GroupedTags = Map<KClass<out TagWrapper>, List<Pair<DokkaSourceSet?, TagWrapper>>>
@@ -43,7 +42,7 @@ open class DefaultPageCreator(
open fun pageForEnumEntry(e: DEnumEntry): ClasslikePageNode =
ClasslikePageNode(
- e.name, contentForEnumEntry(e), setOf(e.dri), e,
+ e.nameAfterClash(), contentForEnumEntry(e), setOf(e.dri), e,
e.classlikes.renameClashingDocumentable().map(::pageForClasslike) +
e.filteredFunctions.renameClashingDocumentable().map(::pageForFunction) +
e.properties.renameClashingDocumentable().mapNotNull(::pageForProperty)
@@ -53,7 +52,7 @@ open class DefaultPageCreator(
val constructors = if (c is WithConstructors) c.constructors else emptyList()
return ClasslikePageNode(
- c.name.orEmpty(), contentForClasslike(c), setOf(c.dri), c,
+ c.nameAfterClash(), contentForClasslike(c), setOf(c.dri), c,
constructors.map(::pageForFunction) +
c.classlikes.renameClashingDocumentable().map(::pageForClasslike) +
c.filteredFunctions.renameClashingDocumentable().map(::pageForFunction) +
@@ -70,22 +69,22 @@ open class DefaultPageCreator(
groupBy { it.dri }.values.flatMap { elements ->
if (elements.size == 1) elements else elements.mapNotNull { element ->
when(element) {
- is DClass -> element.copy(name = element.toClashedName())
- is DObject -> element.copy(name = element.toClashedName())
- is DAnnotation -> element.copy(name = element.toClashedName())
- is DInterface -> element.copy(name = element.toClashedName())
- is DEnum -> element.copy(name = element.toClashedName())
- is DFunction -> element.copy(name = element.toClashedName())
- is DProperty -> element.copy(name = element.toClashedName())
- is DTypeAlias -> element.copy(name = element.toClashedName())
+ is DClass -> element.copy(extra = element.extra + DriClashAwareName(element.toClashedName()))
+ is DObject -> element.copy(extra = element.extra + DriClashAwareName(element.toClashedName()) )
+ is DAnnotation -> element.copy(extra = element.extra + DriClashAwareName(element.toClashedName()) )
+ is DInterface -> element.copy(extra = element.extra + DriClashAwareName(element.toClashedName()) )
+ is DEnum -> element.copy(extra = element.extra + DriClashAwareName(element.toClashedName()) )
+ is DFunction -> element.copy(extra = element.extra + DriClashAwareName(element.toClashedName()) )
+ is DProperty -> element.copy(extra = element.extra + DriClashAwareName(element.toClashedName()) )
+ is DTypeAlias -> element.copy(extra = element.extra + DriClashAwareName(element.toClashedName()) )
else -> null
} as? T?
}
}
- open fun pageForFunction(f: DFunction) = MemberPageNode(f.name, contentForFunction(f), setOf(f.dri), f)
+ open fun pageForFunction(f: DFunction) = MemberPageNode(f.nameAfterClash(), contentForFunction(f), setOf(f.dri), f)
- open fun pageForProperty(p: DProperty): MemberPageNode? = MemberPageNode(p.name, contentForProperty(p), setOf(p.dri), p)
+ open fun pageForProperty(p: DProperty): MemberPageNode? = MemberPageNode(p.nameAfterClash(), contentForProperty(p), setOf(p.dri), p)
private val WithScope.filteredFunctions: List<DFunction>
get() = functions.mapNotNull { function ->
@@ -578,4 +577,7 @@ open class DefaultPageCreator(
private val Documentable.hasSeparatePage: Boolean
get() = this !is DTypeAlias
+
+ private fun <T: Documentable> T.nameAfterClash(): String =
+ ((this as? WithExtraProperties<out Documentable>)?.extra?.get(DriClashAwareName)?.value ?: name).orEmpty()
}
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DriClashAwareName.kt b/plugins/base/src/main/kotlin/translators/documentables/DriClashAwareName.kt
new file mode 100644
index 00000000..e124288b
--- /dev/null
+++ b/plugins/base/src/main/kotlin/translators/documentables/DriClashAwareName.kt
@@ -0,0 +1,9 @@
+package org.jetbrains.dokka.base.translators.documentables
+
+import org.jetbrains.dokka.model.Documentable
+import org.jetbrains.dokka.model.properties.ExtraProperty
+
+data class DriClashAwareName(val value: String?): ExtraProperty<Documentable> {
+ companion object : ExtraProperty.Key<Documentable, DriClashAwareName>
+ override val key: ExtraProperty.Key<Documentable, *> = Companion
+} \ No newline at end of file
diff --git a/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt b/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt
index ad023d84..8703a4a9 100644
--- a/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt
+++ b/plugins/base/src/test/kotlin/transformers/CommentsToContentConverterTest.kt
@@ -10,7 +10,7 @@ import org.jetbrains.dokka.pages.*
import org.jetbrains.kotlin.utils.addToStdlib.assertedCast
class CommentsToContentConverterTest {
- private val converter = DocTagToContentConverter
+ private val converter = DocTagToContentConverter()
private fun executeTest(
docTag:DocTag,
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 f104beb7..0e6bdc33 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
@@ -183,7 +183,7 @@ open class JavadocPageCreator(
private inline fun <reified T : TagWrapper> Documentable.contentNodesFromType(sourceSet: DokkaSourceSet?) =
findNodeInDocumentation<T>(sourceSet)?.let {
- DocTagToContentConverter.buildContent(
+ DocTagToContentConverter().buildContent(
it.root,
DCI(setOf(dri), JavadocContentKind.OverviewSummary),
sourceSets.toSet()
@@ -213,7 +213,7 @@ open class JavadocPageCreator(
return JavadocIndexExtra(
indexes.map {
ContentGroup(
- children = DocTagToContentConverter.buildContent(
+ children = DocTagToContentConverter().buildContent(
it,
DCI(setOf(dri), JavadocContentKind.OverviewSummary),
sourceSets.toSet()