aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/translators
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main/kotlin/translators')
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/parsers/InheritDocResolver.kt4
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt17
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/parsers/JavadocTag.kt2
3 files changed, 16 insertions, 7 deletions
diff --git a/plugins/base/src/main/kotlin/translators/psi/parsers/InheritDocResolver.kt b/plugins/base/src/main/kotlin/translators/psi/parsers/InheritDocResolver.kt
index c2fb6fb4..21c2c72a 100644
--- a/plugins/base/src/main/kotlin/translators/psi/parsers/InheritDocResolver.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/parsers/InheritDocResolver.kt
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
internal data class CommentResolutionContext(
val comment: PsiDocComment,
- val tag: JavadocTag,
+ val tag: JavadocTag?,
val name: String? = null,
val parameterIndex: Int? = null,
)
@@ -25,7 +25,7 @@ internal class InheritDocResolver(
JavadocTag.PARAM -> context.parameterIndex?.let { paramIndex -> resolveParamTag(context.comment, paramIndex) }
JavadocTag.DEPRECATED -> resolveGenericTag(context.comment, JavadocTag.DESCRIPTION)
JavadocTag.SEE -> emptyList()
- else -> resolveGenericTag(context.comment, context.tag)
+ else -> context.tag?.let { tag -> resolveGenericTag(context.comment, tag) }
}
private fun resolveGenericTag(currentElement: PsiDocComment, tag: JavadocTag): List<PsiElement> =
diff --git a/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt b/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt
index 96c62b36..a02bceac 100644
--- a/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt
@@ -12,6 +12,7 @@ import org.jetbrains.dokka.analysis.from
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.model.doc.Deprecated
+import org.jetbrains.dokka.model.doc.Suppress
import org.jetbrains.dokka.utilities.DokkaLogger
import org.jetbrains.dokka.utilities.enumValueOrNull
import org.jetbrains.kotlin.idea.refactoring.fqName.getKotlinFqName
@@ -118,7 +119,15 @@ class JavadocParser(
else -> null
//TODO https://github.com/Kotlin/dokka/issues/1618
}
- }
+ } ?: CustomTagWrapper(
+ wrapTagIfNecessary(
+ convertJavadocElements(
+ tag.contentElementsWithSiblingIfNeeded(),
+ context = CommentResolutionContext(docComment, null)
+ )
+ ),
+ tag.name
+ )
private fun wrapTagIfNecessary(list: List<DocTag>): CustomDocTag =
if (list.size == 1 && (list.first() as? CustomDocTag)?.name == MarkdownElementTypes.MARKDOWN_FILE.name)
@@ -148,14 +157,14 @@ class JavadocParser(
}
private data class ParserState(
- val currentJavadocTag: JavadocTag,
+ val currentJavadocTag: JavadocTag?,
val previousElement: PsiElement? = null,
val openPreTags: Int = 0,
val closedPreTags: Int = 0
)
private data class ParsingResult(val newState: ParserState, val parsedLine: String? = null) {
- constructor(tag: JavadocTag) : this(ParserState(tag))
+ constructor(tag: JavadocTag?) : this(ParserState(tag))
operator fun plus(other: ParsingResult): ParsingResult =
ParsingResult(
@@ -267,7 +276,7 @@ class JavadocParser(
private fun convertInlineDocTag(
tag: PsiInlineDocTag,
- javadocTag: JavadocTag,
+ javadocTag: JavadocTag?,
context: CommentResolutionContext
) =
when (tag.name) {
diff --git a/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocTag.kt b/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocTag.kt
index 8ea39453..869ced30 100644
--- a/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocTag.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocTag.kt
@@ -1,7 +1,7 @@
package org.jetbrains.dokka.base.translators.psi.parsers
internal enum class JavadocTag {
- PARAM, THROWS, RETURN, AUTHOR, SEE, DEPRECATED, EXCEPTION,
+ PARAM, THROWS, RETURN, AUTHOR, SEE, DEPRECATED, EXCEPTION, HIDE,
/**
* Artificial tag created to handle tag-less section