From f50966b8da454a9dacc2b35267b2ffa11b227638 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 4 Nov 2015 20:17:03 +0100 Subject: remove extra

tags from @param --- javadoc/src/main/kotlin/docbase.kt | 8 +++++--- javadoc/src/main/kotlin/tags.kt | 24 ++++++++++++++++++------ 2 files changed, 23 insertions(+), 9 deletions(-) (limited to 'javadoc/src/main/kotlin') diff --git a/javadoc/src/main/kotlin/docbase.kt b/javadoc/src/main/kotlin/docbase.kt index cdb4bbc7..19b29b00 100644 --- a/javadoc/src/main/kotlin/docbase.kt +++ b/javadoc/src/main/kotlin/docbase.kt @@ -308,9 +308,11 @@ open class ExecutableMemberAdapter(module: ModuleNodeAdapter, node: Documentatio override fun isVarArgs(): Boolean = node.details(DocumentationNode.Kind.Parameter).any { false } // TODO override fun isSynchronized(): Boolean = node.annotations.any { it.name == "synchronized" } - override fun paramTags(): Array = node.details(DocumentationNode.Kind.Parameter).filter { it.content.summary !is ContentEmpty || it.content.description !is ContentEmpty || it.content.sections.isNotEmpty() }.map { - ParamTagAdapter(module, this, it.name, false, it.content.children) - }.toTypedArray() + + override fun paramTags(): Array = node.details(DocumentationNode.Kind.Parameter) + .filter { it.content.summary !is ContentEmpty || it.content.description !is ContentEmpty || it.content.sections.isNotEmpty() } + .map { ParamTagAdapter(module, this, it.name, false, it.content.children) } + .toTypedArray() override fun thrownExceptionTypes(): Array = emptyArray() override fun receiverType(): Type? = receiverNode()?.let { receiver -> TypeAdapter(module, receiver) } diff --git a/javadoc/src/main/kotlin/tags.kt b/javadoc/src/main/kotlin/tags.kt index 5c38bbee..5872dbaa 100644 --- a/javadoc/src/main/kotlin/tags.kt +++ b/javadoc/src/main/kotlin/tags.kt @@ -89,8 +89,15 @@ class SeeClassTagAdapter(holder: Doc, val clazz: ClassDocumentationNodeAdapter, override fun firstSentenceTags(): Array = inlineTags() // TODO } -class ParamTagAdapter(val module: ModuleNodeAdapter, val holder: Doc, val parameterName: String, val typeParameter: Boolean, val content: List) : ParamTag { - constructor(module: ModuleNodeAdapter, holder: Doc, parameterName: String, isTypeParameter: Boolean, content: ContentNode) : this(module, holder, parameterName, isTypeParameter, listOf(content)) +class ParamTagAdapter(val module: ModuleNodeAdapter, + val holder: Doc, + val parameterName: String, + val typeParameter: Boolean, + val content: List) : ParamTag { + + constructor(module: ModuleNodeAdapter, holder: Doc, parameterName: String, isTypeParameter: Boolean, content: ContentNode) + : this(module, holder, parameterName, isTypeParameter, listOf(content)) { + } override fun name(): String = "@param" override fun kind(): String = name() @@ -125,6 +132,13 @@ class ThrowsTagAdapter(val holder: Doc, val type: ClassDocumentationNodeAdapter) fun buildInlineTags(module: ModuleNodeAdapter, holder: Doc, root: ContentNode): List = ArrayList().let { buildInlineTags(module, holder, root, it); it } +private fun buildInlineTags(module: ModuleNodeAdapter, holder: Doc, nodes: List, result: MutableList) { + nodes.forEach { + buildInlineTags(module, holder, it, result) + } +} + + private fun buildInlineTags(module: ModuleNodeAdapter, holder: Doc, node: ContentNode, result: MutableList) { fun surroundWith(module: ModuleNodeAdapter, holder: Doc, prefix: String, postfix: String, node: ContentBlock, result: MutableList) { if (node.children.isNotEmpty()) { @@ -132,9 +146,7 @@ private fun buildInlineTags(module: ModuleNodeAdapter, holder: Doc, node: Conten val close = TextTag(holder, ContentText(postfix)) result.add(open) - node.children.forEach { - buildInlineTags(module, holder, it, result) - } + buildInlineTags(module, holder, node.children, result) if (result.last() === open) { result.removeAt(result.lastIndex) @@ -168,7 +180,7 @@ private fun buildInlineTags(module: ModuleNodeAdapter, holder: Doc, node: Conten in DocumentationNode.Kind.classLike -> result.add(SeeClassTagAdapter(holder, ClassDocumentationNodeAdapter(module, node.node!!), node)) - else -> node.children.forEach { buildInlineTags(module, holder, it, result) } + else -> buildInlineTags(module, holder, node.children, result) } } is ContentExternalLink -> result.add(SeeExternalLinkTagAdapter(holder, node)) -- cgit