diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-03-09 18:00:54 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-03-09 18:00:54 +0100 |
commit | 6f1a379aa2f494cb4e3e0d3a0dc6b5f8b625fa1a (patch) | |
tree | ee571aef240889b8bf8b7b4a374dbfe615d084c1 | |
parent | 8f159151f182f4561594a4c23c22e82830bcc9b4 (diff) | |
download | dokka-6f1a379aa2f494cb4e3e0d3a0dc6b5f8b625fa1a.tar.gz dokka-6f1a379aa2f494cb4e3e0d3a0dc6b5f8b625fa1a.tar.bz2 dokka-6f1a379aa2f494cb4e3e0d3a0dc6b5f8b625fa1a.zip |
remove unused Markdown to HTML conversion code
-rw-r--r-- | src/Markdown/MarkdownProcessor.kt | 96 | ||||
-rw-r--r-- | test/src/markdown/ParserTest.kt | 3 | ||||
-rw-r--r-- | test/src/markdown/Specification.kt | 3 |
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 |