aboutsummaryrefslogtreecommitdiff
path: root/src/Generation
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-07-14 19:33:43 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-07-14 19:33:43 +0400
commit433b8965b040c0d4ccb690c08489a9a4a89c4f8b (patch)
tree68430e4e43b1db38c34a359aa09d9d3d4d9d1e6e /src/Generation
parent65d8e5f6375f50ca691783982e9e5b3e93be5fa7 (diff)
downloaddokka-433b8965b040c0d4ccb690c08489a9a4a89c4f8b.tar.gz
dokka-433b8965b040c0d4ccb690c08489a9a4a89c4f8b.tar.bz2
dokka-433b8965b040c0d4ccb690c08489a9a4a89c4f8b.zip
Add renderName for formatting names of entities in lists, links, etc
Diffstat (limited to 'src/Generation')
-rw-r--r--src/Generation/JavaSignatureGenerator.kt11
-rw-r--r--src/Generation/KotlinSignatureGenerator.kt20
-rw-r--r--src/Generation/SignatureGenerator.kt1
3 files changed, 25 insertions, 7 deletions
diff --git a/src/Generation/JavaSignatureGenerator.kt b/src/Generation/JavaSignatureGenerator.kt
index e7458eba..01e51d74 100644
--- a/src/Generation/JavaSignatureGenerator.kt
+++ b/src/Generation/JavaSignatureGenerator.kt
@@ -23,6 +23,13 @@ class JavaSignatureGenerator : SignatureGenerator {
}
}
+ override fun renderName(node: DocumentationNode): String {
+ return when (node.kind) {
+ Kind.Constructor -> node.owner!!.name
+ else -> node.name
+ }
+ }
+
override fun renderPackage(node: DocumentationNode): String {
return "package ${node.name}"
}
@@ -99,9 +106,7 @@ class JavaSignatureGenerator : SignatureGenerator {
override fun renderFunction(node: DocumentationNode): String {
return StringBuilder {
when (node.kind) {
- Kind.Constructor -> {
- append(node.owner?.name)
- }
+ Kind.Constructor -> append(node.owner?.name)
Kind.Function -> {
append(renderTypeParametersForNode(node))
append(renderType(node.detail(Kind.Type)))
diff --git a/src/Generation/KotlinSignatureGenerator.kt b/src/Generation/KotlinSignatureGenerator.kt
index e73dd8d9..6bdf9562 100644
--- a/src/Generation/KotlinSignatureGenerator.kt
+++ b/src/Generation/KotlinSignatureGenerator.kt
@@ -24,6 +24,13 @@ class KotlinSignatureGenerator : SignatureGenerator {
}
}
+ override fun renderName(node: DocumentationNode): String {
+ return when (node.kind) {
+ Kind.Constructor -> node.owner!!.name
+ else -> node.name
+ }
+ }
+
override fun renderPackage(node: DocumentationNode): String {
return "package ${node.name}"
}
@@ -99,9 +106,14 @@ class KotlinSignatureGenerator : SignatureGenerator {
append(node.name)
append(renderTypeParametersForNode(node))
- append("(")
- append(node.details(Kind.Parameter).map { renderParameter(it) }.join())
- append(")")
+ /*
+ val constructors = node.members(Kind.Constructor)
+ if (constructors.count() == 1) {
+ append("(")
+ append(constructors[0].details(Kind.Parameter).map { renderParameter(it) }.join())
+ append(")")
+ }
+ */
}.toString()
}
@@ -109,7 +121,7 @@ class KotlinSignatureGenerator : SignatureGenerator {
return StringBuilder {
append(renderModifiersForNode(node))
when (node.kind) {
- Kind.Constructor -> append("init")
+ Kind.Constructor -> append(node.owner!!.name)
Kind.Function -> append("fun ")
else -> throw IllegalArgumentException("Node $node is not a function-like object")
}
diff --git a/src/Generation/SignatureGenerator.kt b/src/Generation/SignatureGenerator.kt
index 158c4336..81302433 100644
--- a/src/Generation/SignatureGenerator.kt
+++ b/src/Generation/SignatureGenerator.kt
@@ -2,6 +2,7 @@ package org.jetbrains.dokka
trait SignatureGenerator {
fun render(node: DocumentationNode): String
+ fun renderName(node: DocumentationNode): String
fun renderFunction(node: DocumentationNode): String
fun renderClass(node: DocumentationNode): String
fun renderTypeParametersForNode(node: DocumentationNode): String