aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-02-09 20:08:50 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-02-09 20:08:50 +0100
commite9c1e35d583c78bf74d18ee8ae9389cd37a9f554 (patch)
treef21a40f8ed31349631c55240a03ec1423db95944
parent7c86b3d90d75bbcc23b7a8007814ce789cb837d6 (diff)
downloaddokka-e9c1e35d583c78bf74d18ee8ae9389cd37a9f554.tar.gz
dokka-e9c1e35d583c78bf74d18ee8ae9389cd37a9f554.tar.bz2
dokka-e9c1e35d583c78bf74d18ee8ae9389cd37a9f554.zip
fix handling of @sample links after kdoc PSI changes
-rw-r--r--src/Kotlin/ContentBuilder.kt4
-rw-r--r--src/Kotlin/DocumentationBuilder.kt2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/Kotlin/ContentBuilder.kt b/src/Kotlin/ContentBuilder.kt
index 42a2d994..abe24917 100644
--- a/src/Kotlin/ContentBuilder.kt
+++ b/src/Kotlin/ContentBuilder.kt
@@ -126,7 +126,9 @@ public fun DocumentationBuilder.buildInlineContentTo(tree: MarkdownNode, target:
}
}
-fun DocumentationBuilder.functionBody(descriptor: DeclarationDescriptor, functionName: String): ContentNode {
+fun DocumentationBuilder.functionBody(descriptor: DeclarationDescriptor, functionName: String?): ContentNode {
+ if (functionName == null)
+ return ContentBlockCode().let() { it.append(ContentText("Missing function name in @sample")); it }
val scope = getResolutionScope(session, descriptor)
val rootPackage = session.getModuleDescriptor().getPackage(FqName.ROOT)!!
val rootScope = rootPackage.getMemberScope()
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index ca19c364..1680b407 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -52,7 +52,7 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
val tags = kdoc.getTags()
tags.forEach {
if (it.getName() == "sample") {
- content.append(functionBody(descriptor, it.getContent()))
+ content.append(functionBody(descriptor, it.getSubjectName()))
} else {
val section = content.addSection(displayName(it.getName()), it.getSubjectName())
val sectionContent = it.getContent()