aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-09-14 13:49:54 +0200
committerKamil Doległo <9080183+kamildoleglo@users.noreply.github.com>2020-10-07 02:36:57 +0200
commitec637955575995011351b106d3a67194d21c4b15 (patch)
tree5762d6ca0c49cc48dec01240380bc6fd436e81b0 /core
parent7c4301a48af55e156538666b6e645d8d13caae9a (diff)
downloaddokka-ec637955575995011351b106d3a67194d21c4b15.tar.gz
dokka-ec637955575995011351b106d3a67194d21c4b15.tar.bz2
dokka-ec637955575995011351b106d3a67194d21c4b15.zip
Introduce top-level DocTag
Diffstat (limited to 'core')
-rw-r--r--core/src/main/kotlin/model/doc/DocTag.kt3
-rw-r--r--core/src/main/kotlin/model/doc/TagWrapper.kt48
-rw-r--r--core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt4
3 files changed, 24 insertions, 31 deletions
diff --git a/core/src/main/kotlin/model/doc/DocTag.kt b/core/src/main/kotlin/model/doc/DocTag.kt
index b2530ca6..04b5c913 100644
--- a/core/src/main/kotlin/model/doc/DocTag.kt
+++ b/core/src/main/kotlin/model/doc/DocTag.kt
@@ -51,7 +51,8 @@ data class CodeBlock(
data class CustomDocTag(
override val children: List<DocTag> = emptyList(),
- override val params: Map<String, String> = emptyMap()
+ override val params: Map<String, String> = emptyMap(),
+ val name: String
) : DocTag()
data class Dd(
diff --git a/core/src/main/kotlin/model/doc/TagWrapper.kt b/core/src/main/kotlin/model/doc/TagWrapper.kt
index d9b08f2c..cfe99b1e 100644
--- a/core/src/main/kotlin/model/doc/TagWrapper.kt
+++ b/core/src/main/kotlin/model/doc/TagWrapper.kt
@@ -3,38 +3,28 @@ package org.jetbrains.dokka.model.doc
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.WithChildren
-sealed class TagWrapper(val root: DocTag) : WithChildren<DocTag> {
-
+sealed class TagWrapper : WithChildren<DocTag> {
+ abstract val root: DocTag
override val children: List<DocTag>
get() = root.children
-
- override fun equals(other: Any?): Boolean =
- (
- other != null &&
- this::class == other::class &&
- this.root == (other as TagWrapper).root
- )
-
- override fun hashCode(): Int = root.hashCode()
}
-sealed class NamedTagWrapper(root: DocTag, val name: String) : TagWrapper(root) {
- override fun equals(other: Any?): Boolean = super.equals(other) && this.name == (other as NamedTagWrapper).name
- override fun hashCode(): Int = super.hashCode() + name.hashCode()
+sealed class NamedTagWrapper : TagWrapper() {
+ abstract val name: String
}
-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, name: String, val address: DRI?) : NamedTagWrapper(root, name)
-class Param(root: DocTag, name: String) : NamedTagWrapper(root, name)
-class Return(root: DocTag) : TagWrapper(root)
-class Receiver(root: DocTag) : TagWrapper(root)
-class Constructor(root: DocTag) : TagWrapper(root)
-class Throws(root: DocTag, name: String) : NamedTagWrapper(root, name)
-class Sample(root: DocTag, name: String) : NamedTagWrapper(root, name)
-class Deprecated(root: DocTag) : TagWrapper(root)
-class Property(root: DocTag, name: String) : NamedTagWrapper(root, name)
-class Suppress(root: DocTag) : TagWrapper(root)
-class CustomTagWrapper(root: DocTag, name: String) : NamedTagWrapper(root, name)
+data class Description(override val root: DocTag) : TagWrapper()
+data class Author(override val root: DocTag) : TagWrapper()
+data class Version(override val root: DocTag) : TagWrapper()
+data class Since(override val root: DocTag) : TagWrapper()
+data class See(override val root: DocTag, override val name: String, val address: DRI?) : NamedTagWrapper()
+data class Param(override val root: DocTag, override val name: String) : NamedTagWrapper()
+data class Return(override val root: DocTag) : TagWrapper()
+data class Receiver(override val root: DocTag) : TagWrapper()
+data class Constructor(override val root: DocTag) : TagWrapper()
+data class Throws(override val root: DocTag, override val name: String) : NamedTagWrapper()
+data class Sample(override val root: DocTag, override val name: String) : NamedTagWrapper()
+data class Deprecated(override val root: DocTag) : TagWrapper()
+data class Property(override val root: DocTag, override val name: String) : NamedTagWrapper()
+data class Suppress(override val root: DocTag) : TagWrapper()
+data class CustomTagWrapper(override val root: DocTag, override val name: String) : NamedTagWrapper()
diff --git a/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt b/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt
index 7bbebe61..45656a43 100644
--- a/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt
+++ b/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt
@@ -1,8 +1,10 @@
package testApi.testRunner
+import org.intellij.markdown.MarkdownElementTypes
import org.jetbrains.dokka.*
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.*
+import org.jetbrains.dokka.model.doc.CustomDocTag
import org.jetbrains.dokka.model.doc.Description
import org.jetbrains.dokka.model.doc.DocumentationNode
import org.jetbrains.dokka.model.doc.Text
@@ -187,6 +189,6 @@ fun dPackage(
)
fun documentationNode(vararg texts: String): DocumentationNode {
- return DocumentationNode(texts.toList().map { Description(Text(it)) })
+ return DocumentationNode(texts.toList().map { Description(CustomDocTag(listOf(Text(it)), name = MarkdownElementTypes.MARKDOWN_FILE.name)) })
}