diff options
Diffstat (limited to 'src/Model')
-rw-r--r-- | src/Model/DocumentationContent.kt | 5 | ||||
-rw-r--r-- | src/Model/DocumentationNode.kt | 2 |
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> |