From 18399493263820cf6098603025802ddf862f1920 Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Mon, 22 Dec 2014 09:50:17 +0200 Subject: Document some types in Dokka and fix to make them work. --- src/Kotlin/ContentBuilder.kt | 26 ++++++++++++++++++++------ src/Kotlin/DocumentationBuilder.kt | 3 +++ src/Kotlin/KotlinLanguageService.kt | 3 +++ 3 files changed, 26 insertions(+), 6 deletions(-) (limited to 'src/Kotlin') diff --git a/src/Kotlin/ContentBuilder.kt b/src/Kotlin/ContentBuilder.kt index 462e886e..0c82a522 100644 --- a/src/Kotlin/ContentBuilder.kt +++ b/src/Kotlin/ContentBuilder.kt @@ -26,7 +26,7 @@ public fun DocumentationBuilder.buildContent(tree: MarkdownNode, descriptor: Dec parent.append(nodeStack.pop()) } MarkdownElementTypes.LIST_ITEM -> { - nodeStack.push(ContentBlock()) + nodeStack.push(ContentListItem()) processChildren() parent.append(nodeStack.pop()) } @@ -60,12 +60,26 @@ public fun DocumentationBuilder.buildContent(tree: MarkdownNode, descriptor: Dec processChildren() parent.append(nodeStack.pop()) } + MarkdownElementTypes.INLINE_LINK -> { + val label = node.child(MarkdownElementTypes.LINK_TEXT)?.child(MarkdownTokenTypes.TEXT) + val destination = node.child(MarkdownElementTypes.LINK_DESTINATION) + if (label != null) { + if (destination != null) { + val link = ContentExternalLink(destination.text) + link.append(ContentText(label.text)) + parent.append(link) + } else { + val link = ContentExternalLink(label.text) + link.append(ContentText(label.text)) + parent.append(link) + } + } + } MarkdownElementTypes.SHORT_REFERENCE_LINK -> { - val label = node.child(MarkdownElementTypes.LINK_LABEL) - val target = label?.child(MarkdownTokenTypes.TEXT) - if (target != null) { - val link = ContentExternalLink(target.text) - link.append(ContentText(target.text)) + val label = node.child(MarkdownElementTypes.LINK_LABEL)?.child(MarkdownTokenTypes.TEXT) + if (label != null) { + val link = ContentExternalLink(label.text) + link.append(ContentText(label.text)) parent.append(link) } } diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt index c2d28312..7d38480a 100644 --- a/src/Kotlin/DocumentationBuilder.kt +++ b/src/Kotlin/DocumentationBuilder.kt @@ -338,6 +338,9 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati } + if ("." !in reference) + return null + val names = reference.split('.') val result = names.fold(context) {(nextContext, name) -> nextContext?.let { resolveReference(it, name) } diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt index c7fabda9..c9275879 100644 --- a/src/Kotlin/KotlinLanguageService.kt +++ b/src/Kotlin/KotlinLanguageService.kt @@ -11,6 +11,9 @@ import org.jetbrains.dokka.ContentNode import org.jetbrains.dokka import org.jetbrains.dokka.ContentText +/** + * Implements [LanguageService] and provides rendering of symbols in Kotlin language + */ class KotlinLanguageService : LanguageService { override fun render(node: DocumentationNode): ContentNode { return dokka.content { -- cgit