diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-15 16:37:50 +0400 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-15 16:37:50 +0400 |
commit | e8447fdede68a21db1d086305d1fff11bc64e3a8 (patch) | |
tree | 295f8d77a209f5b510fa12d24ec8ee22bd4e7319 /src | |
parent | 20f4e24236eb180f8831ce94a97993e3d4b98323 (diff) | |
download | dokka-e8447fdede68a21db1d086305d1fff11bc64e3a8.tar.gz dokka-e8447fdede68a21db1d086305d1fff11bc64e3a8.tar.bz2 dokka-e8447fdede68a21db1d086305d1fff11bc64e3a8.zip |
Format links and tables in markdown (hardcoded)
Diffstat (limited to 'src')
-rw-r--r-- | src/Formats/StructuredFormatService.kt | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt index bca53f4f..32742fea 100644 --- a/src/Formats/StructuredFormatService.kt +++ b/src/Formats/StructuredFormatService.kt @@ -1,7 +1,6 @@ package org.jetbrains.dokka import java.util.LinkedHashMap -import org.jetbrains.dokka.DocumentationNode.Kind public data class FormatLink(val text: String, val location: Location) @@ -16,7 +15,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi public abstract fun appendLine(to: StringBuilder) public abstract fun formatLink(text: String, location: Location): String - public open fun formatLink(link: FormatLink): String = formatLink(link.text, link.location) + public open fun formatLink(link: FormatLink): String = formatLink(link.text, link.location) public abstract fun formatBold(text: String): String public abstract fun formatCode(code: String): String @@ -80,24 +79,22 @@ public abstract class StructuredFormatService(val locationService: LocationServi if (node.members.any()) { appendHeader(to, "Members") - appendLine(to, "| Name | Summary |") + appendLine(to, "| Name | Summary |") // TODO: hardcoded appendLine(to, "|------|---------|") val children = node.members.sortBy { it.name } val membersMap = children.groupByTo(LinkedHashMap()) { link(node, it) } for ((location, members) in membersMap) { - val mainMember = members.first() - val displayName = when (mainMember.kind) { - Kind.Constructor -> "*.init*" - else -> languageService.renderName(mainMember).htmlEscape() - } - appendText(to, "|${formatLink(location)}|") - val breakdownBySummary = members.groupByTo(LinkedHashMap()) { it.doc.summary } for ((summary, items) in breakdownBySummary) { - appendLine(to, summary) - appendBlockCode(to, items.map { formatBold("${languageService.render(it)}") }) + if (!summary.isEmpty()) { + appendText(to, summary) + appendText(to, "<br/>") // TODO: hardcoded + } + + val signatures = items.map { formatBold(formatCode("${languageService.render(it)}")) } + appendText(to, signatures.join("<br/>")) // TODO: hardcoded } appendLine(to, "|") |