aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-11-04 20:17:03 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-11-04 20:17:03 +0100
commitf50966b8da454a9dacc2b35267b2ffa11b227638 (patch)
treeaa12cc4090e2aaa937cc153b20aab2bb1f04d84b /src/Kotlin
parent972118bcffbdf13ebd3aefd495618c4670bdc7b3 (diff)
downloaddokka-f50966b8da454a9dacc2b35267b2ffa11b227638.tar.gz
dokka-f50966b8da454a9dacc2b35267b2ffa11b227638.tar.bz2
dokka-f50966b8da454a9dacc2b35267b2ffa11b227638.zip
remove extra <p> tags from @param
Diffstat (limited to 'src/Kotlin')
-rw-r--r--src/Kotlin/ContentBuilder.kt9
-rw-r--r--src/Kotlin/DescriptorDocumentationParser.kt8
-rw-r--r--src/Kotlin/DocumentationBuilder.kt14
-rw-r--r--src/Kotlin/KotlinAsJavaDocumentationBuilder.kt2
4 files changed, 19 insertions, 14 deletions
diff --git a/src/Kotlin/ContentBuilder.kt b/src/Kotlin/ContentBuilder.kt
index 9fe0db6e..c4bb18de 100644
--- a/src/Kotlin/ContentBuilder.kt
+++ b/src/Kotlin/ContentBuilder.kt
@@ -5,9 +5,14 @@ import org.intellij.markdown.MarkdownTokenTypes
import org.intellij.markdown.html.entities.EntityConverter
import java.util.*
-public fun buildContent(tree: MarkdownNode, linkResolver: (String) -> ContentBlock): MutableContent {
+public fun buildContent(tree: MarkdownNode, linkResolver: (String) -> ContentBlock, inline: Boolean = false): MutableContent {
val result = MutableContent()
- buildContentTo(tree, result, linkResolver)
+ if (inline) {
+ buildInlineContentTo(tree, result, linkResolver)
+ }
+ else {
+ buildContentTo(tree, result, linkResolver)
+ }
return result
}
diff --git a/src/Kotlin/DescriptorDocumentationParser.kt b/src/Kotlin/DescriptorDocumentationParser.kt
index 839c3710..76bad31e 100644
--- a/src/Kotlin/DescriptorDocumentationParser.kt
+++ b/src/Kotlin/DescriptorDocumentationParser.kt
@@ -30,9 +30,10 @@ class DescriptorDocumentationParser
val resolutionFacade: DokkaResolutionFacade,
val refGraph: NodeReferenceGraph)
{
- fun parseDocumentation(descriptor: DeclarationDescriptor): Content = parseDocumentationAndDetails(descriptor).first
+ fun parseDocumentation(descriptor: DeclarationDescriptor, inline: Boolean = false): Content =
+ parseDocumentationAndDetails(descriptor, inline).first
- fun parseDocumentationAndDetails(descriptor: DeclarationDescriptor): Pair<Content, (DocumentationNode) -> Unit> {
+ fun parseDocumentationAndDetails(descriptor: DeclarationDescriptor, inline: Boolean = false): Pair<Content, (DocumentationNode) -> Unit> {
if (descriptor is JavaClassDescriptor || descriptor is JavaCallableMemberDescriptor) {
return parseJavadoc(descriptor)
}
@@ -52,8 +53,7 @@ class DescriptorDocumentationParser
kdocText += "\n"
}
val tree = parseMarkdown(kdocText)
- //println(tree.toTestString())
- val content = buildContent(tree, { href -> linkResolver.resolveContentLink(descriptor, href) })
+ val content = buildContent(tree, { href -> linkResolver.resolveContentLink(descriptor, href) }, inline)
if (kdoc is KDocSection) {
val tags = kdoc.getTags()
tags.forEach {
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index cdbff877..97f2462b 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -84,8 +84,8 @@ class DocumentationBuilder
refGraph.register(descriptor.signature(), node)
}
- fun <T> DocumentationNode(descriptor: T, kind: Kind): DocumentationNode where T : DeclarationDescriptor, T : Named {
- val (doc, callback) = descriptorDocumentationParser.parseDocumentationAndDetails(descriptor)
+ fun <T> nodeForDescriptor(descriptor: T, kind: Kind): DocumentationNode where T : DeclarationDescriptor, T : Named {
+ val (doc, callback) = descriptorDocumentationParser.parseDocumentationAndDetails(descriptor, kind == Kind.Parameter)
val node = DocumentationNode(descriptor.name.asString(), doc, kind).withModifiers(descriptor)
callback(node)
return node
@@ -294,7 +294,7 @@ class DocumentationBuilder
ClassKind.ENUM_ENTRY -> Kind.EnumItem
else -> Kind.Class
}
- val node = DocumentationNode(this, kind)
+ val node = nodeForDescriptor(this, kind)
node.appendSupertypes(this)
if (getKind() != ClassKind.OBJECT && getKind() != ClassKind.ENUM_ENTRY) {
node.appendInPageChildren(typeConstructor.parameters, DocumentationReference.Kind.Detail)
@@ -321,7 +321,7 @@ class DocumentationBuilder
}
fun ConstructorDescriptor.build(): DocumentationNode {
- val node = DocumentationNode(this, Kind.Constructor)
+ val node = nodeForDescriptor(this, Kind.Constructor)
node.appendInPageChildren(valueParameters, DocumentationReference.Kind.Detail)
register(this, node)
return node
@@ -341,7 +341,7 @@ class DocumentationBuilder
logger.warn("Found an unresolved type in ${signatureWithSourceLocation()}")
}
- val node = DocumentationNode(this, if (inCompanionObject()) Kind.CompanionObjectFunction else Kind.Function)
+ val node = nodeForDescriptor(this, if (inCompanionObject()) Kind.CompanionObjectFunction else Kind.Function)
node.appendInPageChildren(typeParameters, DocumentationReference.Kind.Detail)
extensionReceiverParameter?.let { node.appendChild(it, DocumentationReference.Kind.Detail) }
@@ -371,7 +371,7 @@ class DocumentationBuilder
}
fun PropertyDescriptor.build(): DocumentationNode {
- val node = DocumentationNode(this, if (inCompanionObject()) Kind.CompanionObjectProperty else Kind.Property)
+ val node = nodeForDescriptor(this, if (inCompanionObject()) Kind.CompanionObjectProperty else Kind.Property)
node.appendInPageChildren(typeParameters, DocumentationReference.Kind.Detail)
extensionReceiverParameter?.let { node.appendChild(it, DocumentationReference.Kind.Detail) }
node.appendType(returnType)
@@ -415,7 +415,7 @@ class DocumentationBuilder
}
fun ValueParameterDescriptor.build(): DocumentationNode {
- val node = DocumentationNode(this, Kind.Parameter)
+ val node = nodeForDescriptor(this, Kind.Parameter)
node.appendType(varargElementType ?: type)
if (declaresDefaultValue()) {
val psi = source.getPsi() as? KtParameter
diff --git a/src/Kotlin/KotlinAsJavaDocumentationBuilder.kt b/src/Kotlin/KotlinAsJavaDocumentationBuilder.kt
index b5dc47a3..a802e06c 100644
--- a/src/Kotlin/KotlinAsJavaDocumentationBuilder.kt
+++ b/src/Kotlin/KotlinAsJavaDocumentationBuilder.kt
@@ -58,7 +58,7 @@ class KotlinAsJavaDocumentationParser
}
}
val descriptor = resolutionFacade.resolveToDescriptor(origin)
- val content = descriptorDocumentationParser.parseDocumentation(descriptor)
+ val content = descriptorDocumentationParser.parseDocumentation(descriptor, origin is KtParameter)
return JavadocParseResult(content, null)
}
}