aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/pages
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin/pages')
-rw-r--r--core/src/main/kotlin/pages/CommentsToContentConverter.kt (renamed from core/src/main/kotlin/pages/MarkdownToContentConverter.kt)8
-rw-r--r--core/src/main/kotlin/pages/DocTagToContentConverter.kt (renamed from core/src/main/kotlin/pages/DocNodeToContentConverter.kt)49
-rw-r--r--core/src/main/kotlin/pages/PageBuilder.kt14
-rw-r--r--core/src/main/kotlin/pages/PageContentBuilder.kt18
4 files changed, 42 insertions, 47 deletions
diff --git a/core/src/main/kotlin/pages/MarkdownToContentConverter.kt b/core/src/main/kotlin/pages/CommentsToContentConverter.kt
index 321a3f02..78c7ff4c 100644
--- a/core/src/main/kotlin/pages/MarkdownToContentConverter.kt
+++ b/core/src/main/kotlin/pages/CommentsToContentConverter.kt
@@ -1,12 +1,10 @@
package org.jetbrains.dokka.pages
-import model.doc.DocNode
-import org.jetbrains.dokka.markdown.MarkdownNode
-import org.jetbrains.dokka.links.DRI
+import org.jetbrains.dokka.model.doc.DocTag
-interface MarkdownToContentConverter {
+interface CommentsToContentConverter {
fun buildContent(
- docNode: DocNode,
+ docTag: DocTag,
dci: DCI,
platforms: Set<PlatformData>,
styles: Set<Style> = emptySet(),
diff --git a/core/src/main/kotlin/pages/DocNodeToContentConverter.kt b/core/src/main/kotlin/pages/DocTagToContentConverter.kt
index dce69114..da19765e 100644
--- a/core/src/main/kotlin/pages/DocNodeToContentConverter.kt
+++ b/core/src/main/kotlin/pages/DocTagToContentConverter.kt
@@ -1,16 +1,13 @@
package org.jetbrains.dokka.pages
-import model.doc.*
-import org.intellij.markdown.MarkdownElementTypes
-import org.intellij.markdown.MarkdownTokenTypes
-import org.jetbrains.dokka.markdown.MarkdownNode
+import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.plugability.DokkaContext
-class DocNodeToContentConverter(
+class DocTagToContentConverter(
private val context: DokkaContext
-) : MarkdownToContentConverter {
+) : CommentsToContentConverter {
override fun buildContent(
- docNode: DocNode,
+ docTag: DocTag,
dci: DCI,
platforms: Set<PlatformData>,
styles: Set<Style>,
@@ -18,18 +15,18 @@ class DocNodeToContentConverter(
): List<ContentNode> {
- fun buildChildren(docNode: DocNode, newStyles: Set<Style> = emptySet(), newExtras: Set<Extra> = emptySet()) =
- docNode.children.flatMap {
+ fun buildChildren(docTag: DocTag, newStyles: Set<Style> = emptySet(), newExtras: Set<Extra> = emptySet()) =
+ docTag.children.flatMap {
buildContent(it, dci, platforms, styles + newStyles, extras + newExtras)
}
fun buildHeader(level: Int) =
- listOf(ContentHeader(buildChildren(docNode), level, dci, platforms, styles, extras))
+ listOf(ContentHeader(buildChildren(docTag), level, dci, platforms, styles, extras))
fun buildList(ordered: Boolean) =
- listOf(ContentList(buildChildren(docNode), ordered, dci, platforms, styles, extras))
+ listOf(ContentList(buildChildren(docTag), ordered, dci, platforms, styles, extras))
- return when (docNode) {
+ return when (docTag) {
is H1 -> buildHeader(1)
is H2 -> buildHeader(2)
is H3 -> buildHeader(3)
@@ -38,14 +35,14 @@ class DocNodeToContentConverter(
is H6 -> buildHeader(6)
is Ul -> buildList(false)
is Ol -> buildList(true)
- is Li -> buildChildren(docNode)
- is B -> buildChildren(docNode, setOf(TextStyle.Strong))
- is I -> buildChildren(docNode, setOf(TextStyle.Italic))
- is P -> buildChildren(docNode, newStyles = setOf(TextStyle.Paragraph))
+ is Li -> buildChildren(docTag)
+ is B -> buildChildren(docTag, setOf(TextStyle.Strong))
+ is I -> buildChildren(docTag, setOf(TextStyle.Italic))
+ is P -> buildChildren(docTag, newStyles = setOf(TextStyle.Paragraph))
is A -> listOf(
ContentResolvedLink(
- buildChildren(docNode),
- docNode.params.get("href")!!,
+ buildChildren(docTag),
+ docTag.params.get("href")!!,
dci,
platforms,
styles,
@@ -54,18 +51,18 @@ class DocNodeToContentConverter(
)
is DocumentationLink -> listOf(
ContentDRILink(
- buildChildren(docNode),
- docNode.dri,
- DCI(docNode.dri, ContentKind.Symbol),
+ buildChildren(docTag),
+ docTag.dri,
+ DCI(docTag.dri, ContentKind.Symbol),
platforms,
styles,
extras
)
)
- is BlockQuote -> throw NotImplementedError("Implement DocNotToContent BlockQuote!")
+ is BlockQuote -> TODO("Implement DocNotToContent BlockQuote!")
is Code -> listOf(
ContentCode(
- buildChildren(docNode),
+ buildChildren(docTag),
"",
dci,
platforms,
@@ -73,10 +70,10 @@ class DocNodeToContentConverter(
extras
)
)
- is Img -> throw NotImplementedError("Implement DocNotToContent Img!")
+ is Img -> TODO("Implement DocNotToContent Img!")
is HorizontalRule -> listOf(ContentText("", dci, platforms, setOf()))
- is Text -> listOf(ContentText(docNode.body, dci, platforms, styles, extras))
- else -> buildChildren(docNode)
+ is Text -> listOf(ContentText(docTag.body, dci, platforms, styles, extras))
+ else -> buildChildren(docTag)
}
}
}
diff --git a/core/src/main/kotlin/pages/PageBuilder.kt b/core/src/main/kotlin/pages/PageBuilder.kt
index 8951219a..b1009a33 100644
--- a/core/src/main/kotlin/pages/PageBuilder.kt
+++ b/core/src/main/kotlin/pages/PageBuilder.kt
@@ -1,6 +1,6 @@
package org.jetbrains.dokka.pages
-import model.doc.DocType
+import org.jetbrains.dokka.model.doc.TagWrapper
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.Function
@@ -46,12 +46,12 @@ class DefaultPageBuilder(
header(1) { text("Package ${p.name}") }
block("Types", 2, ContentKind.Properties, p.classes, p.platformData) {
link(it.name, it.dri)
- text(it.briefDocstring)
+ text(it.briefDocTagString)
}
block("Functions", 2, ContentKind.Functions, p.functions, p.platformData) {
link(it.name, it.dri)
signature(it)
- text(it.briefDocstring)
+ text(it.briefDocTagString)
}
}
@@ -71,16 +71,16 @@ class DefaultPageBuilder(
block("Constructors", 2, ContentKind.Functions, c.constructors, c.platformData) {
link(it.name, it.dri)
signature(it)
- text(it.briefDocstring)
+ text(it.briefDocTagString)
}
block("Functions", 2, ContentKind.Functions, c.functions, c.platformData) {
link(it.name, it.dri)
signature(it)
- text(it.briefDocstring)
+ text(it.briefDocTagString)
}
block("Properties", 2, ContentKind.Properties, c.properties, c.platformData) {
link(it.name, it.dri)
- text(it.briefDocstring)
+ text(it.briefDocTagString)
}
}
@@ -94,7 +94,7 @@ class DefaultPageBuilder(
}
}
- private fun DocType.toHeaderString() = this.javaClass.toGenericString().split('.').last()
+ private fun TagWrapper.toHeaderString() = this.javaClass.toGenericString().split('.').last()
}
typealias RootContentBuilder = (Documentable, Kind, PageContentBuilderFunction) -> ContentGroup
diff --git a/core/src/main/kotlin/pages/PageContentBuilder.kt b/core/src/main/kotlin/pages/PageContentBuilder.kt
index e3c924d1..cc53586e 100644
--- a/core/src/main/kotlin/pages/PageContentBuilder.kt
+++ b/core/src/main/kotlin/pages/PageContentBuilder.kt
@@ -1,6 +1,6 @@
package org.jetbrains.dokka.pages
-import model.doc.DocNode
+import org.jetbrains.dokka.model.doc.DocTag
import org.jetbrains.dokka.utilities.DokkaLogger
import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.model.Function
@@ -12,7 +12,7 @@ class DefaultPageContentBuilder(
private val dri: DRI,
private val platformData: Set<PlatformData>,
private val kind: Kind,
- private val markdownConverter: MarkdownToContentConverter,
+ private val commentsConverter: CommentsToContentConverter,
val logger: DokkaLogger,
private val styles: Set<Style> = emptySet(),
private val extras: Set<Extra> = emptySet()
@@ -127,11 +127,11 @@ class DefaultPageContentBuilder(
)
}
- override fun comment(docNode: DocNode) {
+ override fun comment(docTag: DocTag) {
contents += group(ContentKind.Comment) {
with(this as DefaultPageContentBuilder) {
- contents += markdownConverter.buildContent(
- docNode,
+ contents += commentsConverter.buildContent(
+ docTag,
DCI(dri, ContentKind.Comment),
platformData
)
@@ -147,18 +147,18 @@ class DefaultPageContentBuilder(
platformData: Set<PlatformData>,
kind: Kind,
block: PageContentBuilderFunction
- ): ContentGroup = group(dri, platformData, kind, markdownConverter, logger, block)
+ ): ContentGroup = group(dri, platformData, kind, commentsConverter, logger, block)
companion object {
fun group(
dri: DRI,
platformData: Set<PlatformData>,
kind: Kind,
- markdownConverter: MarkdownToContentConverter,
+ commentsConverter: CommentsToContentConverter,
logger: DokkaLogger,
block: PageContentBuilderFunction
): ContentGroup =
- DefaultPageContentBuilder(dri, platformData, kind, markdownConverter, logger).apply(block).build()
+ DefaultPageContentBuilder(dri, platformData, kind, commentsConverter, logger).apply(block).build()
}
}
@@ -191,7 +191,7 @@ interface PageContentBuilder {
fun link(text: String, address: DRI, kind: Kind = ContentKind.Symbol)
fun link(address: DRI, kind: Kind = ContentKind.Symbol, block: PageContentBuilderFunction)
fun linkTable(elements: List<DRI>)
- fun comment(docNode: DocNode)
+ fun comment(docTag: DocTag)
fun header(level: Int, block: PageContentBuilderFunction)
fun <T> list(
elements: List<T>,