aboutsummaryrefslogtreecommitdiff
path: root/plugins/javadoc/src/main
diff options
context:
space:
mode:
authorMarcin Aman <maman@virtuslab.com>2020-08-20 19:00:04 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-08-25 17:49:30 +0200
commitc9af371aa18dc50490dc3927ed88dfe8836c1bde (patch)
tree6b974aa9be26d9e3544327d17722d8f26e14cd4d /plugins/javadoc/src/main
parent7196323582dce7ca3f9b07262a1f94ecd8514539 (diff)
downloaddokka-c9af371aa18dc50490dc3927ed88dfe8836c1bde.tar.gz
dokka-c9af371aa18dc50490dc3927ed88dfe8836c1bde.tar.bz2
dokka-c9af371aa18dc50490dc3927ed88dfe8836c1bde.zip
Improve styles and functionality on module page #1336
Diffstat (limited to 'plugins/javadoc/src/main')
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt21
1 files changed, 1 insertions, 20 deletions
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt
index a8e10db5..05de8fa1 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt
@@ -6,6 +6,7 @@ import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.base.signatures.SignatureProvider
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
import org.jetbrains.dokka.base.transformers.pages.comments.DocTagToContentConverter
+import org.jetbrains.dokka.base.translators.documentables.briefFromContentNodes
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.doc.Description
import org.jetbrains.dokka.model.doc.Index
@@ -171,8 +172,6 @@ open class JavadocPageCreator(
sources.firstOrNull { it != expectPresentInSet } ?: sources.firstOrNull()
}
- private val firstSentenceRegex = Regex("^((?:[^.?!]|[.!?](?!\\s))*[.!?])")
-
private inline fun <reified T : TagWrapper> Documentable.findNodeInDocumentation(sourceSetData: DokkaSourceSet?): T? =
documentation[sourceSetData]?.firstChildOfTypeOrNull<T>()
@@ -197,24 +196,6 @@ open class JavadocPageCreator(
private fun Documentable.brief(sourceSet: DokkaSourceSet? = highestJvmSourceSet): List<ContentNode> =
briefFromContentNodes(descriptionToContentNodes(sourceSet))
- private fun briefFromContentNodes(description: List<ContentNode>): List<ContentNode> {
- var sentenceFound = false
- fun lookthrough(node: ContentNode): ContentNode =
- if (node is ContentText && firstSentenceRegex.containsMatchIn(node.text)) {
- sentenceFound = true
- node.copy(text = firstSentenceRegex.find(node.text)?.value.orEmpty())
- } else if (node is ContentGroup) {
- node.copy(children = node.children.mapNotNull {
- if (!sentenceFound) lookthrough(it) else null
- }, style = node.style - TextStyle.Paragraph)
- } else {
- node
- }
- return description.mapNotNull {
- if (!sentenceFound) lookthrough(it) else null
- }
- }
-
private fun DParameter.brief(sourceSet: DokkaSourceSet? = highestJvmSourceSet): List<ContentNode> =
briefFromContentNodes(paramsToContentNodes(sourceSet).dropWhile { it is ContentDRILink })