diff options
Diffstat (limited to 'javadoc/src/main/kotlin')
-rw-r--r-- | javadoc/src/main/kotlin/docbase.kt | 8 | ||||
-rw-r--r-- | javadoc/src/main/kotlin/tags.kt | 24 |
2 files changed, 23 insertions, 9 deletions
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<out ParamTag> = 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<out ParamTag> = 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<out Type> = 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<out Tag> = inlineTags() // TODO } -class ParamTagAdapter(val module: ModuleNodeAdapter, val holder: Doc, val parameterName: String, val typeParameter: Boolean, val content: List<ContentNode>) : 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<ContentNode>) : 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<Tag> = ArrayList<Tag>().let { buildInlineTags(module, holder, root, it); it } +private fun buildInlineTags(module: ModuleNodeAdapter, holder: Doc, nodes: List<ContentNode>, result: MutableList<Tag>) { + nodes.forEach { + buildInlineTags(module, holder, it, result) + } +} + + private fun buildInlineTags(module: ModuleNodeAdapter, holder: Doc, node: ContentNode, result: MutableList<Tag>) { fun surroundWith(module: ModuleNodeAdapter, holder: Doc, prefix: String, postfix: String, node: ContentBlock, result: MutableList<Tag>) { 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)) |