aboutsummaryrefslogtreecommitdiff
path: root/plugins/all-modules-page
diff options
context:
space:
mode:
authorKamil Doległo <9080183+kamildoleglo@users.noreply.github.com>2021-03-15 16:31:15 +0100
committerGitHub <noreply@github.com>2021-03-15 16:31:15 +0100
commit301ee3885b929a030bfc0714c778f4c16d10d8ba (patch)
tree19c0b53dd28ab32ff7822217999e23f024953068 /plugins/all-modules-page
parentf5c791a150242fab1973af6ea5ad3c02e07dbf5f (diff)
downloaddokka-301ee3885b929a030bfc0714c778f4c16d10d8ba.tar.gz
dokka-301ee3885b929a030bfc0714c778f4c16d10d8ba.tar.bz2
dokka-301ee3885b929a030bfc0714c778f4c16d10d8ba.zip
Fix not escaping module name in DefaultExternalModuleLinkResolver (#1777)
Diffstat (limited to 'plugins/all-modules-page')
-rw-r--r--plugins/all-modules-page/src/main/kotlin/ExternalModuleLinkResolver.kt26
1 files changed, 11 insertions, 15 deletions
diff --git a/plugins/all-modules-page/src/main/kotlin/ExternalModuleLinkResolver.kt b/plugins/all-modules-page/src/main/kotlin/ExternalModuleLinkResolver.kt
index 74513957..0fde629c 100644
--- a/plugins/all-modules-page/src/main/kotlin/ExternalModuleLinkResolver.kt
+++ b/plugins/all-modules-page/src/main/kotlin/ExternalModuleLinkResolver.kt
@@ -25,22 +25,18 @@ class DefaultExternalModuleLinkResolver(val context: DokkaContext) : ExternalMod
elpFactory.flatMap { externalDocumentations.map { ed -> it.getExternalLocationProvider(ed) } }.filterNotNull()
}
- private fun setupExternalDocumentations(): List<ExternalDocumentation> {
- val packageLists =
- context.configuration.modules.map(::loadPackageListForModule).toMap()
- return packageLists.mapNotNull { (module, packageList) ->
- packageList?.let {
- context.configuration.modules.find { it.name == module.name }?.let { m ->
- ExternalDocumentation(
- URL("file:/${m.relativePathToOutputDirectory.toRelativeOutputDir()}"),
- packageList
- )
- }
+ private fun setupExternalDocumentations(): List<ExternalDocumentation> =
+ context.configuration.modules.mapNotNull { module ->
+ loadPackageListForModule(module)?.let { packageList ->
+ ExternalDocumentation(
+ URL("file:/${module.relativePathToOutputDirectory.toRelativeOutputDir()}"),
+ packageList
+ )
}
}
- }
- private fun File.toRelativeOutputDir(): File = if(isAbsolute) {
+
+ private fun File.toRelativeOutputDir(): File = if (isAbsolute) {
relativeToOrSelf(context.configuration.outputDir)
} else {
this
@@ -48,7 +44,7 @@ class DefaultExternalModuleLinkResolver(val context: DokkaContext) : ExternalMod
private fun loadPackageListForModule(module: DokkaConfiguration.DokkaModuleDescription) =
module.sourceOutputDirectory.resolve(File(identifierToFilename(module.name))).let {
- it to PackageList.load(
+ PackageList.load(
URL("file:" + it.resolve("package-list").path),
8,
true
@@ -70,7 +66,7 @@ class DefaultExternalModuleLinkResolver(val context: DokkaContext) : ExternalMod
override fun resolveLinkToModuleIndex(moduleName: String): String? =
context.configuration.modules.firstOrNull { it.name == moduleName }
?.let { module ->
- val (_, packageList) = loadPackageListForModule(module)
+ val packageList = loadPackageListForModule(module)
val extension = when (packageList?.linkFormat) {
RecognizedLinkFormat.KotlinWebsiteHtml,
RecognizedLinkFormat.DokkaOldHtml,