From c5e98b1481c48954b6336916eca3644adb5f9372 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 10 Feb 2015 19:42:30 +0100 Subject: fix links to supertypes --- src/Kotlin/KotlinLanguageService.kt | 2 +- src/Model/Content.kt | 2 +- test/data/format/typeLink.html | 24 ++++++++++++++++++++++++ test/data/format/typeLink.kt | 5 +++++ test/src/format/HtmlFormatTest.kt | 6 ++++++ 5 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 test/data/format/typeLink.html create mode 100644 test/data/format/typeLink.kt diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt index 26eee435..526582e6 100644 --- a/src/Kotlin/KotlinLanguageService.kt +++ b/src/Kotlin/KotlinLanguageService.kt @@ -58,7 +58,7 @@ class KotlinLanguageService : LanguageService { } } - private fun ContentBlock.renderLinked(node: DocumentationNode, body: ContentNode.(DocumentationNode)->Unit) { + private fun ContentBlock.renderLinked(node: DocumentationNode, body: ContentBlock.(DocumentationNode)->Unit) { val to = node.links.firstOrNull() if (to == null) body(node) diff --git a/src/Model/Content.kt b/src/Model/Content.kt index 7a0f6c2e..f74a4461 100644 --- a/src/Model/Content.kt +++ b/src/Model/Content.kt @@ -76,7 +76,7 @@ fun ContentBlock.keyword(value: String) = append(ContentKeyword(value)) fun ContentBlock.symbol(value: String) = append(ContentSymbol(value)) fun ContentBlock.identifier(value: String) = append(ContentIdentifier(value)) -fun ContentBlock.link(to: DocumentationNode, body: ContentNode.() -> Unit) { +fun ContentBlock.link(to: DocumentationNode, body: ContentBlock.() -> Unit) { val block = ContentNodeLink(to) block.body() append(block) diff --git a/test/data/format/typeLink.html b/test/data/format/typeLink.html new file mode 100644 index 00000000..3f83dbda --- /dev/null +++ b/test/data/format/typeLink.html @@ -0,0 +1,24 @@ + + +test / Bar + + +test /  / Bar
+
+

Bar

+class Bar : Foo
+
+
+

Constructors

+ + + + + + + +
+<init> +public Bar()
+ + diff --git a/test/data/format/typeLink.kt b/test/data/format/typeLink.kt new file mode 100644 index 00000000..966e020e --- /dev/null +++ b/test/data/format/typeLink.kt @@ -0,0 +1,5 @@ +class Foo() { +} + +class Bar(): Foo { +} diff --git a/test/src/format/HtmlFormatTest.kt b/test/src/format/HtmlFormatTest.kt index 53c1a39d..1e469b91 100644 --- a/test/src/format/HtmlFormatTest.kt +++ b/test/src/format/HtmlFormatTest.kt @@ -75,4 +75,10 @@ public class HtmlFormatTest { htmlService.appendNodes(tempLocation, output, model.members.single().members) } } + + Test fun typeLink() { + verifyOutput("test/data/format/typeLink.kt", ".html") { model, output -> + htmlService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Bar"} ) + } + } } -- cgit