diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-11-04 17:32:51 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-11-04 17:32:51 +0100 |
commit | 852b4c439b54d9244bbebe421952defa632ad985 (patch) | |
tree | e5441388777c52bb3b009732cbfa47aa2502b0e5 /javadoc/src/main | |
parent | cb9d0bcfe4a2ba8b874f69f9ab208629a44a5a76 (diff) | |
download | dokka-852b4c439b54d9244bbebe421952defa632ad985.tar.gz dokka-852b4c439b54d9244bbebe421952defa632ad985.tar.bz2 dokka-852b4c439b54d9244bbebe421952defa632ad985.zip |
javadoc link rendering fixes
Diffstat (limited to 'javadoc/src/main')
-rw-r--r-- | javadoc/src/main/kotlin/tags.kt | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/javadoc/src/main/kotlin/tags.kt b/javadoc/src/main/kotlin/tags.kt index 266c8712..9fdf86f2 100644 --- a/javadoc/src/main/kotlin/tags.kt +++ b/javadoc/src/main/kotlin/tags.kt @@ -30,7 +30,13 @@ class SeeExternalLinkTagAdapter(val holder: Doc, val link: ContentExternalLink) override fun position(): SourcePosition = holder.position() override fun text(): String = label() override fun inlineTags(): Array<out Tag> = emptyArray() // TODO - override fun label(): String = "<a href=\"${link.href}\">${link.href}</a>" + + override fun label(): String { + val contentText = link.children.singleOrNull() as? ContentText + val label = contentText?.text ?: link.href + return "<a href=\"${link.href}\">$label</a>" + } + override fun referencedPackage(): PackageDoc? = null override fun referencedClass(): ClassDoc? = null override fun referencedMemberName(): String? = null @@ -139,14 +145,13 @@ private fun buildInlineTags(module: ModuleNodeAdapter, holder: Doc, node: Conten when (node) { is ContentText -> result.add(TextTag(holder, node)) is ContentNodeLink -> { - when (node.node?.kind) { + val target = node.node + when (target?.kind) { DocumentationNode.Kind.Function -> result.add(SeeMethodTagAdapter(holder, MethodAdapter(module, node.node!!), node)) - DocumentationNode.Kind.Class, - DocumentationNode.Kind.ExternalClass, - DocumentationNode.Kind.Enum -> result.add(SeeClassTagAdapter(holder, ClassDocumentationNodeAdapter(module, node.node!!), node)) + in DocumentationNode.Kind.classLike -> result.add(SeeClassTagAdapter(holder, ClassDocumentationNodeAdapter(module, node.node!!), node)) - else -> result.add(TextTag(holder, ContentText("other link: ${node.node}"))) // TODO + else -> node.children.forEach { buildInlineTags(module, holder, it, result) } } } is ContentExternalLink -> result.add(SeeExternalLinkTagAdapter(holder, node)) |