From 280dc29f14d0aa66f4c799d15d478a6d9920841e Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Tue, 14 Oct 2014 16:08:10 +0400 Subject: Use module.md to get package descriptors, filter sections with names of members, fix markdown for kotlin website, propagate content from parent to child with the name of section. --- src/Model/Content.kt | 4 +++- src/Model/DocumentationModule.kt | 2 +- src/Model/DocumentationNode.kt | 12 +++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src/Model') 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() + 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 -- cgit