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 12:15:50 +0200 |
commit | 06ac15a2907fd5c7a6ef0576ffa51f4937a29e0d (patch) | |
tree | ea8e76159a391ba10d273124a11ebb08cc459ffe /plugins/javadoc/src | |
parent | 34e696f92aaa3802f13a0074003bc8957218aeba (diff) | |
download | dokka-06ac15a2907fd5c7a6ef0576ffa51f4937a29e0d.tar.gz dokka-06ac15a2907fd5c7a6ef0576ffa51f4937a29e0d.tar.bz2 dokka-06ac15a2907fd5c7a6ef0576ffa51f4937a29e0d.zip |
Changing javadoc anchor format to Java 12 one
Diffstat (limited to 'plugins/javadoc/src')
3 files changed, 9 insertions, 9 deletions
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/location/JavadocLocationProvider.kt b/plugins/javadoc/src/main/kotlin/javadoc/location/JavadocLocationProvider.kt index 3a48261c..49278b06 100644 --- a/plugins/javadoc/src/main/kotlin/javadoc/location/JavadocLocationProvider.kt +++ b/plugins/javadoc/src/main/kotlin/javadoc/location/JavadocLocationProvider.kt @@ -76,7 +76,7 @@ class JavadocLocationProvider(pageRoot: RootPageNode, dokkaContext: DokkaContext } private fun JavadocFunctionNode.getAnchor(): String = - "$name-${parameters.joinToString("-") { + "$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 @@ -85,15 +85,15 @@ 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("-") { + "${callable.name}(${callable.params.joinToString(",") { ((it as? Nullable)?.wrapped ?: it).toString() - }}-" + }})" } ?: dri.classNames.orEmpty() override fun resolve(node: PageNode, context: PageNode?, skipExtension: Boolean): String = diff --git a/plugins/javadoc/src/test/kotlin/javadoc/JavadocClasslikeTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/javadoc/JavadocClasslikeTemplateMapTest.kt index 340e4697..2dea1abe 100644 --- a/plugins/javadoc/src/test/kotlin/javadoc/JavadocClasslikeTemplateMapTest.kt +++ b/plugins/javadoc/src/test/kotlin/javadoc/JavadocClasslikeTemplateMapTest.kt @@ -94,7 +94,7 @@ internal class JavadocClasslikeTemplateMapTest : AbstractJavadocTemplateMapTest( "Expected no parameters" ) assertEquals("final <a href=.html>String</a>", method.modifiers()) - assertEquals("<a href=TestClass.html#testFunction-->testFunction</a>()", method.signatureWithoutModifiers()) + assertEquals("<a href=TestClass.html#testFunction()>testFunction</a>()", method.signatureWithoutModifiers()) } } @@ -312,7 +312,7 @@ internal class JavadocClasslikeTemplateMapTest : AbstractJavadocTemplateMapTest( val ownMethods = assertIsInstance<List<*>>(methods["own"]).first() val sampleFunction = assertIsInstance<Map<String, Any?>>(ownMethods) - assertEquals("final <D extends <a href=Generic.html>T</a>> <a href=Generic.html#sampleFunction-->D</a> <a href=Generic.html#sampleFunction-->sampleFunction</a>()", sampleFunction.signatureWithModifiers()) + assertEquals("final <D extends <a href=Generic.html>T</a>> <a href=Generic.html#sampleFunction()>D</a> <a href=Generic.html#sampleFunction()>sampleFunction</a>()", sampleFunction.signatureWithModifiers()) } } diff --git a/plugins/javadoc/src/test/kotlin/javadoc/location/JavadocLocationTest.kt b/plugins/javadoc/src/test/kotlin/javadoc/location/JavadocLocationTest.kt index 65d5481d..235f68c0 100644 --- a/plugins/javadoc/src/test/kotlin/javadoc/location/JavadocLocationTest.kt +++ b/plugins/javadoc/src/test/kotlin/javadoc/location/JavadocLocationTest.kt @@ -75,7 +75,7 @@ class JavadocTest : AbstractCoreTest() { .firstChildOfType<JavadocClasslikePageNode> { it.name == "Test" } val testFunctionNode = testClassNode.methods.first { it.name == "test" } assertEquals( - """<a href=Test.html#test-->test</a>()""", + """<a href=Test.html#test()>test</a>()""", transformer.htmlForContentNode( testFunctionNode.signature.signatureWithoutModifiers, testClassNode @@ -93,7 +93,7 @@ class JavadocTest : AbstractCoreTest() { .firstChildOfType<JavadocClasslikePageNode> { it.name == "Test" } val testFunctionNode = testClassNode.methods.first { it.name == "test2" } assertEquals( - """<a href=Test.html#test2-String->test2</a>(<a href=https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>String</a> s)""", + """<a href=Test.html#test2(String)>test2</a>(<a href=https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>String</a> s)""", transformer.htmlForContentNode( testFunctionNode.signature.signatureWithoutModifiers, testClassNode @@ -111,7 +111,7 @@ class JavadocTest : AbstractCoreTest() { .firstChildOfType<JavadocClasslikePageNode> { it.name == "Test" } val testFunctionNode = testClassNode.methods.first { it.name == "test3" } assertEquals( - """<a href=Test.html#test3-A,%20T->test3</a>(<a href=Test.html>A</a> a, <a href=Test.html#test3-A,%20T->T</a> t)""", + """<a href=Test.html#test3(A,T)>test3</a>(<a href=Test.html>A</a> a, <a href=Test.html#test3(A,T)>T</a> t)""", transformer.htmlForContentNode( testFunctionNode.signature.signatureWithoutModifiers, testClassNode |