aboutsummaryrefslogtreecommitdiff
path: root/plugins/javadoc/src
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-07-23 12:38:59 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-19 13:34:10 +0200
commitfc38ceda06d92978175d37bb7197763539c966a2 (patch)
tree69751ac7fd6083fabce8a65bae8e84f85ece5358 /plugins/javadoc/src
parenta3880835c4e6c6d0570ab2193be50bd739e9f2ca (diff)
downloaddokka-fc38ceda06d92978175d37bb7197763539c966a2.tar.gz
dokka-fc38ceda06d92978175d37bb7197763539c966a2.tar.bz2
dokka-fc38ceda06d92978175d37bb7197763539c966a2.zip
Make unresolved links render as text
Diffstat (limited to 'plugins/javadoc/src')
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationProvider.kt14
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt2
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt8
3 files changed, 13 insertions, 11 deletions
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationProvider.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationProvider.kt
index d5499f0b..9b0d8b04 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationProvider.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationProvider.kt
@@ -76,7 +76,7 @@ class JavadocLocationProvider(pageRoot: RootPageNode, dokkaContext: DokkaContext
"${resolve(it, context, skipExtension = true)}.html#$anchor"
}
?: getExternalLocation(dri, sourceSets)
- }
+
private fun JavadocFunctionNode.getAnchor(): String =
"$name(${parameters.joinToString(",") {
@@ -89,18 +89,20 @@ class JavadocLocationProvider(pageRoot: RootPageNode, dokkaContext: DokkaContext
is JavaObject -> "Object"
else -> bound.toString()
}
- }})"
+ })"
fun anchorForFunctionNode(node: JavadocFunctionNode) = node.getAnchor()
private fun anchorForDri(dri: DRI): String =
dri.callable?.let { callable ->
- "${callable.name}(${callable.params.joinToString(",") {
- ((it as? Nullable)?.wrapped ?: it).toString()
- }})"
+ "${callable.name}(${
+ callable.params.joinToString(",") {
+ ((it as? Nullable)?.wrapped ?: it).toString()
+ }
+ })"
} ?: dri.classNames.orEmpty()
- override fun resolve(node: PageNode, context: PageNode?, skipExtension: Boolean): String =
+ override fun resolve(node: PageNode, context: PageNode?, skipExtension: Boolean) =
pathIndex[node]?.relativeTo(pathIndex[context].orEmpty())?.let {
if (skipExtension) it.removeSuffix(".html") else it
} ?: run {
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt
index 4d5b9a6c..669f4979 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt
@@ -148,7 +148,7 @@ class KorteJavadocRenderer(private val outputWriter: OutputWriter, val context:
" implements " + it.joinToString(", ") { n ->
listOfNotNull(
n.packageName,
- buildLink(n.toLink(), n.classNames.orEmpty())
+ n.toLink()?.let{ buildLink(it, n.classNames.orEmpty()) } ?: n
).joinToString(".")
}
}.orEmpty()
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 cc1995eb..736a1f93 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
@@ -103,7 +103,7 @@ class SearchScriptsCreator(private val locationProvider: JavadocLocationProvider
packageName = it.first.name,
classlikeName = it.second.name,
input = function,
- url = locationProvider.resolve(function.dri, it.first.sourceSets())
+ url = locationProvider.resolve(function.dri, it.first.sourceSets())!!
)
}
}
@@ -114,7 +114,7 @@ class SearchScriptsCreator(private val locationProvider: JavadocLocationProvider
packageName = it.first.name,
classlikeName = it.second.name,
property,
- locationProvider.resolve(property.dri, it.first.sourceSets())
+ locationProvider.resolve(property.dri, it.first.sourceSets())!!
)
}
}
@@ -125,7 +125,7 @@ class SearchScriptsCreator(private val locationProvider: JavadocLocationProvider
packageName = it.first.name,
classlikeName = it.second.name,
entry,
- locationProvider.resolve(entry.dri, it.first.sourceSets())
+ locationProvider.resolve(entry.dri, it.first.sourceSets())!!
)
}
}
@@ -185,7 +185,7 @@ class SearchScriptsCreator(private val locationProvider: JavadocLocationProvider
sourceSets: Set<DisplaySourceSet>,
label: String
): String =
- locationProvider.resolve(dri, sourceSets).formatToEndWithHtml() + "#" + label
+ locationProvider.resolve(dri, sourceSets)!!.formatToEndWithHtml() + "#" + label
}
private data class SearchRecord(