aboutsummaryrefslogtreecommitdiff
path: root/src/Model
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-02-26 19:08:59 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-02-26 19:08:59 +0100
commit146764aca661d51daa298c7cfe6b9b5efcff7e5f (patch)
tree8379c830a61ffa9a879e29405c83847b552aa028 /src/Model
parent1e74c644b1163948c389dd9082e0cba60ab5ed65 (diff)
downloaddokka-146764aca661d51daa298c7cfe6b9b5efcff7e5f.tar.gz
dokka-146764aca661d51daa298c7cfe6b9b5efcff7e5f.tar.bz2
dokka-146764aca661d51daa298c7cfe6b9b5efcff7e5f.zip
stop generating separate pages for property accessors
Diffstat (limited to 'src/Model')
-rw-r--r--src/Model/Content.kt28
-rw-r--r--src/Model/DocumentationNode.kt12
2 files changed, 28 insertions, 12 deletions
diff --git a/src/Model/Content.kt b/src/Model/Content.kt
index 8e9c068d..66267496 100644
--- a/src/Model/Content.kt
+++ b/src/Model/Content.kt
@@ -98,9 +98,22 @@ fun ContentBlock.link(to: DocumentationNode, body: ContentBlock.() -> Unit) {
append(block)
}
-public class Content() : ContentBlock() {
+public open class Content(): ContentBlock() {
+ public open val sections: List<ContentSection> get() = emptyList()
+ public open val summary: ContentNode get() = ContentEmpty
+ public open val description: ContentNode get() = ContentEmpty
+
+ fun findSectionByTag(tag: String): ContentSection? =
+ sections.firstOrNull { tag.equalsIgnoreCase(it.tag) }
+
+ class object {
+ val Empty = Content()
+ }
+}
+
+public open class MutableContent() : Content() {
private val sectionList = arrayListOf<ContentSection>()
- public val sections: List<ContentSection>
+ public override val sections: List<ContentSection>
get() = sectionList
fun addSection(tag: String?, subjectName: String?): ContentSection {
@@ -109,12 +122,9 @@ public class Content() : ContentBlock() {
return section
}
- fun findSectionByTag(tag: String): ContentSection? =
- sections.firstOrNull { tag.equalsIgnoreCase(it.tag) }
-
- public val summary: ContentNode get() = children.firstOrNull() ?: ContentEmpty
+ public override val summary: ContentNode get() = children.firstOrNull() ?: ContentEmpty
- public val description: ContentNode by Delegates.lazy {
+ public override val description: ContentNode by Delegates.lazy {
val descriptionNodes = children.drop(1)
if (descriptionNodes.isEmpty()) {
ContentEmpty
@@ -143,10 +153,6 @@ public class Content() : ContentBlock() {
val isEmpty: Boolean
get() = sections.none()
-
- class object {
- val Empty = Content()
- }
}
fun javadocSectionDisplayName(sectionName: String?): String? =
diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt
index f0c3ddf5..8fec29c4 100644
--- a/src/Model/DocumentationNode.kt
+++ b/src/Model/DocumentationNode.kt
@@ -3,11 +3,14 @@ package org.jetbrains.dokka
import java.util.LinkedHashSet
public open class DocumentationNode(val name: String,
- val content: Content,
+ content: Content,
val kind: DocumentationNode.Kind) {
private val references = LinkedHashSet<DocumentationReference>()
+ var content: Content = content
+ private set
+
public val summary: ContentNode get() = content.summary
public val owner: DocumentationNode?
@@ -38,6 +41,13 @@ public open class DocumentationNode(val name: String,
references.addAll(other.references)
}
+ public fun updateContent(body: MutableContent.() -> Unit) {
+ if (content !is MutableContent) {
+ content = MutableContent()
+ }
+ (content as MutableContent).body()
+ }
+
public fun details(kind: DocumentationNode.Kind): List<DocumentationNode> = details.filter { it.kind == kind }
public fun members(kind: DocumentationNode.Kind): List<DocumentationNode> = members.filter { it.kind == kind }
public fun links(kind: DocumentationNode.Kind): List<DocumentationNode> = links.filter { it.kind == kind }