aboutsummaryrefslogtreecommitdiff
path: root/src/Model
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-09-19 22:35:10 +0300
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-09-19 22:35:10 +0300
commit3f45f3ac53bad19de9ca0a07d9cf8c7f6f003871 (patch)
treea1a5210da09fd0839755fa43005a9eac3640b772 /src/Model
parent54dee60b9cde7fc1fd808b19bc922e235fd90c04 (diff)
downloaddokka-3f45f3ac53bad19de9ca0a07d9cf8c7f6f003871.tar.gz
dokka-3f45f3ac53bad19de9ca0a07d9cf8c7f6f003871.tar.bz2
dokka-3f45f3ac53bad19de9ca0a07d9cf8c7f6f003871.zip
Review and fixes.
Diffstat (limited to 'src/Model')
-rw-r--r--src/Model/DocumentationContent.kt5
-rw-r--r--src/Model/DocumentationNode.kt2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/Model/DocumentationContent.kt b/src/Model/DocumentationContent.kt
index e8f32a33..cebb429b 100644
--- a/src/Model/DocumentationContent.kt
+++ b/src/Model/DocumentationContent.kt
@@ -9,6 +9,7 @@ public class DocumentationContentSection(public val label: String, public val te
}
}
+// TODO: refactor sections to map
public class DocumentationContent(public val summary: RichString,
public val description: RichString,
public val sections: List<DocumentationContentSection>) {
@@ -54,6 +55,10 @@ fun BindingContext.getDocumentation(descriptor: DeclarationDescriptor): Document
}
fun List<DocumentationContentSection>.extractSummaryAndDescription() : Pair<RichString, RichString> {
+ // TODO: rework to unify
+ // if no $summary and $description is present, parse unnamed section and create specific sections
+ // otherwise, create empty sections for missing
+
val summary = firstOrNull { it.label == "\$summary" }
if (summary != null) {
val description = firstOrNull { it.label == "\$description" }
diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt
index 5469774d..c96c383d 100644
--- a/src/Model/DocumentationNode.kt
+++ b/src/Model/DocumentationNode.kt
@@ -12,7 +12,7 @@ public open class DocumentationNode(val descriptor: DeclarationDescriptor,
private val references = LinkedHashSet<DocumentationReference>()
public val owner: DocumentationNode?
- get() = references(DocumentationReference.Kind.Owner).firstOrNull()?.to // TODO: should be singleOrNull, but bugz!
+ get() = references(DocumentationReference.Kind.Owner).singleOrNull()?.to
public val details: List<DocumentationNode>
get() = references(DocumentationReference.Kind.Detail).map { it.to }
public val members: List<DocumentationNode>