diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-02-09 20:08:50 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-02-09 20:08:50 +0100 |
commit | e9c1e35d583c78bf74d18ee8ae9389cd37a9f554 (patch) | |
tree | f21a40f8ed31349631c55240a03ec1423db95944 | |
parent | 7c86b3d90d75bbcc23b7a8007814ce789cb837d6 (diff) | |
download | dokka-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.kt | 4 | ||||
-rw-r--r-- | src/Kotlin/DocumentationBuilder.kt | 2 |
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() |