aboutsummaryrefslogtreecommitdiff
path: root/src/Markdown
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-03-09 18:00:54 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-03-09 18:00:54 +0100
commit6f1a379aa2f494cb4e3e0d3a0dc6b5f8b625fa1a (patch)
treeee571aef240889b8bf8b7b4a374dbfe615d084c1 /src/Markdown
parent8f159151f182f4561594a4c23c22e82830bcc9b4 (diff)
downloaddokka-6f1a379aa2f494cb4e3e0d3a0dc6b5f8b625fa1a.tar.gz
dokka-6f1a379aa2f494cb4e3e0d3a0dc6b5f8b625fa1a.tar.bz2
dokka-6f1a379aa2f494cb4e3e0d3a0dc6b5f8b625fa1a.zip
remove unused Markdown to HTML conversion code
Diffstat (limited to 'src/Markdown')
-rw-r--r--src/Markdown/MarkdownProcessor.kt96
1 files changed, 0 insertions, 96 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()
-}
-