aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorVladimir Kryachko <vkryachko@google.com>2020-09-19 13:52:24 -0400
committerVladimir Kryachko <vkryachko@google.com>2020-09-19 13:57:53 -0400
commita5af8799cebd1fb57e92b998f858f3bc410f9c42 (patch)
treeb18347aad89210d70b58271602e7f8b19c4ff8d4 /core/src
parent7623b47835aa703c45567dd443c96178a66e2c5e (diff)
downloaddokka-a5af8799cebd1fb57e92b998f858f3bc410f9c42.tar.gz
Fix constructor rendering from `<init>` to actual `TypeName`.
For example, class Foo will have a constructor named `Foo` in docs as opposed to `<init>`. Bug: 168972258 Change-Id: I1e70d6d15702e5d583054cb95a3a90c328e5f8f5
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/Formats/DacHtmlFormat.kt2
-rw-r--r--core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormat.kt2
-rw-r--r--core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt2
-rw-r--r--core/src/main/kotlin/Model/DocumentationNode.kt6
4 files changed, 9 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Formats/DacHtmlFormat.kt b/core/src/main/kotlin/Formats/DacHtmlFormat.kt
index d997f1ca2..bc6429bf5 100644
--- a/core/src/main/kotlin/Formats/DacHtmlFormat.kt
+++ b/core/src/main/kotlin/Formats/DacHtmlFormat.kt
@@ -75,7 +75,7 @@ class DevsiteLayoutHtmlFormatOutputBuilder(
attributes["data-version-added"] = node.apiLevel.name
h3(classes = "api-name") {
//id = node.signatureForAnchor(logger).urlEncoded()
- +node.name
+ +node.prettyName
}
apiAndDeprecatedVersions(node)
pre(classes = "api-signature no-pretty-print") { renderedSignature(node, LanguageService.RenderMode.FULL) }
diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormat.kt b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormat.kt
index 91808f8bf..b94886693 100644
--- a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormat.kt
+++ b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormat.kt
@@ -119,7 +119,7 @@ fun DocumentationNode.signatureForAnchor(logger: DokkaLogger): String {
append("Companion.")
}
appendReceiverIfSo()
- append(name)
+ append(prettyName)
details(NodeKind.Parameter).joinTo(this, prefix = "(", postfix = ")") { it.detail(NodeKind.Type).qualifiedNameFromType() }
}
NodeKind.Property, NodeKind.CompanionObjectProperty -> buildString {
diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt
index a04a9187c..f12128f64 100644
--- a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt
+++ b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt
@@ -253,7 +253,7 @@ open class JavaLayoutHtmlFormatOutputBuilder(
renderedSignature(receiver.detail(NodeKind.Type), SUMMARY)
+"."
}
- a(href = node) { +node.name }
+ a(href = node) { +node.prettyName }
shortFunctionParametersList(node)
}
}
diff --git a/core/src/main/kotlin/Model/DocumentationNode.kt b/core/src/main/kotlin/Model/DocumentationNode.kt
index cf083ce54..c84d4169d 100644
--- a/core/src/main/kotlin/Model/DocumentationNode.kt
+++ b/core/src/main/kotlin/Model/DocumentationNode.kt
@@ -134,6 +134,12 @@ open class DocumentationNode(val name: String,
get() = details(NodeKind.Supertype)
val signatureName = detailOrNull(NodeKind.Signature)?.name
+ val prettyName : String
+ get() = when(kind) {
+ NodeKind.Constructor -> owner!!.name
+ else -> name
+ }
+
val superclassType: DocumentationNode?
get() = when (kind) {
NodeKind.Supertype -> {