aboutsummaryrefslogtreecommitdiff
path: root/src/Java/JavaDocumentationBuilder.kt
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-02-27 17:42:52 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-02-27 17:42:52 +0100
commit7b91d7dd32e953674d66dbfb7ef6306258b1cfb7 (patch)
treeee5835ce521f9d103e1d50cc8bdc75747e0d001d /src/Java/JavaDocumentationBuilder.kt
parent63faa143fbc841d0e21a9903c51b3d9ab0216b92 (diff)
downloaddokka-7b91d7dd32e953674d66dbfb7ef6306258b1cfb7.tar.gz
dokka-7b91d7dd32e953674d66dbfb7ef6306258b1cfb7.tar.bz2
dokka-7b91d7dd32e953674d66dbfb7ef6306258b1cfb7.zip
don't lose space after first word in the content of javadoc tags
Diffstat (limited to 'src/Java/JavaDocumentationBuilder.kt')
-rw-r--r--src/Java/JavaDocumentationBuilder.kt18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Java/JavaDocumentationBuilder.kt b/src/Java/JavaDocumentationBuilder.kt
index 1a28de47..4b1b8116 100644
--- a/src/Java/JavaDocumentationBuilder.kt
+++ b/src/Java/JavaDocumentationBuilder.kt
@@ -1,10 +1,7 @@
package org.jetbrains.dokka
import com.intellij.psi.*
-import com.intellij.psi.javadoc.PsiDocComment
-import com.intellij.psi.javadoc.PsiDocTag
-import com.intellij.psi.javadoc.PsiDocTagValue
-import com.intellij.psi.javadoc.PsiInlineDocTag
+import com.intellij.psi.javadoc.*
import org.jetbrains.dokka.DocumentationNode.Kind
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
@@ -32,20 +29,27 @@ public class JavaDocumentationBuilder(private val options: DocumentationOptions,
"see" -> result.convertSeeTag(tag)
"deprecated" -> {
deprecatedContent = Content()
- deprecatedContent!!.convertJavadocElements(tag.getDataElements().toArrayList())
+ deprecatedContent!!.convertJavadocElements(tag.contentElements())
}
else -> {
val subjectName = tag.getSubjectName()
val section = result.addSection(javadocSectionDisplayName(tag.getName()), subjectName)
- section.convertJavadocElements(
- tag.getDataElements().filter { it !is PsiDocTagValue || tag.getSubjectName() == null })
+ section.convertJavadocElements(tag.contentElements())
}
}
}
return JavadocParseResult(result, deprecatedContent)
}
+ private fun PsiDocTag.contentElements(): Iterable<PsiElement> {
+ val tagValueElements = getChildren()
+ .dropWhile { it.getNode().getElementType() == JavaDocTokenType.DOC_TAG_NAME }
+ .dropWhile { it is PsiWhiteSpace }
+ .filterNot { it.getNode().getElementType() == JavaDocTokenType.DOC_COMMENT_LEADING_ASTERISKS }
+ return if (getSubjectName() != null) tagValueElements.dropWhile { it is PsiDocTagValue } else tagValueElements
+ }
+
private fun ContentBlock.convertJavadocElements(elements: Iterable<PsiElement>) {
val htmlBuilder = StringBuilder()
elements.forEach {