From 3f45f3ac53bad19de9ca0a07d9cf8c7f6f003871 Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Fri, 19 Sep 2014 22:35:10 +0300 Subject: Review and fixes. --- src/Model/DocumentationContent.kt | 5 +++++ src/Model/DocumentationNode.kt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Model') 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) { @@ -54,6 +55,10 @@ fun BindingContext.getDocumentation(descriptor: DeclarationDescriptor): Document } fun List.extractSummaryAndDescription() : Pair { + // 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() 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 get() = references(DocumentationReference.Kind.Detail).map { it.to } public val members: List -- cgit