diff options
-rw-r--r-- | src/Formats/KotlinWebsiteFormatService.kt | 6 | ||||
-rw-r--r-- | src/Formats/StructuredFormatService.kt | 14 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/Formats/KotlinWebsiteFormatService.kt b/src/Formats/KotlinWebsiteFormatService.kt index 3096c9de..dd33f5c4 100644 --- a/src/Formats/KotlinWebsiteFormatService.kt +++ b/src/Formats/KotlinWebsiteFormatService.kt @@ -20,11 +20,15 @@ public class KotlinWebsiteFormatService(locationService: LocationService, return "" } - override public fun formatCode(code: String): String = "<code>$code</code>" override fun formatStrikethrough(text: String): String = "<s>$text</s>" + override fun appendAsSignature(to: StringBuilder, block: () -> Unit) { + block() + to.append("<br/>") // since we've used HTML to format the signature, add an HTML line break following it + } + override fun formatLink(text: String, href: String): String { return "<a href=\"${href}\">${text}</a>" } diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt index 00ec6db4..8d817b19 100644 --- a/src/Formats/StructuredFormatService.kt +++ b/src/Formats/StructuredFormatService.kt @@ -96,8 +96,10 @@ public abstract class StructuredFormatService(locationService: LocationService, for ((summary, items) in breakdownBySummary) { items.forEach { - to.append(formatCode(formatText(location, languageService.render(it)))) - it.appendSourceLink(to) + appendAsSignature(to) { + to.append(formatCode(formatText(location, languageService.render(it)))) + it.appendSourceLink(to) + } it.appendOverrides(to) it.appendDeprecation(location, to) } @@ -110,6 +112,10 @@ public abstract class StructuredFormatService(locationService: LocationService, } } + protected open fun appendAsSignature(to: StringBuilder, block: () -> Unit) { + block() + } + fun appendDescription(location: Location, to: StringBuilder, node: DocumentationNode) { if (node.content.description != ContentEmpty) { appendHeader(to, "Description", 3) @@ -210,7 +216,9 @@ public abstract class StructuredFormatService(locationService: LocationService, signatureTexts.subList(0, signatureTexts.size()-1).forEach { appendLine(to, it) } - to.append(signatureTexts.last()) + appendAsSignature(to) { + to.append(signatureTexts.last()) + } if (!summary.isEmpty()) { to.append(summary) } |