diff options
author | Andrzej Ratajczak <andrzej.ratajczak98@gmail.com> | 2020-01-16 16:58:57 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-02-06 10:53:43 +0100 |
commit | 6085f6acaf90c1a82b1249878c70a871a52c64e5 (patch) | |
tree | d54023fcda65b856ccb0edfe301246cf66398d1f /core/src/main/kotlin | |
parent | 1a8c57abd0bf21e53d580f166bedbf2fa6988db1 (diff) | |
download | dokka-6085f6acaf90c1a82b1249878c70a871a52c64e5.tar.gz dokka-6085f6acaf90c1a82b1249878c70a871a52c64e5.tar.bz2 dokka-6085f6acaf90c1a82b1249878c70a871a52c64e5.zip |
Resolved problems with doubling comments
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r-- | core/src/main/kotlin/model/Documentable.kt | 5 | ||||
-rw-r--r-- | core/src/main/kotlin/model/doc/DocTag.kt | 20 | ||||
-rw-r--r-- | core/src/main/kotlin/model/doc/TagWrapper.kt | 42 | ||||
-rw-r--r-- | core/src/main/kotlin/pages/PageBuilder.kt | 22 | ||||
-rw-r--r-- | core/src/main/kotlin/renderers/html/HtmlRenderer.kt | 3 |
5 files changed, 72 insertions, 20 deletions
diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index 3f50667a..a1df0d0b 100644 --- a/core/src/main/kotlin/model/Documentable.kt +++ b/core/src/main/kotlin/model/Documentable.kt @@ -113,11 +113,6 @@ abstract class Documentable { override fun hashCode() = dri.hashCode() - - - val commentsData: List<DocumentationNode> - get() = platformInfo.map { it.documentationNode } - val briefDocTagString: String get() = platformInfo diff --git a/core/src/main/kotlin/model/doc/DocTag.kt b/core/src/main/kotlin/model/doc/DocTag.kt index 6d5850a0..0d8b361a 100644 --- a/core/src/main/kotlin/model/doc/DocTag.kt +++ b/core/src/main/kotlin/model/doc/DocTag.kt @@ -12,6 +12,16 @@ sealed class DocTag( return this.children.joinToString(" ") { it.docTagSummary() } } + + override fun equals(other: Any?): Boolean = + ( + other != null && + other::class == this::class && + this.children == (other as DocTag).children && + this.params == other.params + ) + + override fun hashCode(): Int = children.hashCode() + params.hashCode() } class A(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) @@ -64,7 +74,10 @@ class Strong(children: List<DocTag> = emptyList(), params: Map<String, String> = class Sub(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) class Sup(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) class Table(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) -class Text(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap(), val body: String = "") : DocTag(children, params) +class Text(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap(), val body: String = "") : DocTag(children, params) { + override fun equals(other: Any?): Boolean = super.equals(other) && this.body == (other as Text).body + override fun hashCode(): Int = super.hashCode() + body.hashCode() +} class TBody(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) class Td(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) class TFoot(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) @@ -76,6 +89,9 @@ class Tt(children: List<DocTag> = emptyList(), params: Map<String, String> = emp class U(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) class Ul(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) class Var(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) -class DocumentationLink(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap(), val dri: DRI) : DocTag(children, params) +class DocumentationLink(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap(), val dri: DRI) : DocTag(children, params) { + override fun equals(other: Any?): Boolean = super.equals(other) && this.dri == (other as DocumentationLink).dri + override fun hashCode(): Int = super.hashCode() + dri.hashCode() +} class HorizontalRule : DocTag(emptyList(), emptyMap()) class CustomDocTag(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
\ No newline at end of file diff --git a/core/src/main/kotlin/model/doc/TagWrapper.kt b/core/src/main/kotlin/model/doc/TagWrapper.kt index 8def013e..fa9031d7 100644 --- a/core/src/main/kotlin/model/doc/TagWrapper.kt +++ b/core/src/main/kotlin/model/doc/TagWrapper.kt @@ -1,18 +1,46 @@ package org.jetbrains.dokka.model.doc -sealed class TagWrapper(val root: DocTag) +sealed class TagWrapper(val root: DocTag) { + + override fun equals(other: Any?): Boolean = + ( + other != null && + this::class == other::class && + this.root == (other as TagWrapper).root + ) + + override fun hashCode(): Int = root.hashCode() +} class Description(root: DocTag) : TagWrapper(root) class Author(root: DocTag) : TagWrapper(root) class Version(root: DocTag) : TagWrapper(root) class Since(root: DocTag) : TagWrapper(root) -class See(root: DocTag, val name: String) : TagWrapper(root) -class Param(root: DocTag, val name: String) : TagWrapper(root) +class See(root: DocTag, val name: String) : TagWrapper(root) { + override fun equals(other: Any?): Boolean = super.equals(other) && this.name == (other as See).name + override fun hashCode(): Int = super.hashCode() + name.hashCode() +} +class Param(root: DocTag, val name: String) : TagWrapper(root) { + override fun equals(other: Any?): Boolean = super.equals(other) && this.name == (other as Param).name + override fun hashCode(): Int = super.hashCode() + name.hashCode() +} class Return(root: DocTag) : TagWrapper(root) class Receiver(root: DocTag) : TagWrapper(root) class Constructor(root: DocTag) : TagWrapper(root) -class Throws(root: DocTag, val name: String) : TagWrapper(root) -class Sample(root: DocTag, val name: String) : TagWrapper(root) +class Throws(root: DocTag, val name: String) : TagWrapper(root) { + override fun equals(other: Any?): Boolean = super.equals(other) && this.name == (other as Throws).name + override fun hashCode(): Int = super.hashCode() + name.hashCode() +} +class Sample(root: DocTag, val name: String) : TagWrapper(root) { + override fun equals(other: Any?): Boolean = super.equals(other) && this.name == (other as Sample).name + override fun hashCode(): Int = super.hashCode() + name.hashCode() +} class Deprecated(root: DocTag) : TagWrapper(root) -class Property(root: DocTag, val name: String) : TagWrapper(root) +class Property(root: DocTag, val name: String) : TagWrapper(root) { + override fun equals(other: Any?): Boolean = super.equals(other) && this.name == (other as Property).name + override fun hashCode(): Int = super.hashCode() + name.hashCode() +} class Suppress(root: DocTag) : TagWrapper(root) -class CustomWrapperTag(root: DocTag, val name: String) : TagWrapper(root)
\ No newline at end of file +class CustomWrapperTag(root: DocTag, val name: String) : TagWrapper(root) { + override fun equals(other: Any?): Boolean = super.equals(other) && this.name == (other as CustomWrapperTag).name + override fun hashCode(): Int = super.hashCode() + name.hashCode() +}
\ No newline at end of file diff --git a/core/src/main/kotlin/pages/PageBuilder.kt b/core/src/main/kotlin/pages/PageBuilder.kt index ce32645d..e8930fae 100644 --- a/core/src/main/kotlin/pages/PageBuilder.kt +++ b/core/src/main/kotlin/pages/PageBuilder.kt @@ -60,9 +60,12 @@ class DefaultPageBuilder( header(2) { text("SuperInterfaces") } linkTable(it) } - c.commentsData.forEach { - it.children.forEach { - header(3) { text(it.toHeaderString()) } + c.platformInfo.forEach { platformInfo -> + platformInfo.documentationNode.children.forEach { + header(3) { + text(it.toHeaderString()) + text("[${platformInfo.platformData.joinToString(", ") { it.platformType.name }}]") + } comment(it.root) text("\n") } @@ -86,10 +89,19 @@ class DefaultPageBuilder( private fun contentForFunction(f: Function) = group(f) { header(1) { text(f.name) } signature(f) - f.commentsData.forEach { it.children.forEach { comment(it.root) } } + f.platformInfo.forEach { platformInfo -> + platformInfo.documentationNode.children.forEach { + header(3) { + text(it.toHeaderString()) + text("[${platformInfo.platformData.joinToString(", ") { it.platformType.name }}]") + } + comment(it.root) + text("\n") + } + } block("Parameters", 2, ContentKind.Parameters, f.children, f.platformData) { text(it.name ?: "<receiver>") - it.commentsData.forEach { it.children.forEach { comment(it.root) } } + it.platformInfo.forEach { it.documentationNode.children.forEach { comment(it.root) } } } } diff --git a/core/src/main/kotlin/renderers/html/HtmlRenderer.kt b/core/src/main/kotlin/renderers/html/HtmlRenderer.kt index 4553011c..27197ce6 100644 --- a/core/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/core/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -98,7 +98,8 @@ open class HtmlRenderer( 2 -> h2(block = content) 3 -> h3(block = content) 4 -> h4(block = content) - else -> h5(block = content) + 5 -> h5(block = content) + else -> h6(block = content) } } |