diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-03-24 22:01:49 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-04-10 18:19:20 +0300 |
commit | f65fbf534807c168a81f4e80919680ca7dcff47b (patch) | |
tree | 8d61b7566aa4be26c5259d42acfe32aa9c3dc5b1 /core/src/main/kotlin/Formats | |
parent | e13d38a494d8303721a1a4e10f65064b4de157e2 (diff) | |
download | dokka-f65fbf534807c168a81f4e80919680ca7dcff47b.tar.gz dokka-f65fbf534807c168a81f4e80919680ca7dcff47b.tar.bz2 dokka-f65fbf534807c168a81f4e80919680ca7dcff47b.zip |
Tweak kws html format to match output of old format
Diffstat (limited to 'core/src/main/kotlin/Formats')
3 files changed, 34 insertions, 25 deletions
diff --git a/core/src/main/kotlin/Formats/HtmlFormatService.kt b/core/src/main/kotlin/Formats/HtmlFormatService.kt index 5e05f51a..b6672434 100644 --- a/core/src/main/kotlin/Formats/HtmlFormatService.kt +++ b/core/src/main/kotlin/Formats/HtmlFormatService.kt @@ -46,7 +46,7 @@ open class HtmlOutputBuilder(to: StringBuilder, override fun appendParagraph(body: () -> Unit) = wrapInTag("p", body, newlineBeforeOpen = true, newlineAfterClose = true) - override fun appendSoftParagraph(body: () -> Unit) = appendParagraph(body) + override fun appendSoftParagraph(body: () -> Unit) = body() override fun appendLine() { to.appendln("<br/>") diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt index 7b9279b2..0d8b10bb 100644 --- a/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt +++ b/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt @@ -66,14 +66,6 @@ open class KotlinWebsiteHtmlOutputBuilder(to: StringBuilder, override fun appendLink(href: String, body: () -> Unit) = wrap("<a href=\"$href\">", "</a>", body) - override fun appendHeader(level: Int, body: () -> Unit) { - if (insideDiv > 0) { - wrapInTag("p", body, newlineAfterClose = true) - } else { - super.appendHeader(level, body) - } - } - override fun appendTable(vararg columns: String, body: () -> Unit) { to.appendln("<table class=\"api-docs-table\">") body() @@ -164,6 +156,17 @@ open class KotlinWebsiteHtmlOutputBuilder(to: StringBuilder, } } } + + override fun appendSoftParagraph(body: () -> Unit) = appendParagraph(body) + + + override fun appendSectionWithTag(section: ContentSection) { + appendParagraph { + appendStrong { appendText(section.tag) } + appendText(" ") + appendContent(section) + } + } } class KotlinWebsiteHtmlFormatService @Inject constructor(locationService: LocationService, diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index 961c2c26..b29cf492 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -73,6 +73,14 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } } + open fun appendSectionWithTag(section: ContentSection) { + appendParagraph { + appendStrong { appendText(section.tag) } + appendLine() + appendContent(section) + } + } + open fun appendSymbol(text: String) { appendText(text) } @@ -294,11 +302,11 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, formatOverloadGroup(breakdownBySummary.values.single()) } else { for ((_, items) in breakdownBySummary) { - appendSoftParagraph { - appendAsOverloadGroup(to, platformsOfItems(items)) { - formatOverloadGroup(items) - } + + appendAsOverloadGroup(to, platformsOfItems(items)) { + formatOverloadGroup(items) } + } } } @@ -408,11 +416,7 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } for (section in content.sections.filter { it.subjectName == null }) { - appendParagraph { - appendStrong { appendText(section.tag) } - appendLine() - appendContent(section) - } + appendSectionWithTag(section) } } @@ -450,11 +454,11 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } for (member in node.members.sortedBy(DocumentationNode::priority)) { - appendSoftParagraph { - appendAsOverloadGroup(to, platformsOfItems(listOf(member))) { - formatSubNodeOfGroup(member) - } + + appendAsOverloadGroup(to, platformsOfItems(listOf(member))) { + formatSubNodeOfGroup(member) } + } } @@ -559,9 +563,11 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, elementPlatforms appendIndexRow(platforms) { appendTableCell { - appendLink(memberLocation) - if (members.singleOrNull()?.kind != NodeKind.ExternalClass) { - appendPlatforms(platforms) + appendParagraph { + appendLink(memberLocation) + if (members.singleOrNull()?.kind != NodeKind.ExternalClass) { + appendPlatforms(platforms) + } } } appendTableCell { |