aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/markdown/MarkdownProcessor.kt53
-rw-r--r--core/src/main/kotlin/model/additionalExtras.kt (renamed from core/src/main/kotlin/model/aditionalExtras.kt)0
-rw-r--r--core/src/main/kotlin/model/typeWrappers.kt0
-rw-r--r--core/src/main/kotlin/utilities/Path.kt5
4 files changed, 0 insertions, 58 deletions
diff --git a/core/src/main/kotlin/markdown/MarkdownProcessor.kt b/core/src/main/kotlin/markdown/MarkdownProcessor.kt
deleted file mode 100644
index 1304d58e..00000000
--- a/core/src/main/kotlin/markdown/MarkdownProcessor.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.jetbrains.dokka.markdown
-
-import org.intellij.markdown.IElementType
-import org.intellij.markdown.MarkdownElementTypes
-import org.intellij.markdown.ast.ASTNode
-import org.intellij.markdown.ast.LeafASTNode
-import org.intellij.markdown.ast.getTextInNode
-import org.intellij.markdown.flavours.commonmark.CommonMarkFlavourDescriptor
-import org.intellij.markdown.parser.MarkdownParser
-
-class MarkdownNode(val node: ASTNode, val parent: MarkdownNode?, val markdown: String) {
- val children: List<MarkdownNode> = node.children.map { MarkdownNode(it, this, markdown) }
- val type: IElementType get() = node.type
- val text: String get() = node.getTextInNode(markdown).toString()
- fun child(type: IElementType): MarkdownNode? = children.firstOrNull { it.type == type }
-
- val previous get() = parent?.children?.getOrNull(parent.children.indexOf(this) - 1)
-
- override fun toString(): String = StringBuilder().apply { presentTo(this) }.toString()
-}
-
-fun MarkdownNode.visit(action: (MarkdownNode, () -> Unit) -> Unit) {
- action(this) {
- for (child in children) {
- child.visit(action)
- }
- }
-}
-
-fun MarkdownNode.toTestString(): String {
- val sb = StringBuilder()
- var level = 0
- visit { node, visitChildren ->
- sb.append(" ".repeat(level * 2))
- node.presentTo(sb)
- sb.appendln()
- level++
- visitChildren()
- level--
- }
- return sb.toString()
-}
-
-private fun MarkdownNode.presentTo(sb: StringBuilder) {
- sb.append(type.toString())
- sb.append(":" + text.replace("w\n", "\u23CE"))
-}
-
-fun parseMarkdown(markdown: String): MarkdownNode {
- if (markdown.isEmpty())
- return MarkdownNode(LeafASTNode(MarkdownElementTypes.MARKDOWN_FILE, 0, 0), null, markdown)
- return MarkdownNode(MarkdownParser(CommonMarkFlavourDescriptor()).buildMarkdownTreeFromString(markdown), null, markdown)
-}
diff --git a/core/src/main/kotlin/model/aditionalExtras.kt b/core/src/main/kotlin/model/additionalExtras.kt
index 94d0e751..94d0e751 100644
--- a/core/src/main/kotlin/model/aditionalExtras.kt
+++ b/core/src/main/kotlin/model/additionalExtras.kt
diff --git a/core/src/main/kotlin/model/typeWrappers.kt b/core/src/main/kotlin/model/typeWrappers.kt
deleted file mode 100644
index e69de29b..00000000
--- a/core/src/main/kotlin/model/typeWrappers.kt
+++ /dev/null
diff --git a/core/src/main/kotlin/utilities/Path.kt b/core/src/main/kotlin/utilities/Path.kt
deleted file mode 100644
index 00e2aa60..00000000
--- a/core/src/main/kotlin/utilities/Path.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.jetbrains.dokka.utilities
-
-import java.io.File
-
-fun File.appendExtension(extension: String) = if (extension.isEmpty()) this else File(path + "." + extension)