From ee13af00483887fb6cfdde10a58cbb43542cf2d7 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Wed, 26 Aug 2020 11:47:49 +0200 Subject: Implement tests for ModuleAndPackageDocumentationReader --- .../documentables/ModuleAndPackageDocumentationReader.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins/base/src/main/kotlin/transformers/documentables') diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationReader.kt b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationReader.kt index e8297f3f..4900e9a8 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationReader.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationReader.kt @@ -21,7 +21,6 @@ internal interface ModuleAndPackageDocumentationReader { operator fun get(pkg: DPackage): SourceSetDependent } -// TODO NOW: Test internal fun ModuleAndPackageDocumentationReader( context: DokkaContext, kotlinAnalysis: KotlinAnalysis? = null ): ModuleAndPackageDocumentationReader = ContextModuleAndPackageDocumentationReader(context, kotlinAnalysis) @@ -59,7 +58,11 @@ private class ContextModuleAndPackageDocumentationReader( override fun get(module: DModule): SourceSetDependent { return findDocumentationNodes(module.sourceSets) { fragment -> - fragment.classifier == Classifier.Module && fragment.name == module.name + fragment.classifier == Classifier.Module && ( + /* Match fragment name against module name or distinct module displayName */ + fragment.name == module.name || + fragment.name == module.sourceSets.map { it.moduleDisplayName }.distinct().singleOrNull() + ) } } -- cgit