diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index 7299670e3d..76f9366f3e 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -900,18 +900,17 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, val platforms = effectivePlatformsForNode(type) appendIndexRow(platforms) { appendPlatforms(platforms) - appendHeader(level = 5) { - appendLink(link(node, type) { - if (it.kind == NodeKind.ExternalClass) it.name else it.qualifiedName() - }) - } - if (type.kind == NodeKind.ExternalClass) { val packageName = type.owner?.name if (packageName != null) { appendText(" (extensions in package $packageName)") } } + appendHeader(level = 5) { + appendLink(link(node, type) { + if (it.kind == NodeKind.ExternalClass) it.name else it.qualifiedName() + }) + } appendContent(type.summary) } diff --git a/core/src/main/kotlin/Generation/DocumentationMerger.kt b/core/src/main/kotlin/Generation/DocumentationMerger.kt index 5d53868a7e..53dc23a997 100644 --- a/core/src/main/kotlin/Generation/DocumentationMerger.kt +++ b/core/src/main/kotlin/Generation/DocumentationMerger.kt @@ -164,7 +164,13 @@ class DocumentationMerger( if (groupNode.kind == NodeKind.ExternalClass){ val refs = nodes.flatMap { it.allReferences() }.filter { it.kind != RefKind.Owner && it.kind != RefKind.TopLevelPage } - refs.forEach { it.to.append(groupNode, RefKind.TopLevelPage); groupNode.append(it.to, RefKind.Member) } + refs.forEach { + if (it.kind != RefKind.Link) { + it.to.dropReferences { ref -> ref.kind == RefKind.Owner } + it.to.append(groupNode, RefKind.Owner) + } + groupNode.append(it.to, it.kind) + } } // if nodes are classes, nested members should be also merged and diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index eb0399c735..3168e03382 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -423,7 +423,7 @@ class DocumentationBuilder fun DocumentationModule.appendFragments(fragments: Collection, packageContent: Map, packageDocumentationBuilder: PackageDocumentationBuilder) { - val allFqNames = fragments.map { it.fqName }.distinct() + val allFqNames = fragments.filter{ it.isDocumented(passConfiguration) }.map { it.fqName }.distinct() for (packageName in allFqNames) { if (packageName.isRoot && !passConfiguration.includeRootPackage) continue diff --git a/core/src/test/kotlin/model/PackageTest.kt b/core/src/test/kotlin/model/PackageTest.kt index e20e6afad8..47c8838589 100644 --- a/core/src/test/kotlin/model/PackageTest.kt +++ b/core/src/test/kotlin/model/PackageTest.kt @@ -126,15 +126,7 @@ abstract class BasePackageTest(val analysisPlatform: Platform) { analysisPlatform = analysisPlatform ) ) { model -> - assertEquals(1, model.members.count()) - with(model.members.elementAt(0)) { - assertEquals(NodeKind.Package, kind) - assertEquals("simple.name", name) - assertEquals(Content.Empty, content) - assertTrue(details.none()) - assertTrue(members.none()) - assertTrue(links.none()) - } + assertEquals(0, model.members.count()) } } } diff --git a/runners/gradle-integration-tests/testData/multiplatformProject/fileTree.txt b/runners/gradle-integration-tests/testData/multiplatformProject/fileTree.txt index 51a5df94b1..e9cc847c32 100644 --- a/runners/gradle-integration-tests/testData/multiplatformProject/fileTree.txt +++ b/runners/gradle-integration-tests/testData/multiplatformProject/fileTree.txt @@ -11,6 +11,7 @@ jvm.html kotlin.-string/ index.html + my-extension.html main.html shared.html package-list