aboutsummaryrefslogtreecommitdiff
path: root/src/Formats/StructuredFormatService.kt
diff options
context:
space:
mode:
authorDmitry Jemerov <intelliyole@gmail.com>2014-12-30 16:34:47 +0100
committerDmitry Jemerov <intelliyole@gmail.com>2014-12-30 16:34:47 +0100
commit5f47bc17630ef1457b36054dc8b19011d9d14132 (patch)
tree876215d35aa29f49d25645ad92edfe190f3364e6 /src/Formats/StructuredFormatService.kt
parent7db96f8da4317cd290ccc9f988c534f10923dbbb (diff)
parent3fc3e33a0eff0198ed89cc94197cb21653bf1ca2 (diff)
downloaddokka-5f47bc17630ef1457b36054dc8b19011d9d14132.tar.gz
dokka-5f47bc17630ef1457b36054dc8b19011d9d14132.tar.bz2
dokka-5f47bc17630ef1457b36054dc8b19011d9d14132.zip
Merge pull request #8 from orangy/class-object
Include class object properties and functions in the list of class members
Diffstat (limited to 'src/Formats/StructuredFormatService.kt')
-rw-r--r--src/Formats/StructuredFormatService.kt28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt
index adfac99c..2d326854 100644
--- a/src/Formats/StructuredFormatService.kt
+++ b/src/Formats/StructuredFormatService.kt
@@ -10,7 +10,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi
abstract public fun appendBlockCode(to: StringBuilder, line: String)
abstract public fun appendBlockCode(to: StringBuilder, lines: Iterable<String>)
abstract public fun appendHeader(to: StringBuilder, text: String, level: Int = 1)
- abstract public fun appendText(to: StringBuilder, text: String)
+ abstract public fun appendParagraph(to: StringBuilder, text: String)
abstract public fun appendLine(to: StringBuilder, text: String)
public abstract fun appendLine(to: StringBuilder)
@@ -41,7 +41,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi
open fun formatText(location: Location, content: ContentNode): String {
return StringBuilder {
when (content) {
- is ContentText -> append(content.text)
+ is ContentText -> append(formatText(content.text))
is ContentSymbol -> append(formatSymbol(content.text))
is ContentKeyword -> append(formatKeyword(content.text))
is ContentIdentifier -> append(formatIdentifier(content.text))
@@ -61,7 +61,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi
append(formatLink(linkText, content.href))
}
is ContentParagraph -> {
- appendText(this, formatText(location, content.children))
+ appendParagraph(this, formatText(location, content.children))
}
is ContentBlockCode -> {
appendBlockCode(this, formatText(location, content.children))
@@ -143,17 +143,23 @@ public abstract class StructuredFormatService(val locationService: LocationServi
for ((memberLocation, members) in membersMap) {
appendTableRow(to) {
appendTableCell(to) {
- appendText(to, formatLink(memberLocation))
+ to.append(formatLink(memberLocation))
}
appendTableCell(to) {
val breakdownBySummary = members.groupBy { formatText(location, it.summary) }
for ((summary, items) in breakdownBySummary) {
- for (signature in items) {
- appendBlockCode(to, formatText(location, languageService.render(signature)))
+ val signatureTexts = items map { signature ->
+ val signature = languageService.render(signature)
+ val signatureAsCode = ContentCode()
+ signatureAsCode.append(signature)
+ formatText(location, signatureAsCode)
}
-
+ signatureTexts.subList(0, signatureTexts.size()-1).forEach {
+ appendLine(to, it)
+ }
+ to.append(signatureTexts.last())
if (!summary.isEmpty()) {
- appendText(to, summary)
+ to.append(summary)
}
}
}
@@ -187,6 +193,8 @@ public abstract class StructuredFormatService(val locationService: LocationServi
appendSection(location, "Constructors", node.members(DocumentationNode.Kind.Constructor), node, to)
appendSection(location, "Properties", node.members(DocumentationNode.Kind.Property), node, to)
appendSection(location, "Functions", node.members(DocumentationNode.Kind.Function), node, to)
+ appendSection(location, "Class Object Properties", node.members(DocumentationNode.Kind.ClassObjectProperty), node, to)
+ appendSection(location, "Class Object Functions", node.members(DocumentationNode.Kind.ClassObjectFunction), node, to)
appendSection(location, "Accessors", node.members(DocumentationNode.Kind.PropertyAccessor), node, to)
appendSection(location, "Other members", node.members.filter {
it.kind !in setOf(
@@ -197,7 +205,9 @@ public abstract class StructuredFormatService(val locationService: LocationServi
DocumentationNode.Kind.Property,
DocumentationNode.Kind.Package,
DocumentationNode.Kind.Function,
- DocumentationNode.Kind.PropertyAccessor
+ DocumentationNode.Kind.PropertyAccessor,
+ DocumentationNode.Kind.ClassObjectProperty,
+ DocumentationNode.Kind.ClassObjectFunction
)
}, node, to)
appendSection(location, "Extensions", node.extensions, node, to)