aboutsummaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2019-12-13 16:24:16 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2019-12-16 16:43:35 +0100
commit288431f21b18f5311de77c9afcb29346cb7c6498 (patch)
tree0dbadd88532daae26f4edacba15cd43c3cc19b20 /core/src/main
parent54f587baf12ecf8f0115cb406203df14c4d6ab5d (diff)
downloaddokka-288431f21b18f5311de77c9afcb29346cb7c6498.tar.gz
dokka-288431f21b18f5311de77c9afcb29346cb7c6498.tar.bz2
dokka-288431f21b18f5311de77c9afcb29346cb7c6498.zip
Changes naming and applies pull request's requirements
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/kotlin/CoreExtensions.kt4
-rw-r--r--core/src/main/kotlin/model/Documentable.kt23
-rw-r--r--core/src/main/kotlin/model/doc/DocNode.kt74
-rw-r--r--core/src/main/kotlin/model/doc/DocTag.kt81
-rw-r--r--core/src/main/kotlin/model/doc/DocType.kt18
-rw-r--r--core/src/main/kotlin/model/doc/DocumentationNode.kt4
-rw-r--r--core/src/main/kotlin/model/doc/TagWrapper.kt18
-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
-rw-r--r--core/src/main/kotlin/parsers/HtmlParser.kt10
-rw-r--r--core/src/main/kotlin/parsers/MarkdownParser.kt91
-rw-r--r--core/src/main/kotlin/parsers/Parser.kt12
-rw-r--r--core/src/main/kotlin/parsers/factories/DocNodesFromIElementFactory.kt6
-rw-r--r--core/src/main/kotlin/parsers/factories/DocNodesFromStringFactory.kt6
-rw-r--r--core/src/main/kotlin/plugability/DefaultExtensions.kt4
-rw-r--r--core/src/main/kotlin/transformers/descriptors/DefaultDescriptorToDocumentationTranslator.kt2
-rw-r--r--core/src/main/kotlin/transformers/documentation/DefaultDocumentationToPageTranslator.kt2
19 files changed, 230 insertions, 214 deletions
diff --git a/core/src/main/kotlin/CoreExtensions.kt b/core/src/main/kotlin/CoreExtensions.kt
index 87509dc4..7393dd68 100644
--- a/core/src/main/kotlin/CoreExtensions.kt
+++ b/core/src/main/kotlin/CoreExtensions.kt
@@ -1,6 +1,6 @@
package org.jetbrains.dokka
-import org.jetbrains.dokka.pages.MarkdownToContentConverter
+import org.jetbrains.dokka.pages.CommentsToContentConverter
import org.jetbrains.dokka.pages.PageNode
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.ExtensionPoint
@@ -23,7 +23,7 @@ object CoreExtensions {
val descriptorToDocumentationTranslator by coreExtension<DescriptorToDocumentationTranslator>()
val documentationMerger by coreExtension<DocumentationNodeMerger>()
val documentationTransformer by coreExtension<DocumentationNodeTransformer>()
- val markdownToContentConverterFactory by coreExtension<(DokkaContext) -> MarkdownToContentConverter>()
+ val commentsToContentConverterFactory by coreExtension<(DokkaContext) -> CommentsToContentConverter>()
val documentationToPageTranslator by coreExtension<DocumentationToPageTranslator>()
val pageTransformer by coreExtension<PageNodeTransformer>()
val rendererFactory by coreExtension<(FileWriter, LocationProvider, DokkaContext) -> Renderer>()
diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt
index 9f676a1e..4bdd41ae 100644
--- a/core/src/main/kotlin/model/Documentable.kt
+++ b/core/src/main/kotlin/model/Documentable.kt
@@ -1,6 +1,6 @@
package org.jetbrains.dokka.model
-import model.doc.*
+import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.transformers.descriptors.KotlinTypeWrapper
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.pages.PlatformData
@@ -106,7 +106,7 @@ abstract class Documentable {
abstract val children: List<Documentable>
override fun toString(): String {
- return "${javaClass.simpleName}($dri)" + briefDocstring.takeIf { it.isNotBlank() }?.let { " [$it]" }.orEmpty()
+ return "${javaClass.simpleName}($dri)" + briefDocTagString.takeIf { it.isNotBlank() }?.let { " [$it]" }.orEmpty()
}
override fun equals(other: Any?) = other is Documentable && this.dri == other.dri
@@ -118,15 +118,16 @@ abstract class Documentable {
val commentsData: List<DocumentationNode>
get() = platformInfo.map { it.documentationNode }
- val briefDocstring: String
- get() = docNodeSummary(platformInfo.firstOrNull()?.documentationNode?.children?.firstOrNull()?.root ?: Text(body = "")).shorten(40)
-
- private fun docNodeSummary(docNode: DocNode): String {
- if(docNode.children.isEmpty() && docNode is Text)
- return docNode.body
-
- return docNode.children.joinToString(" ") { docNodeSummary(it) }
- }
+ val briefDocTagString: String
+ get() =
+ platformInfo
+ .firstOrNull()
+ ?.documentationNode
+ ?.children
+ ?.firstOrNull()
+ ?.root
+ ?.docTagSummary()
+ ?.shorten(40) ?: ""
open val extra: MutableSet<Extra> = mutableSetOf()
}
diff --git a/core/src/main/kotlin/model/doc/DocNode.kt b/core/src/main/kotlin/model/doc/DocNode.kt
deleted file mode 100644
index 0c643551..00000000
--- a/core/src/main/kotlin/model/doc/DocNode.kt
+++ /dev/null
@@ -1,74 +0,0 @@
-package model.doc
-
-import org.jetbrains.dokka.links.DRI
-
-sealed class DocNode(
- val children: List<DocNode>,
- val params: Map<String, String>
-)
-
-class A(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Big(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class B(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class BlockQuote(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Cite(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Code(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Dd(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Dfn(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Dir(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Div(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Dl(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Dt(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Em(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Font(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Footer(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Frame(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class FrameSet(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class H1(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class H2(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class H3(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class H4(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class H5(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class H6(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Head(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Header(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Html(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class I(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class IFrame(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Img(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Input(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Li(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Link(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Listing(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Main(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Menu(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Meta(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Nav(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class NoFrames(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class NoScript(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Ol(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class P(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Pre(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Script(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Section(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Small(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Span(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Strong(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Sub(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Sup(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Table(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Text(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap(), val body: String = "") : DocNode(children, params)
-class TBody(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Td(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class TFoot(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Th(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class THead(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Title(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Tr(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Tt(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class U(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Ul(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class Var(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params)
-class DocumentationLink(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap(), val dri: DRI) : DocNode(children, params)
-class HorizontalRule() : DocNode(emptyList(), emptyMap())
-class CustomNode(children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap()) : DocNode(children, params) \ No newline at end of file
diff --git a/core/src/main/kotlin/model/doc/DocTag.kt b/core/src/main/kotlin/model/doc/DocTag.kt
new file mode 100644
index 00000000..6d5850a0
--- /dev/null
+++ b/core/src/main/kotlin/model/doc/DocTag.kt
@@ -0,0 +1,81 @@
+package org.jetbrains.dokka.model.doc
+
+import org.jetbrains.dokka.links.DRI
+
+sealed class DocTag(
+ val children: List<DocTag>,
+ val params: Map<String, String>
+) {
+ fun docTagSummary(): String {
+ if(this.children.isEmpty() && this is Text)
+ return this.body
+
+ return this.children.joinToString(" ") { it.docTagSummary() }
+ }
+}
+
+class A(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Big(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class B(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class BlockQuote(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Cite(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Code(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Dd(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Dfn(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Dir(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Div(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Dl(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Dt(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Em(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Font(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Footer(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Frame(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class FrameSet(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class H1(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class H2(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class H3(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class H4(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class H5(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class H6(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Head(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Header(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Html(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class I(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class IFrame(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Img(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Input(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Li(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Link(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Listing(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Main(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Menu(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Meta(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Nav(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class NoFrames(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class NoScript(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Ol(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class P(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Pre(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Script(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Section(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Small(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Span(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Strong(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+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 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)
+class Th(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class THead(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Title(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Tr(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+class Tt(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params)
+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 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/DocType.kt b/core/src/main/kotlin/model/doc/DocType.kt
deleted file mode 100644
index 0888876e..00000000
--- a/core/src/main/kotlin/model/doc/DocType.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package model.doc
-
-sealed class DocType(val root: DocNode)
-class Description(root: DocNode) : DocType(root)
-class Author(root: DocNode) : DocType(root)
-class Version(root: DocNode) : DocType(root)
-class Since(root: DocNode) : DocType(root)
-class See(root: DocNode, val name: String) : DocType(root)
-class Param(root: DocNode, val name: String) : DocType(root)
-class Return(root: DocNode) : DocType(root)
-class Receiver(root: DocNode) : DocType(root)
-class Constructor(root: DocNode) : DocType(root)
-class Throws(root: DocNode, val name: String) : DocType(root)
-class Sample(root: DocNode, val name: String) : DocType(root)
-class Deprecated(root: DocNode) : DocType(root)
-class Property(root: DocNode, val name: String) : DocType(root)
-class Suppress(root: DocNode) : DocType(root)
-class CustomTag(root: DocNode, val name: String) : DocType(root)
diff --git a/core/src/main/kotlin/model/doc/DocumentationNode.kt b/core/src/main/kotlin/model/doc/DocumentationNode.kt
index 73424616..a143a941 100644
--- a/core/src/main/kotlin/model/doc/DocumentationNode.kt
+++ b/core/src/main/kotlin/model/doc/DocumentationNode.kt
@@ -1,3 +1,3 @@
-package model.doc
+package org.jetbrains.dokka.model.doc
-data class DocumentationNode(val children: List<DocType>) \ No newline at end of file
+data class DocumentationNode(val children: List<TagWrapper>) \ 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
new file mode 100644
index 00000000..8def013e
--- /dev/null
+++ b/core/src/main/kotlin/model/doc/TagWrapper.kt
@@ -0,0 +1,18 @@
+package org.jetbrains.dokka.model.doc
+
+sealed class TagWrapper(val root: DocTag)
+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 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 Deprecated(root: DocTag) : TagWrapper(root)
+class Property(root: DocTag, val name: String) : TagWrapper(root)
+class Suppress(root: DocTag) : TagWrapper(root)
+class CustomWrapperTag(root: DocTag, val name: String) : TagWrapper(root) \ No newline at end of file
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>,
diff --git a/core/src/main/kotlin/parsers/HtmlParser.kt b/core/src/main/kotlin/parsers/HtmlParser.kt
index 30f882b1..aebdee41 100644
--- a/core/src/main/kotlin/parsers/HtmlParser.kt
+++ b/core/src/main/kotlin/parsers/HtmlParser.kt
@@ -1,6 +1,6 @@
-package parsers
+package org.jetbrains.dokka.parsers
-import model.doc.*
+import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.parsers.factories.DocNodesFromStringFactory
import org.jsoup.Jsoup
import org.jsoup.nodes.Node
@@ -11,10 +11,10 @@ class HtmlParser : Parser() {
inner class NodeFilterImpl : NodeFilter {
- private val nodesCache: MutableMap<Int, MutableList<DocNode>> = mutableMapOf()
+ private val nodesCache: MutableMap<Int, MutableList<DocTag>> = mutableMapOf()
private var currentDepth = 0
- fun collect(): DocNode = nodesCache[currentDepth]!![0]
+ fun collect(): DocTag = nodesCache[currentDepth]!![0]
override fun tail(node: Node?, depth: Int): NodeFilter.FilterResult {
val nodeName = node!!.nodeName()
@@ -65,7 +65,7 @@ class HtmlParser : Parser() {
}
- private fun htmlToDocNode(string: String): DocNode {
+ private fun htmlToDocNode(string: String): DocTag {
val document = Jsoup.parse(string)
val nodeFilterImpl = NodeFilterImpl()
NodeTraversor.filter(nodeFilterImpl, document.root())
diff --git a/core/src/main/kotlin/parsers/MarkdownParser.kt b/core/src/main/kotlin/parsers/MarkdownParser.kt
index 44c917e3..b4ebdac7 100644
--- a/core/src/main/kotlin/parsers/MarkdownParser.kt
+++ b/core/src/main/kotlin/parsers/MarkdownParser.kt
@@ -1,9 +1,10 @@
-package parsers
+package org.jetbrains.dokka.parsers
-import model.doc.*
+import org.jetbrains.dokka.model.doc.*
import org.intellij.markdown.MarkdownElementTypes
import org.intellij.markdown.MarkdownTokenTypes
import org.intellij.markdown.ast.ASTNode
+import org.intellij.markdown.ast.CompositeASTNode
import org.intellij.markdown.ast.impl.ListItemCompositeNode
import org.intellij.markdown.flavours.commonmark.CommonMarkFlavourDescriptor
import org.jetbrains.dokka.analysis.DokkaResolutionFacade
@@ -22,19 +23,25 @@ class MarkdownParser (
inner class MarkdownVisitor(val text: String) {
- private fun headersHandler(node: ASTNode): DocNode =
- DocNodesFromIElementFactory.getInstance(node.type, visitNode(node.children.find { it.type == MarkdownTokenTypes.ATX_CONTENT }!!).children.drop(1))
+ private fun headersHandler(node: ASTNode): DocTag =
+ DocNodesFromIElementFactory.getInstance(
+ node.type,
+ visitNode(node.children.find { it.type == MarkdownTokenTypes.ATX_CONTENT }!!).children
+ )
- private fun horizontalRulesHandler(node: ASTNode): DocNode =
+ private fun horizontalRulesHandler(node: ASTNode): DocTag =
DocNodesFromIElementFactory.getInstance(MarkdownTokenTypes.HORIZONTAL_RULE)
- private fun emphasisHandler(node: ASTNode): DocNode =
- DocNodesFromIElementFactory.getInstance(node.type, children = listOf(visitNode(node.children[node.children.size/2])))
+ private fun emphasisHandler(node: ASTNode): DocTag =
+ DocNodesFromIElementFactory.getInstance(
+ node.type,
+ children = listOf(visitNode(node.children[node.children.size / 2]))
+ )
- private fun blockquotesHandler(node: ASTNode): DocNode =
+ private fun blockquotesHandler(node: ASTNode): DocTag =
DocNodesFromIElementFactory.getInstance(node.type, children = node.children.drop(1).map { visitNode(it) })
- private fun listsHandler(node: ASTNode): DocNode {
+ private fun listsHandler(node: ASTNode): DocTag {
val children = node.children.filterIsInstance<ListItemCompositeNode>().flatMap {
if( it.children.last().type in listOf(MarkdownElementTypes.ORDERED_LIST, MarkdownElementTypes.UNORDERED_LIST) ) {
@@ -57,8 +64,7 @@ class MarkdownParser (
children = it
.children
.drop(1)
- .filter { it.type !in listOf(MarkdownTokenTypes.WHITE_SPACE, MarkdownTokenTypes.EOL) }
- .map { visitNode(it) }
+ .evaluateChildren()
)
else
visitNode(it)
@@ -72,7 +78,7 @@ class MarkdownParser (
)
}
- private fun linksHandler(node: ASTNode): DocNode {
+ private fun linksHandler(node: ASTNode): DocTag {
val linkNode = node.children.find { it.type == MarkdownElementTypes.LINK_LABEL }!!
val link = text.substring(linkNode.startOffset+1, linkNode.endOffset-1)
@@ -91,19 +97,20 @@ class MarkdownParser (
}
val href = mapOf("href" to link)
return when (node.type) {
- MarkdownElementTypes.FULL_REFERENCE_LINK -> DocNodesFromIElementFactory.getInstance(node.type, params = href, children = node.children.find { it.type == MarkdownElementTypes.LINK_TEXT }!!.children.drop(1).dropLast(1).map { visitNode(it) }, dri = dri)
+ MarkdownElementTypes.FULL_REFERENCE_LINK -> DocNodesFromIElementFactory.getInstance(node.type, params = href, children = node.children.find { it.type == MarkdownElementTypes.LINK_TEXT }!!.children.drop(1).dropLast(1).evaluateChildren(), dri = dri)
else -> DocNodesFromIElementFactory.getInstance(node.type, params = href, children = listOf(visitNode(linkNode)), dri = dri)
}
}
- private fun imagesHandler(node: ASTNode): DocNode {
- val linkNode = node.children.last().children.find { it.type == MarkdownElementTypes.LINK_LABEL }!!.children[1]
+ private fun imagesHandler(node: ASTNode): DocTag {
+ val linkNode =
+ node.children.last().children.find { it.type == MarkdownElementTypes.LINK_LABEL }!!.children[1]
val link = text.substring(linkNode.startOffset, linkNode.endOffset)
val src = mapOf("src" to link)
return DocNodesFromIElementFactory.getInstance(node.type, params = src, children = listOf(visitNode(node.children.last().children.find { it.type == MarkdownElementTypes.LINK_TEXT }!!)))
}
- private fun codeSpansHandler(node: ASTNode): DocNode =
+ private fun codeSpansHandler(node: ASTNode): DocTag =
DocNodesFromIElementFactory.getInstance(
node.type,
children = listOf(
@@ -115,7 +122,7 @@ class MarkdownParser (
)
)
- private fun codeFencesHandler(node: ASTNode): DocNode =
+ private fun codeFencesHandler(node: ASTNode): DocTag =
DocNodesFromIElementFactory.getInstance(
node.type,
children = node
@@ -129,13 +136,15 @@ class MarkdownParser (
?: emptyMap()
)
- private fun codeBlocksHandler(node: ASTNode): DocNode =
- DocNodesFromIElementFactory.getInstance(node.type, children = node.children.map { visitNode(it) })
+ private fun codeBlocksHandler(node: ASTNode): DocTag =
+ DocNodesFromIElementFactory.getInstance(node.type, children = node.children.evaluateChildren())
- private fun defaultHandler(node: ASTNode): DocNode =
- DocNodesFromIElementFactory.getInstance(MarkdownElementTypes.PARAGRAPH, children = node.children.map { visitNode(it) })
+ private fun defaultHandler(node: ASTNode): DocTag =
+ DocNodesFromIElementFactory.getInstance(
+ MarkdownElementTypes.PARAGRAPH,
+ children = node.children.evaluateChildren())
- fun visitNode(node: ASTNode): DocNode =
+ fun visitNode(node: ASTNode): DocTag =
when (node.type) {
MarkdownElementTypes.ATX_1,
MarkdownElementTypes.ATX_2,
@@ -155,16 +164,17 @@ class MarkdownParser (
MarkdownElementTypes.CODE_FENCE -> codeFencesHandler(node)
MarkdownElementTypes.CODE_SPAN -> codeSpansHandler(node)
MarkdownElementTypes.IMAGE -> imagesHandler(node)
- MarkdownTokenTypes.EOL -> DocNodesFromIElementFactory.getInstance(MarkdownTokenTypes.TEXT, body = "\n")
- MarkdownTokenTypes.WHITE_SPACE -> DocNodesFromIElementFactory.getInstance(MarkdownTokenTypes.TEXT, body = " ")
MarkdownTokenTypes.CODE_FENCE_CONTENT,
MarkdownTokenTypes.CODE_LINE,
MarkdownTokenTypes.TEXT -> DocNodesFromIElementFactory.getInstance(MarkdownTokenTypes.TEXT, body = text.substring(node.startOffset, node.endOffset))
else -> defaultHandler(node)
}
+
+ private fun List<ASTNode>.evaluateChildren(): List<DocTag> =
+ this.filter { it is CompositeASTNode || it.type == MarkdownTokenTypes.TEXT }.map { visitNode(it) }
}
- private fun markdownToDocNode(text: String): DocNode {
+ private fun markdownToDocNode(text: String): DocTag {
val flavourDescriptor = CommonMarkFlavourDescriptor()
val markdownAstRoot: ASTNode = IntellijMarkdownParser(flavourDescriptor).buildMarkdownTreeFromString(text)
@@ -181,20 +191,23 @@ class MarkdownParser (
else
DocumentationNode(
(listOf(kDocTag) + kDocTag.children).filterIsInstance<KDocTag>().map {
- when( it.knownTag ) {
- null -> Description(parseStringToDocNode(it.getContent()))
- KDocKnownTag.AUTHOR -> Author(parseStringToDocNode(it.getContent()))
- KDocKnownTag.THROWS -> Throws(parseStringToDocNode(it.getContent()), it.getSubjectName()!!)
- KDocKnownTag.EXCEPTION -> Throws(parseStringToDocNode(it.getContent()), it.getSubjectName()!!)
- KDocKnownTag.PARAM -> Param(parseStringToDocNode(it.getContent()), it.getSubjectName()!!)
- KDocKnownTag.RECEIVER -> Receiver(parseStringToDocNode(it.getContent()))
- KDocKnownTag.RETURN -> Return(parseStringToDocNode(it.getContent()))
- KDocKnownTag.SEE -> See(parseStringToDocNode(it.getContent()), it.getSubjectName()!!)
- KDocKnownTag.SINCE -> Since(parseStringToDocNode(it.getContent()))
- KDocKnownTag.CONSTRUCTOR -> Constructor(parseStringToDocNode(it.getContent()))
- KDocKnownTag.PROPERTY -> Property(parseStringToDocNode(it.getContent()), it.getSubjectName()!!)
- KDocKnownTag.SAMPLE -> Sample(parseStringToDocNode(it.getContent()), it.getSubjectName()!!)
- KDocKnownTag.SUPPRESS -> Suppress(parseStringToDocNode(it.getContent()))
+ when (it.knownTag) {
+ null -> if (it.name == null) Description(parseStringToDocNode(it.getContent())) else CustomWrapperTag(
+ parseStringToDocNode(it.getContent()),
+ it.name!!
+ )
+ KDocKnownTag.AUTHOR -> Author(parseStringToDocNode(it.getContent()))
+ KDocKnownTag.THROWS -> Throws(parseStringToDocNode(it.getContent()), it.getSubjectName()!!)
+ KDocKnownTag.EXCEPTION -> Throws(parseStringToDocNode(it.getContent()), it.getSubjectName()!!)
+ KDocKnownTag.PARAM -> Param(parseStringToDocNode(it.getContent()), it.getSubjectName()!!)
+ KDocKnownTag.RECEIVER -> Receiver(parseStringToDocNode(it.getContent()))
+ KDocKnownTag.RETURN -> Return(parseStringToDocNode(it.getContent()))
+ KDocKnownTag.SEE -> See(parseStringToDocNode(it.getContent()), it.getSubjectName()!!)
+ KDocKnownTag.SINCE -> Since(parseStringToDocNode(it.getContent()))
+ KDocKnownTag.CONSTRUCTOR -> Constructor(parseStringToDocNode(it.getContent()))
+ KDocKnownTag.PROPERTY -> Property(parseStringToDocNode(it.getContent()), it.getSubjectName()!!)
+ KDocKnownTag.SAMPLE -> Sample(parseStringToDocNode(it.getContent()), it.getSubjectName()!!)
+ KDocKnownTag.SUPPRESS -> Suppress(parseStringToDocNode(it.getContent()))
}
}
)
diff --git a/core/src/main/kotlin/parsers/Parser.kt b/core/src/main/kotlin/parsers/Parser.kt
index a2a90dcd..daa9f38d 100644
--- a/core/src/main/kotlin/parsers/Parser.kt
+++ b/core/src/main/kotlin/parsers/Parser.kt
@@ -1,19 +1,19 @@
-package parsers
+package org.jetbrains.dokka.parsers
-import model.doc.*
-import model.doc.Deprecated
+import org.jetbrains.dokka.model.doc.*
+import org.jetbrains.dokka.model.doc.Deprecated
abstract class Parser {
- abstract fun parseStringToDocNode(extractedString: String): DocNode
+ abstract fun parseStringToDocNode(extractedString: String): DocTag
abstract fun preparse(text: String): String
fun parse(text: String): DocumentationNode {
val list = jkdocToListOfPairs(preparse(text))
- val mappedList: List<DocType> = list.map {
+ val mappedList: List<TagWrapper> = list.map {
when(it.first) {
"description" -> Description(parseStringToDocNode(it.second))
"author" -> Author(parseStringToDocNode(it.second))
@@ -29,7 +29,7 @@ abstract class Parser {
"deprecated" -> Deprecated(parseStringToDocNode(it.second))
"sample" -> Sample(parseStringToDocNode(it.second.substringAfter(' ')), it.second.substringBefore(' '))
"suppress" -> Suppress(parseStringToDocNode(it.second))
- else -> CustomTag(parseStringToDocNode(it.second), it.first)
+ else -> CustomWrapperTag(parseStringToDocNode(it.second), it.first)
}
}
return DocumentationNode(mappedList)
diff --git a/core/src/main/kotlin/parsers/factories/DocNodesFromIElementFactory.kt b/core/src/main/kotlin/parsers/factories/DocNodesFromIElementFactory.kt
index a93be0d3..1a302176 100644
--- a/core/src/main/kotlin/parsers/factories/DocNodesFromIElementFactory.kt
+++ b/core/src/main/kotlin/parsers/factories/DocNodesFromIElementFactory.kt
@@ -1,6 +1,6 @@
package org.jetbrains.dokka.parsers.factories
-import model.doc.*
+import org.jetbrains.dokka.model.doc.*
import org.intellij.markdown.IElementType
import org.intellij.markdown.MarkdownElementTypes
import org.intellij.markdown.MarkdownTokenTypes
@@ -8,7 +8,7 @@ import org.jetbrains.dokka.links.DRI
import java.lang.NullPointerException
object DocNodesFromIElementFactory {
- fun getInstance(type: IElementType, children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap(), body: String? = null, dri: DRI? = null) =
+ fun getInstance(type: IElementType, children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap(), body: String? = null, dri: DRI? = null) =
when(type) {
MarkdownElementTypes.SHORT_REFERENCE_LINK,
MarkdownElementTypes.FULL_REFERENCE_LINK -> if(dri == null) A(children, params) else DocumentationLink(children, params, dri)
@@ -31,6 +31,6 @@ object DocNodesFromIElementFactory {
MarkdownElementTypes.PARAGRAPH -> P(children, params)
MarkdownTokenTypes.TEXT -> Text(children, params, body ?: throw NullPointerException("Text body should be at least empty string passed to DocNodes factory!"))
MarkdownTokenTypes.HORIZONTAL_RULE -> HorizontalRule()
- else -> CustomNode(children, params)
+ else -> CustomDocTag(children, params)
}
} \ No newline at end of file
diff --git a/core/src/main/kotlin/parsers/factories/DocNodesFromStringFactory.kt b/core/src/main/kotlin/parsers/factories/DocNodesFromStringFactory.kt
index 49102ed0..6090cdb4 100644
--- a/core/src/main/kotlin/parsers/factories/DocNodesFromStringFactory.kt
+++ b/core/src/main/kotlin/parsers/factories/DocNodesFromStringFactory.kt
@@ -1,11 +1,11 @@
package org.jetbrains.dokka.parsers.factories
-import model.doc.*
+import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.links.DRI
import java.lang.NullPointerException
object DocNodesFromStringFactory {
- fun getInstance(name: String, children: List<DocNode> = emptyList(), params: Map<String, String> = emptyMap(), body: String? = null, dri: DRI? = null) =
+ fun getInstance(name: String, children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap(), body: String? = null, dri: DRI? = null) =
when(name) {
"a" -> A(children, params)
"big" -> Big(children, params)
@@ -71,6 +71,6 @@ object DocNodesFromStringFactory {
"var" -> Var(children, params)
"documentationlink" -> DocumentationLink(children, params, dri ?: throw NullPointerException("DRI cannot be passed null while constructing documentation link!"))
"hr" -> HorizontalRule()
- else -> CustomNode(children, params)
+ else -> CustomDocTag(children, params)
}
} \ No newline at end of file
diff --git a/core/src/main/kotlin/plugability/DefaultExtensions.kt b/core/src/main/kotlin/plugability/DefaultExtensions.kt
index e46ade01..86ca5ca8 100644
--- a/core/src/main/kotlin/plugability/DefaultExtensions.kt
+++ b/core/src/main/kotlin/plugability/DefaultExtensions.kt
@@ -1,7 +1,7 @@
package org.jetbrains.dokka.plugability
import org.jetbrains.dokka.CoreExtensions
-import org.jetbrains.dokka.pages.DocNodeToContentConverter
+import org.jetbrains.dokka.pages.DocTagToContentConverter
import org.jetbrains.dokka.renderers.HtmlRenderer
import org.jetbrains.dokka.resolvers.DefaultLocationProvider
import org.jetbrains.dokka.transformers.descriptors.DefaultDescriptorToDocumentationTranslator
@@ -14,7 +14,7 @@ object DefaultExtensions : DokkaExtensionHandler {
when (point) {
CoreExtensions.descriptorToDocumentationTranslator -> DefaultDescriptorToDocumentationTranslator
CoreExtensions.documentationMerger -> DefaultDocumentationNodeMerger
- CoreExtensions.markdownToContentConverterFactory -> ::DocNodeToContentConverter
+ CoreExtensions.commentsToContentConverterFactory -> ::DocTagToContentConverter
CoreExtensions.documentationToPageTranslator -> DefaultDocumentationToPageTranslator
CoreExtensions.rendererFactory -> ::HtmlRenderer
CoreExtensions.locationProviderFactory -> ::DefaultLocationProvider
diff --git a/core/src/main/kotlin/transformers/descriptors/DefaultDescriptorToDocumentationTranslator.kt b/core/src/main/kotlin/transformers/descriptors/DefaultDescriptorToDocumentationTranslator.kt
index bdd345f1..389a265f 100644
--- a/core/src/main/kotlin/transformers/descriptors/DefaultDescriptorToDocumentationTranslator.kt
+++ b/core/src/main/kotlin/transformers/descriptors/DefaultDescriptorToDocumentationTranslator.kt
@@ -18,7 +18,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperInterfaces
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.types.KotlinType
-import parsers.MarkdownParser
+import org.jetbrains.dokka.parsers.MarkdownParser
object DefaultDescriptorToDocumentationTranslator: DescriptorToDocumentationTranslator {
override fun invoke(
diff --git a/core/src/main/kotlin/transformers/documentation/DefaultDocumentationToPageTranslator.kt b/core/src/main/kotlin/transformers/documentation/DefaultDocumentationToPageTranslator.kt
index c6813ef8..32053aa0 100644
--- a/core/src/main/kotlin/transformers/documentation/DefaultDocumentationToPageTranslator.kt
+++ b/core/src/main/kotlin/transformers/documentation/DefaultDocumentationToPageTranslator.kt
@@ -16,7 +16,7 @@ object DefaultDocumentationToPageTranslator : DocumentationToPageTranslator {
node.dri,
node.platformData,
kind,
- context.single(CoreExtensions.markdownToContentConverterFactory).invoke(context),
+ context.single(CoreExtensions.commentsToContentConverterFactory).invoke(context),
context.logger,
operation
)