diff options
author | Błażej Kardyś <bkardys@virtuslab.com> | 2020-07-15 09:00:51 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-07-15 10:58:50 +0200 |
commit | e6184e5171d5a16bb4cc1fbd296309a66795eae5 (patch) | |
tree | 777387896682ecac571e82ae52a291816ea72c41 | |
parent | 0d2bc7387b518c7c25e42c9966241426c86f30f6 (diff) | |
download | dokka-e6184e5171d5a16bb4cc1fbd296309a66795eae5.tar.gz dokka-e6184e5171d5a16bb4cc1fbd296309a66795eae5.tar.bz2 dokka-e6184e5171d5a16bb4cc1fbd296309a66795eae5.zip |
Javadoc constructor anchor link fix
-rw-r--r-- | plugins/javadoc/src/main/kotlin/javadoc/location/JavadocLocationProvider.kt | 12 | ||||
-rw-r--r-- | plugins/javadoc/src/main/resources/views/class.korte | 8 |
2 files changed, 8 insertions, 12 deletions
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/location/JavadocLocationProvider.kt b/plugins/javadoc/src/main/kotlin/javadoc/location/JavadocLocationProvider.kt index f77970eb..3a48261c 100644 --- a/plugins/javadoc/src/main/kotlin/javadoc/location/JavadocLocationProvider.kt +++ b/plugins/javadoc/src/main/kotlin/javadoc/location/JavadocLocationProvider.kt @@ -6,10 +6,7 @@ import org.jetbrains.dokka.base.resolvers.local.BaseLocationProvider import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.links.Nullable import org.jetbrains.dokka.links.parent -import org.jetbrains.dokka.model.OtherParameter -import org.jetbrains.dokka.model.PrimitiveJavaType -import org.jetbrains.dokka.model.TypeConstructor -import org.jetbrains.dokka.model.UnresolvedBound +import org.jetbrains.dokka.model.* import org.jetbrains.dokka.pages.ContentPage import org.jetbrains.dokka.pages.PageNode import org.jetbrains.dokka.pages.RootPageNode @@ -79,12 +76,13 @@ class JavadocLocationProvider(pageRoot: RootPageNode, dokkaContext: DokkaContext } private fun JavadocFunctionNode.getAnchor(): String = - "$name-${parameters.joinToString(",%20") { - when (val bound = it.typeBound) { + "$name-${parameters.joinToString("-") { + when (val bound = if (it.typeBound is org.jetbrains.dokka.model.Nullable) it.typeBound.inner else it.typeBound) { is TypeConstructor -> bound.dri.classNames.orEmpty() is OtherParameter -> bound.name is PrimitiveJavaType -> bound.name is UnresolvedBound -> bound.name + is JavaObject -> "Object" else -> bound.toString() } }}-" @@ -93,7 +91,7 @@ class JavadocLocationProvider(pageRoot: RootPageNode, dokkaContext: DokkaContext private fun anchorForDri(dri: DRI): String = dri.callable?.let { callable -> - "${callable.name}-${callable.params.joinToString(",%20") { + "${callable.name}-${callable.params.joinToString("-") { ((it as? Nullable)?.wrapped ?: it).toString() }}-" } ?: dri.classNames.orEmpty() diff --git a/plugins/javadoc/src/main/resources/views/class.korte b/plugins/javadoc/src/main/resources/views/class.korte index 7c0ca368..a909bf3c 100644 --- a/plugins/javadoc/src/main/resources/views/class.korte +++ b/plugins/javadoc/src/main/resources/views/class.korte @@ -118,7 +118,7 @@ {% for constructor in constructors %} <tr class="{{ rowColor(loop.index0) }}"> <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a - href="#%3Cinit%3E({{ constructor.inlineParameters }})">{{ constructor.name }}</a></span>({{ constructor.inlineParameters|raw }})</code></th> + href="#{{ constructor.anchorLink }}">{{ constructor.name }}</a></span>({{ constructor.inlineParameters|raw }})</code></th> <td class="colLast">{{ constructor.brief|raw }}</td> </tr> {% endfor %} @@ -220,9 +220,7 @@ </a> <h3>Constructor Detail</h3> {% for constructor in constructors %} - <a id="<{{ constructor.name }}>({{ constructor.inlineParameters }})"> - <!-- --> - </a> + <a name="{{ constructor.anchorLink }}"></a> <ul class="blockList"> <li class="blockList"> <h4>{{ constructor.name }}</h4> @@ -254,7 +252,7 @@ </a> <h3>Method Detail</h3> {% for method in methods.own %} - <a name="{{ method.anchorLink }}"> + <a name="{{ method.anchorLink }}"></a> <ul class="blockListLast"> <li class="blockList"> <h4>{{ method.name }}</h4> |