aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin
diff options
context:
space:
mode:
authorKamil Doległo <9080183+kamildoleglo@users.noreply.github.com>2021-05-17 20:45:00 +0200
committerGitHub <noreply@github.com>2021-05-17 20:45:00 +0200
commitd89be4ba91b8c5cb5e9e34063873004992ee884f (patch)
tree6b4a1ece6ae5f1d0d0675fb7a08801182d89f50e /plugins/base/src/main/kotlin
parentc94c4baedb6571f27c8a99a419f9bb4c26c4885a (diff)
downloaddokka-d89be4ba91b8c5cb5e9e34063873004992ee884f.tar.gz
dokka-d89be4ba91b8c5cb5e9e34063873004992ee884f.tar.bz2
dokka-d89be4ba91b8c5cb5e9e34063873004992ee884f.zip
Fix preserving spaces in Javadoc comments (#1923)
Fixes #1895
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt2
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt6
2 files changed, 4 insertions, 4 deletions
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index cd2bbfc6..f728c8a7 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -264,7 +264,7 @@ class DefaultPsiToDocumentableTranslator(
name.orEmpty(),
fields.filterIsInstance<PsiEnumConstant>().map { entry ->
DEnumEntry(
- dri.withClass("${entry.name}"),
+ dri.withClass(entry.name),
entry.name,
javadocParser.parseDocumentation(entry).toSourceSetDependent(),
null,
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 a02bceac..dc93568f 100644
--- a/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt
@@ -213,9 +213,9 @@ class JavadocParser(
javadoc doesn't care about it.
*/
text.let {
- if ((prevSibling as? PsiDocToken)?.isLeadingAsterisk() == true && text != " " && state.previousElement !is PsiInlineDocTag) it?.trimStart() else it
+ if ((prevSibling as? PsiDocToken)?.isLeadingAsterisk() == true && text.isNotBlank() && state.previousElement !is PsiInlineDocTag) it?.trimStart() else it
}?.let {
- if ((nextSibling as? PsiDocToken)?.isLeadingAsterisk() == true && text != " ") it.trimEnd() else it
+ if ((nextSibling as? PsiDocToken)?.isLeadingAsterisk() == true && text.isNotBlank()) it.trimEnd() else it
}?.let {
if (shouldHaveSpaceAtTheEnd()) "$it " else it
}
@@ -253,7 +253,7 @@ class JavadocParser(
val lastHtmlTag = text.trim().substringAfterLast("<")
val endsWithAnUnclosedTag = lastHtmlTag.endsWith(">") && !lastHtmlTag.startsWith("</")
- return (nextSibling as? PsiWhiteSpace)?.text == "\n " &&
+ return (nextSibling as? PsiWhiteSpace)?.text?.startsWith("\n ") == true &&
(getNextSiblingIgnoringWhitespace() as? PsiDocToken)?.tokenType != JavaDocTokenTypes.INSTANCE.commentEnd() &&
nextNotEmptySibling?.isLeadingAsterisk() == true &&
furtherNotEmptySibling?.tokenType == JavaDocTokenTypes.INSTANCE.commentData() &&