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 | |
parent | cb9d0bcfe4a2ba8b874f69f9ab208629a44a5a76 (diff) | |
download | dokka-852b4c439b54d9244bbebe421952defa632ad985.tar.gz dokka-852b4c439b54d9244bbebe421952defa632ad985.tar.bz2 dokka-852b4c439b54d9244bbebe421952defa632ad985.zip |
javadoc link rendering fixes
-rw-r--r-- | javadoc/src/main/kotlin/tags.kt | 17 | ||||
-rw-r--r-- | src/Languages/JavaLanguageService.kt | 6 |
2 files changed, 12 insertions, 11 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)) diff --git a/src/Languages/JavaLanguageService.kt b/src/Languages/JavaLanguageService.kt index 5750588e..7e40beff 100644 --- a/src/Languages/JavaLanguageService.kt +++ b/src/Languages/JavaLanguageService.kt @@ -10,11 +10,7 @@ public class JavaLanguageService : LanguageService { override fun render(node: DocumentationNode, renderMode: RenderMode): ContentNode { return ContentText(when (node.kind) { Kind.Package -> renderPackage(node) - Kind.Class, - Kind.Interface, - Kind.Enum, - Kind.EnumItem, - Kind.Object -> renderClass(node) + in Kind.classLike -> renderClass(node) Kind.TypeParameter -> renderTypeParameter(node) Kind.Type, |