diff options
author | Szymon Świstun <sswistun@virtuslab.com> | 2019-12-16 15:27:53 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-01-08 10:45:08 +0100 |
commit | 58c65c0de698ef1d296f58ea64ea242e19892143 (patch) | |
tree | e57089a814d22767fb94b6ee731a4623a2925df0 | |
parent | 254e2a2dfae4f8d5eea26cdc4728b4fdb27cfee0 (diff) | |
download | dokka-58c65c0de698ef1d296f58ea64ea242e19892143.tar.gz dokka-58c65c0de698ef1d296f58ea64ea242e19892143.tar.bz2 dokka-58c65c0de698ef1d296f58ea64ea242e19892143.zip |
linksHandler temp fix
-rw-r--r-- | core/src/main/kotlin/parsers/MarkdownParser.kt | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/core/src/main/kotlin/parsers/MarkdownParser.kt b/core/src/main/kotlin/parsers/MarkdownParser.kt index b4ebdac7..735f90d5 100644 --- a/core/src/main/kotlin/parsers/MarkdownParser.kt +++ b/core/src/main/kotlin/parsers/MarkdownParser.kt @@ -80,20 +80,20 @@ class MarkdownParser ( private fun linksHandler(node: ASTNode): DocTag { val linkNode = node.children.find { it.type == MarkdownElementTypes.LINK_LABEL }!! - val link = text.substring(linkNode.startOffset+1, linkNode.endOffset-1) + val link = text.substring(linkNode.startOffset + 1, linkNode.endOffset - 1) val dri: DRI? = if (link.startsWith("http") || link.startsWith("www")) { null } else { - DRI.from( - resolveKDocLink( + resolveKDocLink( resolutionFacade.resolveSession.bindingContext, resolutionFacade, declarationDescriptor, null, link.split('.') - ).single() - ) + ).also { if (it.size > 1) println("Markdown link resolved more than one element: $it") }.firstOrNull()//.single() + ?.let { DRI.from(it) } + } val href = mapOf("href" to link) return when (node.type) { @@ -197,16 +197,16 @@ class MarkdownParser ( it.name!! ) KDocKnownTag.AUTHOR -> Author(parseStringToDocNode(it.getContent())) - KDocKnownTag.THROWS -> Throws(parseStringToDocNode(it.getContent()), it.getSubjectName()!!) - KDocKnownTag.EXCEPTION -> Throws(parseStringToDocNode(it.getContent()), it.getSubjectName()!!) - KDocKnownTag.PARAM -> Param(parseStringToDocNode(it.getContent()), it.getSubjectName()!!) + KDocKnownTag.THROWS -> Throws(parseStringToDocNode(it.getContent()), it.getSubjectName().orEmpty()) + KDocKnownTag.EXCEPTION -> Throws(parseStringToDocNode(it.getContent()), it.getSubjectName().orEmpty()) + KDocKnownTag.PARAM -> Param(parseStringToDocNode(it.getContent()), it.getSubjectName().orEmpty()) KDocKnownTag.RECEIVER -> Receiver(parseStringToDocNode(it.getContent())) KDocKnownTag.RETURN -> Return(parseStringToDocNode(it.getContent())) - KDocKnownTag.SEE -> See(parseStringToDocNode(it.getContent()), it.getSubjectName()!!) + KDocKnownTag.SEE -> See(parseStringToDocNode(it.getContent()), it.getSubjectName().orEmpty()) KDocKnownTag.SINCE -> Since(parseStringToDocNode(it.getContent())) KDocKnownTag.CONSTRUCTOR -> Constructor(parseStringToDocNode(it.getContent())) - KDocKnownTag.PROPERTY -> Property(parseStringToDocNode(it.getContent()), it.getSubjectName()!!) - KDocKnownTag.SAMPLE -> Sample(parseStringToDocNode(it.getContent()), it.getSubjectName()!!) + KDocKnownTag.PROPERTY -> Property(parseStringToDocNode(it.getContent()), it.getSubjectName().orEmpty()) + KDocKnownTag.SAMPLE -> Sample(parseStringToDocNode(it.getContent()), it.getSubjectName().orEmpty()) KDocKnownTag.SUPPRESS -> Suppress(parseStringToDocNode(it.getContent())) } } @@ -214,6 +214,4 @@ class MarkdownParser ( } - - }
\ No newline at end of file |