aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-12-22 09:50:17 +0200
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-12-22 09:50:17 +0200
commit18399493263820cf6098603025802ddf862f1920 (patch)
treeb8c915c272cdc484df2b511ad50a9ff829c33612 /src/Kotlin
parentbd6cddd932c308519ce386197b93de145462bec2 (diff)
downloaddokka-18399493263820cf6098603025802ddf862f1920.tar.gz
dokka-18399493263820cf6098603025802ddf862f1920.tar.bz2
dokka-18399493263820cf6098603025802ddf862f1920.zip
Document some types in Dokka and fix to make them work.
Diffstat (limited to 'src/Kotlin')
-rw-r--r--src/Kotlin/ContentBuilder.kt26
-rw-r--r--src/Kotlin/DocumentationBuilder.kt3
-rw-r--r--src/Kotlin/KotlinLanguageService.kt3
3 files changed, 26 insertions, 6 deletions
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<String, DeclarationDescriptor?>(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 {