aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-07-14 18:37:55 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-07-14 18:37:55 +0400
commit43d969f01a4566d53e95bccd589e233100282ccd (patch)
tree9de07091303fbb83b13db475feaa91e1176e8a8f
parentb76a7451e2c9fe1cf075ccfbe32d2731664f4767 (diff)
downloaddokka-43d969f01a4566d53e95bccd589e233100282ccd.tar.gz
dokka-43d969f01a4566d53e95bccd589e233100282ccd.tar.bz2
dokka-43d969f01a4566d53e95bccd589e233100282ccd.zip
Decompose summary and description for one-liners
-rw-r--r--src/Model/DocumentationContent.kt9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Model/DocumentationContent.kt b/src/Model/DocumentationContent.kt
index d3826434..ed81b9e9 100644
--- a/src/Model/DocumentationContent.kt
+++ b/src/Model/DocumentationContent.kt
@@ -9,7 +9,7 @@ class DocumentationContentSection(val label: String, val text: String) {
}
}
-class DocumentationContent(val summary: String, val sections: List<DocumentationContentSection>) {
+class DocumentationContent(val summary: String, val description: String, val sections: List<DocumentationContentSection>) {
override fun equals(other: Any?): Boolean {
if (other !is DocumentationContent)
@@ -36,17 +36,16 @@ class DocumentationContent(val summary: String, val sections: List<Documentation
}
class object {
- val Empty = DocumentationContent("", listOf())
+ val Empty = DocumentationContent("", "", listOf())
}
}
fun BindingContext.getDocumentation(descriptor: DeclarationDescriptor): DocumentationContent {
val docText = getDocumentationElements(descriptor).map { it.extractText() }.join("\n")
-
val sections = docText.parseSections()
-
- return DocumentationContent(sections.first().text, sections.drop(1))
+ val content = sections.first().text
+ return DocumentationContent(content.substringBefore('\n'), content.substringAfter('\n'), sections.drop(1))
}
fun String.parseLabel(index: Int): Pair<String, Int> {