aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main
diff options
context:
space:
mode:
authormkondratek <mkondratek@virtuslab.com>2020-09-29 15:51:14 +0200
committerAndrzej Ratajczak <32793002+BarkingBad@users.noreply.github.com>2020-09-29 16:04:51 +0200
commit3c0d8177cb4675a3942ae75eac7b5a4f5eb50d25 (patch)
treedccbaeeb503dc9c4a0a445bab4c7795758358b99 /plugins/base/src/main
parent5a214c157e29145b8828b69060ba5111c7f1e166 (diff)
downloaddokka-3c0d8177cb4675a3942ae75eac7b5a4f5eb50d25.tar.gz
dokka-3c0d8177cb4675a3942ae75eac7b5a4f5eb50d25.tar.bz2
dokka-3c0d8177cb4675a3942ae75eac7b5a4f5eb50d25.zip
Add MD parser - 1st round of fixes
Diffstat (limited to 'plugins/base/src/main')
-rw-r--r--plugins/base/src/main/kotlin/parsers/MarkdownParser.kt13
-rw-r--r--plugins/base/src/main/kotlin/parsers/Parser.kt2
2 files changed, 5 insertions, 10 deletions
diff --git a/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt b/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt
index dfb9f8e7..23e59f8b 100644
--- a/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt
+++ b/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt
@@ -25,10 +25,12 @@ open class MarkdownParser(
private val externalDri: (String) -> DRI?
) : Parser() {
+ private lateinit var destinationLinksMap: Map<String, String>
+ private lateinit var text: String
+
override fun parseStringToDocNode(extractedString: String): DocTag {
val gfmFlavourDescriptor = GFMFlavourDescriptor()
- val markdownAstRoot: ASTNode =
- IntellijMarkdownParser(gfmFlavourDescriptor).buildMarkdownTreeFromString(extractedString)
+ val markdownAstRoot = IntellijMarkdownParser(gfmFlavourDescriptor).buildMarkdownTreeFromString(extractedString)
destinationLinksMap = getAllDestinationLinks(extractedString, markdownAstRoot).toMap()
text = extractedString
return visitNode(markdownAstRoot)
@@ -36,13 +38,6 @@ open class MarkdownParser(
override fun preparse(text: String) = text
- private lateinit var destinationLinksMap: Map<String, String>
- private lateinit var text: String
-
- override fun parse(text: String): DocumentationNode {
- return DocumentationNode(listOf(Description(parseStringToDocNode(text))))
- }
-
private fun headersHandler(node: ASTNode) =
DocTagsFromIElementFactory.getInstance(
node.type,
diff --git a/plugins/base/src/main/kotlin/parsers/Parser.kt b/plugins/base/src/main/kotlin/parsers/Parser.kt
index 11b2fdcf..894fa82f 100644
--- a/plugins/base/src/main/kotlin/parsers/Parser.kt
+++ b/plugins/base/src/main/kotlin/parsers/Parser.kt
@@ -8,7 +8,7 @@ abstract class Parser {
abstract fun preparse(text: String): String
- open fun parse(text: String): DocumentationNode {
+ fun parse(text: String): DocumentationNode {
val list = jkdocToListOfPairs(preparse(text))