From 2b921897aa90216d78e05165d5ce122814ead74c Mon Sep 17 00:00:00 2001 From: Filip ZybaƂa Date: Wed, 1 Apr 2020 17:20:44 +0200 Subject: Changed see also parsing, added see also section to pages --- core/src/main/kotlin/model/doc/TagWrapper.kt | 4 +++- core/src/main/kotlin/parsers/MarkdownParser.kt | 10 +++++++++- core/src/main/kotlin/parsers/Parser.kt | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/src/main/kotlin/model/doc/TagWrapper.kt b/core/src/main/kotlin/model/doc/TagWrapper.kt index 9dda7c8f..6652f5a1 100644 --- a/core/src/main/kotlin/model/doc/TagWrapper.kt +++ b/core/src/main/kotlin/model/doc/TagWrapper.kt @@ -1,5 +1,7 @@ package org.jetbrains.dokka.model.doc +import org.jetbrains.dokka.links.DRI + sealed class TagWrapper(val root: DocTag) { override fun equals(other: Any?): Boolean = @@ -20,7 +22,7 @@ class Description(root: DocTag) : TagWrapper(root) class Author(root: DocTag) : TagWrapper(root) class Version(root: DocTag) : TagWrapper(root) class Since(root: DocTag) : TagWrapper(root) -class See(root: DocTag, name: String) : NamedTagWrapper(root, name) +class See(root: DocTag, name: String, val address: DRI?) : NamedTagWrapper(root, name) class Param(root: DocTag, name: String) : NamedTagWrapper(root, name) class Return(root: DocTag) : TagWrapper(root) class Receiver(root: DocTag) : TagWrapper(root) diff --git a/core/src/main/kotlin/parsers/MarkdownParser.kt b/core/src/main/kotlin/parsers/MarkdownParser.kt index 617d351b..782a6504 100644 --- a/core/src/main/kotlin/parsers/MarkdownParser.kt +++ b/core/src/main/kotlin/parsers/MarkdownParser.kt @@ -361,7 +361,15 @@ class MarkdownParser( ) KDocKnownTag.RECEIVER -> Receiver(parseStringToDocNode(it.getContent())) KDocKnownTag.RETURN -> Return(parseStringToDocNode(it.getContent())) - KDocKnownTag.SEE -> See(parseStringToDocNode(it.getContent()), it.getSubjectName().orEmpty()) + KDocKnownTag.SEE -> See( + parseStringToDocNode(it.getContent()), + it.getSubjectName().orEmpty(), + parseStringToDocNode("[${it.getSubjectName()}]") + .let { + if(it is DocumentationLink) it.dri + else null + } + ) KDocKnownTag.SINCE -> Since(parseStringToDocNode(it.getContent())) KDocKnownTag.CONSTRUCTOR -> Constructor(parseStringToDocNode(it.getContent())) KDocKnownTag.PROPERTY -> Property( diff --git a/core/src/main/kotlin/parsers/Parser.kt b/core/src/main/kotlin/parsers/Parser.kt index f03e57be..11dcafb0 100644 --- a/core/src/main/kotlin/parsers/Parser.kt +++ b/core/src/main/kotlin/parsers/Parser.kt @@ -17,7 +17,7 @@ abstract class Parser { "author" -> Author(parseStringToDocNode(it.second)) "version" -> Version(parseStringToDocNode(it.second)) "since" -> Since(parseStringToDocNode(it.second)) - "see" -> See(parseStringToDocNode(it.second.substringAfter(' ')), it.second.substringBefore(' ')) + "see" -> See(parseStringToDocNode(it.second.substringAfter(' ')), it.second.substringBefore(' '), null) "param" -> Param(parseStringToDocNode(it.second.substringAfter(' ')), it.second.substringBefore(' ')) "property" -> Property(parseStringToDocNode(it.second.substringAfter(' ')), it.second.substringBefore(' ')) "return" -> Return(parseStringToDocNode(it.second)) -- cgit