diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-02-26 13:55:37 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-02-26 13:55:37 +0100 |
commit | f90ee50fcace48d71b132d6ec7f305138fe01e44 (patch) | |
tree | 1fd50315847e97ca47edb59aa2b3ddb5930ab680 /src/Formats | |
parent | 7003ad81924859cbe6fd5974a95295f1f8588290 (diff) | |
download | dokka-f90ee50fcace48d71b132d6ec7f305138fe01e44.tar.gz dokka-f90ee50fcace48d71b132d6ec7f305138fe01e44.tar.bz2 dokka-f90ee50fcace48d71b132d6ec7f305138fe01e44.zip |
fix formatting of signatures in Kotlin web site
Diffstat (limited to 'src/Formats')
-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) } |