aboutsummaryrefslogtreecommitdiff
path: root/src/Model
diff options
context:
space:
mode:
Diffstat (limited to 'src/Model')
-rw-r--r--src/Model/Content.kt4
-rw-r--r--src/Model/DocumentationModule.kt2
-rw-r--r--src/Model/DocumentationNode.kt12
3 files changed, 15 insertions, 3 deletions
diff --git a/src/Model/Content.kt b/src/Model/Content.kt
index 3ec3d341..794faf50 100644
--- a/src/Model/Content.kt
+++ b/src/Model/Content.kt
@@ -84,7 +84,9 @@ public class Content() : ContentNode() {
map
}
- public val summary: ContentNode get() = sections["\$summary"] ?: ContentNode.empty
+ public val summary: ContentNode get() {
+ return sections["\$summary"] ?: ContentNode.empty
+ }
public val description: ContentNode get() = sections["\$description"] ?: ContentNode.empty
override fun equals(other: Any?): Boolean {
diff --git a/src/Model/DocumentationModule.kt b/src/Model/DocumentationModule.kt
index 6084ea5e..e74c544b 100644
--- a/src/Model/DocumentationModule.kt
+++ b/src/Model/DocumentationModule.kt
@@ -1,6 +1,6 @@
package org.jetbrains.dokka
-public class DocumentationModule(name: String) : DocumentationNode(name, Content.Empty, DocumentationNode.Kind.Module) {
+public class DocumentationModule(name: String, content: Content = Content.Empty) : DocumentationNode(name, content, DocumentationNode.Kind.Module) {
fun merge(other: DocumentationModule): DocumentationModule {
val model = DocumentationModule(name)
model.addAllReferencesFrom(other)
diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt
index 18efaa9b..2be5bf15 100644
--- a/src/Model/DocumentationNode.kt
+++ b/src/Model/DocumentationNode.kt
@@ -3,11 +3,21 @@ package org.jetbrains.dokka
import java.util.LinkedHashSet
public open class DocumentationNode(val name: String,
- val doc: Content,
+ val content: Content,
val kind: DocumentationNode.Kind) {
private val references = LinkedHashSet<DocumentationReference>()
+ public val summary: ContentNode get() {
+ val contentSection = content.sections["\$summary"]
+ if (contentSection != null)
+ return contentSection
+ val ownerSection = owner?.content?.sections?.get(name)
+ if (ownerSection != null)
+ return ownerSection
+ return ContentNode.empty
+ }
+
public val owner: DocumentationNode?
get() = references(DocumentationReference.Kind.Owner).singleOrNull()?.to
public val details: List<DocumentationNode>