aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Markdown/MarkdownProcessor.kt96
-rw-r--r--test/src/markdown/ParserTest.kt3
-rw-r--r--test/src/markdown/Specification.kt3
3 files changed, 2 insertions, 100 deletions
diff --git a/src/Markdown/MarkdownProcessor.kt b/src/Markdown/MarkdownProcessor.kt
index a9b7003f..80c726c9 100644
--- a/src/Markdown/MarkdownProcessor.kt
+++ b/src/Markdown/MarkdownProcessor.kt
@@ -44,104 +44,8 @@ private fun MarkdownNode.presentTo(sb: StringBuilder) {
sb.appendln()
}
-public fun MarkdownNode.toHtml(): String {
- val sb = StringBuilder()
- visit {(node, processChildren) ->
- val nodeType = node.type
- val nodeText = node.text
- when (nodeType) {
- MarkdownElementTypes.UNORDERED_LIST -> {
- sb.appendln("<ul>")
- processChildren()
- sb.appendln("</ul>")
- }
- MarkdownElementTypes.ORDERED_LIST -> {
- sb.appendln("<ol>")
- processChildren()
- sb.appendln("</ol>")
- }
- MarkdownElementTypes.LIST_ITEM -> {
- sb.append("<li>")
- processChildren()
- sb.appendln("</li>")
- }
- MarkdownElementTypes.EMPH -> {
- sb.append("<em>")
- processChildren()
- sb.append("</em>")
- }
- MarkdownElementTypes.STRONG -> {
- sb.append("<strong>")
- processChildren()
- sb.append("</strong>")
- }
- MarkdownElementTypes.ATX_1 -> {
- sb.append("<h1>")
- processChildren()
- sb.append("</h1>")
- }
- MarkdownElementTypes.ATX_2 -> {
- sb.append("<h2>")
- processChildren()
- sb.append("</h2>")
- }
- MarkdownElementTypes.ATX_3 -> {
- sb.append("<h3>")
- processChildren()
- sb.append("</h3>")
- }
- MarkdownElementTypes.ATX_4 -> {
- sb.append("<h4>")
- processChildren()
- sb.append("</h4>")
- }
- MarkdownElementTypes.ATX_5 -> {
- sb.append("<h5>")
- processChildren()
- sb.append("</h5>")
- }
- MarkdownElementTypes.ATX_6 -> {
- sb.append("<h6>")
- processChildren()
- sb.append("</h6>")
- }
- MarkdownElementTypes.BLOCK_QUOTE -> {
- sb.append("<blockquote>")
- processChildren()
- sb.append("</blockquote>")
- }
- MarkdownElementTypes.PARAGRAPH -> {
- sb.append("<p>")
- processChildren()
- sb.appendln("</p>")
- }
- MarkdownTokenTypes.CODE -> {
- sb.append("<pre><code>")
- sb.append(nodeText)
- sb.append("</code><pre>")
- }
- MarkdownTokenTypes.TEXT -> {
- sb.append(nodeText)
- }
- else -> {
- processChildren()
- }
- }
- }
- return sb.toString()
-}
-
fun parseMarkdown(markdown: String): MarkdownNode {
if (markdown.isEmpty())
return MarkdownNode(LeafASTNode(MarkdownElementTypes.MARKDOWN_FILE, 0, 0), null, markdown)
return MarkdownNode(MarkdownParser(CommonMarkMarkerProcessor.Factory).buildMarkdownTreeFromString(markdown), null, markdown)
}
-
-fun markdownToHtml(markdown: String): String {
-
- val tree = MarkdownParser(CommonMarkMarkerProcessor.Factory).buildMarkdownTreeFromString(markdown)
- val markdownTree = MarkdownNode(tree, null, markdown)
- val ast = markdownTree.toTestString()
- return markdownTree.toHtml()
-}
-
diff --git a/test/src/markdown/ParserTest.kt b/test/src/markdown/ParserTest.kt
index 80ee7332..50c18f08 100644
--- a/test/src/markdown/ParserTest.kt
+++ b/test/src/markdown/ParserTest.kt
@@ -3,7 +3,6 @@ package org.jetbrains.dokka.tests
import org.junit.Test
import org.jetbrains.dokka
import org.jetbrains.dokka.toTestString
-import org.jetbrains.dokka.toHtml
import org.jetbrains.dokka.parseMarkdown
import org.junit.Ignore
@@ -14,8 +13,6 @@ Ignore public class ParserTest {
val markdownTree = parseMarkdown(text)
println("AST: ---")
println(markdownTree.toTestString())
- println("HTML: ---")
- println(markdownTree.toHtml())
println()
}
diff --git a/test/src/markdown/Specification.kt b/test/src/markdown/Specification.kt
index ba1f8363..429317c2 100644
--- a/test/src/markdown/Specification.kt
+++ b/test/src/markdown/Specification.kt
@@ -6,5 +6,6 @@ import org.jetbrains.dokka.*
//[RunWith(javaClass<MarkdownTestRunner>())]
class Specification : MarkdownSpecification("test/data/markdown/spec.txt", {
- markdownToHtml(it.replace("→", "\t"))
+// markdownToHtml(it.replace("→", "\t"))
+ ""
}) \ No newline at end of file