aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/Kotlin/KotlinLanguageService.kt20
-rw-r--r--core/src/main/kotlin/Languages/CommonLanguageService.kt18
-rw-r--r--core/src/main/kotlin/Languages/NewJavaLanguageService.kt9
3 files changed, 29 insertions, 18 deletions
diff --git a/core/src/main/kotlin/Kotlin/KotlinLanguageService.kt b/core/src/main/kotlin/Kotlin/KotlinLanguageService.kt
index b6474583..237fa9b9 100644
--- a/core/src/main/kotlin/Kotlin/KotlinLanguageService.kt
+++ b/core/src/main/kotlin/Kotlin/KotlinLanguageService.kt
@@ -7,6 +7,10 @@ import org.jetbrains.dokka.LanguageService.RenderMode
* Implements [LanguageService] and provides rendering of symbols in Kotlin language
*/
class KotlinLanguageService : CommonLanguageService() {
+ override fun showModifierInSummary(node: DocumentationNode): Boolean {
+ return node.name !in fullOnlyModifiers
+ }
+
private val fullOnlyModifiers =
setOf("public", "protected", "private", "inline", "noinline", "crossinline", "reified")
@@ -283,22 +287,6 @@ class KotlinLanguageService : CommonLanguageService() {
}
}
- private fun ContentBlock.renderModifiersForNode(
- node: DocumentationNode,
- renderMode: RenderMode,
- nowrap: Boolean = false
- ) {
- val modifiers = node.details(NodeKind.Modifier)
- for (it in modifiers) {
- if (node.kind == org.jetbrains.dokka.NodeKind.Interface && it.name == "abstract")
- continue
- if (renderMode == RenderMode.SUMMARY && it.name in fullOnlyModifiers) {
- continue
- }
- renderModifier(this, it, renderMode, nowrap)
- }
- }
-
private fun ContentBlock.renderAnnotationsForNode(node: DocumentationNode) {
node.annotations.forEach {
renderAnnotation(it)
diff --git a/core/src/main/kotlin/Languages/CommonLanguageService.kt b/core/src/main/kotlin/Languages/CommonLanguageService.kt
index edefa1b5..ddc95d32 100644
--- a/core/src/main/kotlin/Languages/CommonLanguageService.kt
+++ b/core/src/main/kotlin/Languages/CommonLanguageService.kt
@@ -62,5 +62,23 @@ abstract class CommonLanguageService : LanguageService {
}
}
+ abstract fun showModifierInSummary(node: DocumentationNode): Boolean
+
+ protected fun ContentBlock.renderModifiersForNode(
+ node: DocumentationNode,
+ renderMode: LanguageService.RenderMode,
+ nowrap: Boolean = false
+ ) {
+ val modifiers = node.details(NodeKind.Modifier)
+ for (it in modifiers) {
+ if (node.kind == NodeKind.Interface && it.name == "abstract")
+ continue
+ if (renderMode == LanguageService.RenderMode.SUMMARY && !showModifierInSummary(it)) {
+ continue
+ }
+ renderModifier(this, it, renderMode, nowrap)
+ }
+ }
+
} \ No newline at end of file
diff --git a/core/src/main/kotlin/Languages/NewJavaLanguageService.kt b/core/src/main/kotlin/Languages/NewJavaLanguageService.kt
index 0266c033..fa9f70fd 100644
--- a/core/src/main/kotlin/Languages/NewJavaLanguageService.kt
+++ b/core/src/main/kotlin/Languages/NewJavaLanguageService.kt
@@ -6,11 +6,15 @@ import org.jetbrains.dokka.LanguageService.RenderMode
* Implements [LanguageService] and provides rendering of symbols in Java language
*/
class NewJavaLanguageService : CommonLanguageService() {
+ override fun showModifierInSummary(node: DocumentationNode): Boolean {
+ return true
+ }
+
override fun render(node: DocumentationNode, renderMode: RenderMode): ContentNode {
return content {
(when (node.kind) {
NodeKind.Package -> renderPackage(node)
- in NodeKind.classLike -> renderClass(node)
+ in NodeKind.classLike -> renderClass(node, renderMode)
NodeKind.Modifier -> renderModifier(this, node, renderMode)
NodeKind.TypeParameter -> renderTypeParameter(node)
@@ -131,7 +135,8 @@ class NewJavaLanguageService : CommonLanguageService() {
text(" ")
}
- private fun ContentBlock.renderClass(node: DocumentationNode) {
+ private fun ContentBlock.renderClass(node: DocumentationNode, renderMode: RenderMode) {
+ renderModifiersForNode(node, renderMode)
renderClassKind(node)
identifier(node.name)