From c0064d2b43ec30237d0d39bf5a9aaa4ce5e14744 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Mon, 4 Jul 2016 19:48:27 +0200 Subject: Rewrite output generation; much cleaner Markdown and HTML generated. Resolves #71, #72 --- core/src/main/kotlin/Formats/GFMFormatService.kt | 29 +- core/src/main/kotlin/Formats/HtmlFormatService.kt | 122 +++---- .../src/main/kotlin/Formats/HtmlTemplateService.kt | 3 + .../kotlin/Formats/KotlinWebsiteFormatService.kt | 81 ++--- .../main/kotlin/Formats/MarkdownFormatService.kt | 187 +++++++--- .../main/kotlin/Formats/StructuredFormatService.kt | 397 ++++++++++++--------- core/src/main/kotlin/Java/JavadocParser.kt | 2 +- core/src/test/kotlin/format/GFMFormatTest.kt | 4 + core/src/test/kotlin/model/JavaTest.kt | 4 +- core/testdata/format/accessor.md | 8 - core/testdata/format/annotatedTypeParameter.md | 5 +- core/testdata/format/annotationClass.md | 4 - core/testdata/format/annotationClass.package.md | 3 - core/testdata/format/annotationParams.md | 5 +- core/testdata/format/annotations.md | 10 +- core/testdata/format/arrayAverage.md | 15 +- core/testdata/format/bracket.html | 4 +- core/testdata/format/brokenLink.html | 4 +- core/testdata/format/classWithCompanionObject.html | 4 +- core/testdata/format/classWithCompanionObject.md | 8 - core/testdata/format/codeBlock.md | 14 +- core/testdata/format/codeSpan.html | 4 +- core/testdata/format/companionObjectExtension.md | 11 +- .../crossLanguage/kotlinExtendsJava/Bar.html | 7 +- core/testdata/format/deprecated.class.html | 6 - core/testdata/format/emptyDescription.md | 3 - core/testdata/format/entity.html | 7 +- core/testdata/format/enumClass.md | 4 - core/testdata/format/enumClass.value.md | 5 +- core/testdata/format/exceptionClass.md | 6 +- core/testdata/format/exceptionClass.package.md | 5 +- core/testdata/format/extensionFunctionParameter.md | 5 +- .../format/extensionWithDocumentedReceiver.md | 4 - core/testdata/format/extensions.class.md | 13 +- core/testdata/format/extensions.package.md | 3 - .../format/functionWithDefaultParameter.md | 5 +- core/testdata/format/genericInheritedExtensions.md | 12 +- core/testdata/format/gfm/listInTableCell.kt | 8 + core/testdata/format/gfm/listInTableCell.md | 17 + core/testdata/format/gfm/sample.md | 19 +- core/testdata/format/htmlEscaping.html | 4 +- .../format/inapplicableExtensionFunctions.md | 10 +- .../format/inheritedCompanionObjectProperties.md | 14 +- core/testdata/format/inheritedExtensions.md | 12 +- core/testdata/format/inheritedMembers.md | 14 +- core/testdata/format/javaCodeInParam.md | 14 +- core/testdata/format/javaCodeLiteralTags.md | 22 +- core/testdata/format/javaDeprecated.html | 4 +- core/testdata/format/javaLinkTag.html | 9 +- core/testdata/format/javaLinkTagWithLabel.html | 9 +- core/testdata/format/javaSeeTag.html | 8 +- core/testdata/format/javaSpaceInAuthor.md | 13 +- core/testdata/format/javaSupertype.html | 4 +- core/testdata/format/javadocHtml.md | 30 +- core/testdata/format/javadocOrderedList.md | 15 +- core/testdata/format/jdkLinks.md | 12 +- core/testdata/format/linkWithLabel.html | 7 +- core/testdata/format/linkWithStarProjection.html | 4 +- core/testdata/format/markdownInLinks.html | 4 +- .../format/multipleTypeParameterConstraints.md | 5 +- core/testdata/format/nullability.md | 10 +- core/testdata/format/operatorOverloading.md | 5 +- core/testdata/format/orderedList.html | 14 +- core/testdata/format/overloads.html | 3 +- core/testdata/format/overloadsWithDescription.html | 11 +- .../format/overloadsWithDifferentDescriptions.html | 27 +- core/testdata/format/overridingFunction.md | 3 +- core/testdata/format/paramTag.md | 7 +- core/testdata/format/parameterAnchor.html | 9 +- core/testdata/format/parenthesis.html | 4 +- core/testdata/format/propertyVar.md | 5 +- core/testdata/format/receiverParameterTypeBound.md | 8 +- core/testdata/format/reifiedTypeParameter.md | 5 +- core/testdata/format/returnWithLink.html | 4 +- core/testdata/format/see.html | 13 +- core/testdata/format/shadowedExtensionFunctions.md | 13 +- core/testdata/format/starProjection.md | 4 +- core/testdata/format/summarizeSignatures.md | 13 +- .../testdata/format/summarizeSignaturesProperty.md | 13 +- core/testdata/format/throwsTag.md | 5 +- core/testdata/format/tripleBackticks.html | 7 +- core/testdata/format/typeLink.html | 4 +- core/testdata/format/typeParameterBounds.md | 8 +- core/testdata/format/typeParameterVariance.md | 6 +- core/testdata/format/typeProjectionVariance.md | 4 +- .../format/uninterpretedEmphasisCharacters.html | 4 +- core/testdata/format/varargsFunction.md | 5 +- core/testdata/format/website/returnTag.md | 7 +- core/testdata/format/website/sample.md | 14 +- 89 files changed, 658 insertions(+), 848 deletions(-) create mode 100644 core/testdata/format/gfm/listInTableCell.kt create mode 100644 core/testdata/format/gfm/listInTableCell.md (limited to 'core') diff --git a/core/src/main/kotlin/Formats/GFMFormatService.kt b/core/src/main/kotlin/Formats/GFMFormatService.kt index b57fa932..cfb7fc03 100644 --- a/core/src/main/kotlin/Formats/GFMFormatService.kt +++ b/core/src/main/kotlin/Formats/GFMFormatService.kt @@ -9,11 +9,38 @@ open class GFMOutputBuilder(to: StringBuilder, extension: String) : MarkdownOutputBuilder(to, location, locationService, languageService, extension) { - override fun appendTable(to: StringBuilder, vararg columns: String, body: () -> Unit) { + override fun appendTable(vararg columns: String, body: () -> Unit) { to.appendln(columns.joinToString(" | ", "| ", " |")) to.appendln("|" + "---|".repeat(columns.size)) body() } + + override fun appendUnorderedList(body: () -> Unit) { + if (inTableCell) { + wrapInTag("ul", body) + } + else { + super.appendUnorderedList(body) + } + } + + override fun appendOrderedList(body: () -> Unit) { + if (inTableCell) { + wrapInTag("ol", body) + } + else { + super.appendOrderedList(body) + } + } + + override fun appendListItem(body: () -> Unit) { + if (inTableCell) { + wrapInTag("li", body) + } + else { + super.appendListItem(body) + } + } } open class GFMFormatService(locationService: LocationService, diff --git a/core/src/main/kotlin/Formats/HtmlFormatService.kt b/core/src/main/kotlin/Formats/HtmlFormatService.kt index fff8f553..de41d4c6 100644 --- a/core/src/main/kotlin/Formats/HtmlFormatService.kt +++ b/core/src/main/kotlin/Formats/HtmlFormatService.kt @@ -14,108 +14,77 @@ open class HtmlOutputBuilder(to: StringBuilder, val templateService: HtmlTemplateService) : StructuredOutputBuilder(to, location, locationService, languageService, extension) { - override fun formatText(text: String): String { - return text.htmlEscape() + override fun appendText(text: String) { + to.append(text.htmlEscape()) } - override fun formatSymbol(text: String): String { - return "${formatText(text)}" + override fun appendSymbol(text: String) { + to.append("${text.htmlEscape()}") } - override fun formatKeyword(text: String): String { - return "${formatText(text)}" + override fun appendKeyword(text: String) { + to.append("${text.htmlEscape()}") } - override fun formatIdentifier(text: String, kind: IdentifierKind, signature: String?): String { + override fun appendIdentifier(text: String, kind: IdentifierKind, signature: String?) { val id = signature?.let { " id=\"$it\"" }.orEmpty() - return "${formatText(text)}" + to.append("${text.htmlEscape()}") } - override fun appendBlockCode(to: StringBuilder, lines: List, language: String) { - to.append("
")
-        to.append(lines.joinToString("\n"))
-        to.append("
") - } - - override fun appendHeader(to: StringBuilder, text: String, level: Int) { - to.appendln("${text}") - } + override fun appendBlockCode(language: String, body: () -> Unit) = wrap("
", "
", body) - override fun appendParagraph(to: StringBuilder, text: String) { - to.appendln("

${text}

") - } + override fun appendHeader(level: Int, body: () -> Unit) = + wrapInTag("h$level", body, newlineBeforeOpen = true, newlineAfterClose = true) + override fun appendParagraph(body: () -> Unit) = + wrapInTag("p", body, newlineBeforeOpen = true, newlineAfterClose = true) - override fun appendLine(to: StringBuilder, text: String) { - to.appendln("$text
") + override fun appendLine() { + to.appendln("
") } - override fun appendAnchor(to: StringBuilder, anchor: String) { + override fun appendAnchor(anchor: String) { to.appendln("") } - override fun appendTable(to: StringBuilder, vararg columns: String, body: () -> Unit) { - to.appendln("") - body() - to.appendln("
") - } - - override fun appendTableBody(to: StringBuilder, body: () -> Unit) { - to.appendln("") - body() - to.appendln("") - } - - override fun appendTableRow(to: StringBuilder, body: () -> Unit) { - to.appendln("") - body() - to.appendln("") - } - - override fun appendTableCell(to: StringBuilder, body: () -> Unit) { - to.appendln("") - body() - to.appendln("") - } - - override fun formatLink(text: String, href: String): String { - return "${text}" - } - - override fun formatStrong(text: String): String { - return "${text}" - } - - override fun formatEmphasis(text: String): String { - return "${text}" - } + override fun appendTable(vararg columns: String, body: () -> Unit) = + wrapInTag("table", body, newlineAfterOpen = true, newlineAfterClose = true) + override fun appendTableBody(body: () -> Unit) = + wrapInTag("tbody", body, newlineAfterOpen = true, newlineAfterClose = true) + override fun appendTableRow(body: () -> Unit) = + wrapInTag("tr", body, newlineAfterOpen = true, newlineAfterClose = true) + override fun appendTableCell(body: () -> Unit) = + wrapInTag("td", body, newlineAfterOpen = true, newlineAfterClose = true) - override fun formatStrikethrough(text: String): String { - return "${text}" - } + override fun appendLink(href: String, body: () -> Unit) = wrap("", "", body) - override fun formatCode(code: String): String { - return "${code}" - } + override fun appendStrong(body: () -> Unit) = wrapInTag("strong", body) + override fun appendEmphasis(body: () -> Unit) = wrapInTag("emph", body) + override fun appendStrikethrough(body: () -> Unit) = wrapInTag("s", body) + override fun appendCode(body: () -> Unit) = wrapInTag("code", body) - override fun formatUnorderedList(text: String): String = "" - override fun formatOrderedList(text: String): String = "
    ${text}
" + override fun appendUnorderedList(body: () -> Unit) = wrapInTag("ul", body, newlineAfterClose = true) + override fun appendOrderedList(body: () -> Unit) = wrapInTag("ol", body, newlineAfterClose = true) + override fun appendListItem(body: () -> Unit) = wrapInTag("li", body, newlineAfterClose = true) - override fun formatListItem(text: String, kind: ListKind): String { - return "
  • ${text}
  • " + override fun appendBreadcrumbSeparator() { + to.append(" / ") } - override fun formatBreadcrumbs(items: Iterable): String { - return items.map { formatLink(it) }.joinToString(" / ") - } - - override fun appendNodes(nodes: Iterable) { templateService.appendHeader(to, getPageTitle(nodes), locationService.calcPathToRoot(location)) super.appendNodes(nodes) templateService.appendFooter(to) } - override fun formatNonBreakingSpace(): String = " " + override fun appendNonBreakingSpace() { + to.append(" ") + } + + override fun ensureParagraph() { + if (!to.endsWith("

    ") && !to.endsWith("

    ")) { + to.append("\n

    ") + } + } } open class HtmlFormatService @Inject constructor(@Named("folders") locationService: LocationService, @@ -143,8 +112,9 @@ open class HtmlFormatService @Inject constructor(@Named("folders") locationServi override fun appendOutlineHeader(location: Location, node: DocumentationNode, to: StringBuilder) { val link = ContentNodeDirectLink(node) link.append(languageService.render(node, LanguageService.RenderMode.FULL)) - val signature = createOutputBuilder(to, location).formatText(location, link) - to.appendln("${signature}
    ") + val tempBuilder = StringBuilder() + createOutputBuilder(tempBuilder, location).appendContent(link) + to.appendln("${tempBuilder.toString()}
    ") } override fun appendOutlineLevel(to: StringBuilder, body: () -> Unit) { diff --git a/core/src/main/kotlin/Formats/HtmlTemplateService.kt b/core/src/main/kotlin/Formats/HtmlTemplateService.kt index 13587b05..7efb94a1 100644 --- a/core/src/main/kotlin/Formats/HtmlTemplateService.kt +++ b/core/src/main/kotlin/Formats/HtmlTemplateService.kt @@ -10,6 +10,9 @@ interface HtmlTemplateService { fun default(css: String? = null): HtmlTemplateService { return object : HtmlTemplateService { override fun appendFooter(to: StringBuilder) { + if (!to.endsWith('\n')) { + to.append('\n') + } to.appendln("") to.appendln("") } diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt index e3229523..03cf7fc8 100644 --- a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt +++ b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt @@ -18,21 +18,17 @@ class KotlinWebsiteOutputBuilder(to: StringBuilder, to.appendln("layout: api") } - override fun formatBreadcrumbs(items: Iterable): String { - items.drop(1) - - if (items.count() > 1) { - return "

    " + - items.map { formatLink(it) }.joinToString(" / ") + - "
    " + override fun appendBreadcrumbs(path: Iterable) { + if (path.count() > 1) { + to.append("
    ") + super.appendBreadcrumbs(path) + to.append("
    ") } - - return "" } - override fun formatCode(code: String): String = if (code.length > 0) "$code" else "" + override fun appendCode(body: () -> Unit) = wrapIfNotEmpty("", "", body) - override fun formatStrikethrough(text: String): String = "$text" + override fun appendStrikethrough(body: () -> Unit) = wrapInTag("s", body) private fun div(to: StringBuilder, cssClass: String, block: () -> Unit) { to.append("
    ") @@ -42,7 +38,7 @@ class KotlinWebsiteOutputBuilder(to: StringBuilder, to.append("
    \n") } - override fun appendAsSignature(to: StringBuilder, node: ContentNode, block: () -> Unit) { + override fun appendAsSignature(node: ContentNode, block: () -> Unit) { val contentLength = node.textLength if (contentLength == 0) return div(to, "signature") { @@ -60,84 +56,81 @@ class KotlinWebsiteOutputBuilder(to: StringBuilder, to.append("
    ") } - override fun formatLink(text: String, href: String): String { - return "${text}" - } + override fun appendLink(href: String, body: () -> Unit) = wrap("", "", body) - override fun appendHeader(to: StringBuilder, text: String, level: Int) { + override fun appendHeader(level: Int, body: () -> Unit) { if (insideDiv > 0) { - to.appendln("${text}") + wrapInTag("p", body, newlineAfterClose = true) } else { - super.appendHeader(to, text, level) + super.appendHeader(level, body) } } - override fun appendLine(to: StringBuilder, text: String) { + override fun appendLine() { if (insideDiv > 0) { - to.appendln("$text
    ") + to.appendln("
    ") } else { - super.appendLine(to, text) + super.appendLine() } } - override fun appendTable(to: StringBuilder, vararg columns: String, body: () -> Unit) { + override fun appendTable(vararg columns: String, body: () -> Unit) { to.appendln("") body() to.appendln("
    ") } - override fun appendTableBody(to: StringBuilder, body: () -> Unit) { + override fun appendTableBody(body: () -> Unit) { to.appendln("") body() to.appendln("") } - override fun appendTableRow(to: StringBuilder, body: () -> Unit) { + override fun appendTableRow(body: () -> Unit) { to.appendln("") body() to.appendln("") } - override fun appendTableCell(to: StringBuilder, body: () -> Unit) { + override fun appendTableCell(body: () -> Unit) { to.appendln("") body() to.appendln("\n") } - override fun appendBlockCode(to: StringBuilder, lines: List, language: String) { + override fun appendBlockCode(language: String, body: () -> Unit) { if (language.isNotEmpty()) { - super.appendBlockCode(to, lines, language) + super.appendBlockCode(language, body) } else { - to.append("
    ")
    -            to.append(lines.joinToString { "\n" }.trimStart())
    -            to.append("
    ") + wrap("
    ", "
    ", body) } } - override fun formatSymbol(text: String): String { - return "${formatText(text)}" + override fun appendSymbol(text: String) { + to.append("${text.htmlEscape()}") } - override fun formatKeyword(text: String): String { - return "${formatText(text)}" + override fun appendKeyword(text: String) { + to.append("${text.htmlEscape()}") } - override fun formatIdentifier(text: String, kind: IdentifierKind, signature: String?): String { + override fun appendIdentifier(text: String, kind: IdentifierKind, signature: String?) { val id = signature?.let { " id=\"$it\"" }.orEmpty() - return "${formatText(text)}" + to.append("${text.htmlEscape()}") } - override fun formatSoftLineBreak(): String = if (needHardLineBreaks) - "
    " - else - "" + override fun appendSoftLineBreak() { + if (needHardLineBreaks) + to.append("
    ") - override fun formatIndentedSoftLineBreak(): String = if (needHardLineBreaks) - "
        " - else - "" + } + override fun appendIndentedSoftLineBreak() { + if (needHardLineBreaks) { + to.append("
        ") + } + } private fun identifierClassName(kind: IdentifierKind) = when(kind) { IdentifierKind.ParameterName -> "parameterName" diff --git a/core/src/main/kotlin/Formats/MarkdownFormatService.kt b/core/src/main/kotlin/Formats/MarkdownFormatService.kt index 5ddb7f1f..6f2ab327 100644 --- a/core/src/main/kotlin/Formats/MarkdownFormatService.kt +++ b/core/src/main/kotlin/Formats/MarkdownFormatService.kt @@ -1,7 +1,12 @@ package org.jetbrains.dokka import com.google.inject.Inject +import java.util.* +enum class ListKind { + Ordered, + Unordered +} open class MarkdownOutputBuilder(to: StringBuilder, location: Location, @@ -10,94 +15,178 @@ open class MarkdownOutputBuilder(to: StringBuilder, extension: String) : StructuredOutputBuilder(to, location, locationService, languageService, extension) { - override fun formatBreadcrumbs(items: Iterable): String { - return items.map { formatLink(it) }.joinToString(" / ") - } - - override fun formatText(text: String): String = text.htmlEscape() - override fun formatSymbol(text: String): String = text.htmlEscape() - override fun formatKeyword(text: String): String = text.htmlEscape() - override fun formatIdentifier(text: String, kind: IdentifierKind, signature: String?): String = text.htmlEscape() - - override fun formatCode(code: String): String { - return "`$code`" + private val listKindStack = Stack() + protected var inTableCell = false + protected var inCodeBlock = false + private var lastTableCellStart = -1 + + private fun appendNewline() { + while (to.endsWith(' ')) { + to.setLength(to.length - 1) + } + to.appendln() } - override fun formatUnorderedList(text: String): String = text + "\n" - override fun formatOrderedList(text: String): String = text + "\n" - - override fun formatListItem(text: String, kind: ListKind): String { - val itemText = if (text.endsWith("\n")) text else text + "\n" - return if (kind == ListKind.Unordered) "* $itemText" else "1. $itemText" + private fun ensureNewline() { + if (inTableCell && listKindStack.isEmpty()) { + if (to.length != lastTableCellStart && !to.endsWith("
    ")) { + to.append("
    ") + } + } + else { + if (!endsWithNewline()) { + appendNewline() + } + } + } + + private fun endsWithNewline(): Boolean { + var index = to.length - 1 + while (index > 0) { + val c = to[index] + if (c != ' ') { + return c == '\n' + } + index-- + } + return false + } + + override fun ensureParagraph() { + if (!to.endsWith("\n\n")) { + if (!to.endsWith('\n')) { + appendNewline() + } + appendNewline() + } + } + override fun appendBreadcrumbSeparator() { + to.append(" / ") + } + + override fun appendText(text: String) { + if (inCodeBlock) { + to.append(text) + } + else { + to.append(text.htmlEscape()) + } + } + + override fun appendCode(body: () -> Unit) { + inCodeBlock = true + wrapIfNotEmpty("`", "`", body, checkEndsWith = true) + inCodeBlock = false + } + + override fun appendUnorderedList(body: () -> Unit) { + listKindStack.push(ListKind.Unordered) + body() + listKindStack.pop() + ensureNewline() } - override fun formatStrong(text: String): String { - return "**$text**" + override fun appendOrderedList(body: () -> Unit) { + listKindStack.push(ListKind.Ordered) + body() + listKindStack.pop() + ensureNewline() } - override fun formatEmphasis(text: String): String { - return "*$text*" + override fun appendListItem(body: () -> Unit) { + ensureNewline() + to.append(if (listKindStack.peek() == ListKind.Unordered) "* " else "1. ") + body() + ensureNewline() } - override fun formatStrikethrough(text: String): String { - return "~~$text~~" - } + override fun appendStrong(body: () -> Unit) = wrap("**", "**", body) + override fun appendEmphasis(body: () -> Unit) = wrap("*", "*", body) + override fun appendStrikethrough(body: () -> Unit) = wrap("~~", "~~", body) - override fun formatLink(text: String, href: String): String { - return "[$text]($href)" + override fun appendLink(href: String, body: () -> Unit) { + if (inCodeBlock) { + wrap("`[`", "`]($href)`", body) + } + else { + wrap("[", "]($href)", body) + } } - override fun appendLine(to: StringBuilder, text: String) { - to.appendln(text) + override fun appendLine() { + if (inTableCell) { + to.append("
    ") + } + else { + appendNewline() + } } - override fun appendAnchor(to: StringBuilder, anchor: String) { + override fun appendAnchor(anchor: String) { // no anchors in Markdown } - override fun appendParagraph(to: StringBuilder, text: String) { - to.appendln() - to.appendln(text) - to.appendln() + override fun appendParagraph(body: () -> Unit) { + if (inTableCell) { + ensureNewline() + body() + } + else { + ensureParagraph() + body() + ensureParagraph() + } } - override fun appendHeader(to: StringBuilder, text: String, level: Int) { - appendLine(to) - appendLine(to, "${"#".repeat(level)} $text") - appendLine(to) + override fun appendHeader(level: Int, body: () -> Unit) { + ensureParagraph() + to.append("${"#".repeat(level)} ") + body() + ensureParagraph() } - override fun appendBlockCode(to: StringBuilder, lines: List, language: String) { - appendLine(to) + override fun appendBlockCode(language: String, body: () -> Unit) { + ensureParagraph() to.appendln(if (language.isEmpty()) "```" else "``` $language") - to.appendln(lines.joinToString("\n")) + body() + ensureNewline() to.appendln("```") - appendLine(to) + appendLine() } - override fun appendTable(to: StringBuilder, vararg columns: String, body: () -> Unit) { - to.appendln() + override fun appendTable(vararg columns: String, body: () -> Unit) { + ensureParagraph() body() - to.appendln() + ensureParagraph() } - override fun appendTableBody(to: StringBuilder, body: () -> Unit) { + override fun appendTableBody(body: () -> Unit) { body() } - override fun appendTableRow(to: StringBuilder, body: () -> Unit) { + override fun appendTableRow(body: () -> Unit) { to.append("|") body() - to.appendln() + appendNewline() } - override fun appendTableCell(to: StringBuilder, body: () -> Unit) { + override fun appendTableCell(body: () -> Unit) { to.append(" ") + inTableCell = true + lastTableCellStart = to.length body() + inTableCell = false to.append(" |") } - override fun formatNonBreakingSpace(): String = " " + override fun appendNonBreakingSpace() { + if (inCodeBlock) { + to.append(" ") + } + else { + to.append(" ") + } + } } open class MarkdownFormatService(locationService: LocationService, diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index 407c7018..f24c9c2d 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -5,95 +5,162 @@ import java.util.* data class FormatLink(val text: String, val href: String) -enum class ListKind { - Ordered, - Unordered -} - abstract class StructuredOutputBuilder(val to: StringBuilder, val location: Location, val locationService: LocationService, val languageService: LanguageService, val extension: String) : FormattedOutputBuilder { - abstract fun appendBlockCode(to: StringBuilder, lines: List, language: String) - abstract fun appendHeader(to: StringBuilder, text: String, level: Int = 1) - abstract fun appendParagraph(to: StringBuilder, text: String) - abstract fun appendLine(to: StringBuilder, text: String = "") - abstract fun appendAnchor(to: StringBuilder, anchor: String) - - abstract fun appendTable(to: StringBuilder, vararg columns: String, body: () -> Unit) - abstract fun appendTableBody(to: StringBuilder, body: () -> Unit) - abstract fun appendTableRow(to: StringBuilder, body: () -> Unit) - abstract fun appendTableCell(to: StringBuilder, body: () -> Unit) - - abstract fun formatText(text: String): String - abstract fun formatSymbol(text: String): String - abstract fun formatKeyword(text: String): String - abstract fun formatIdentifier(text: String, kind: IdentifierKind, signature: String?): String - fun formatEntity(text: String): String = text - abstract fun formatLink(text: String, href: String): String - open fun formatLink(link: FormatLink): String = formatLink(formatText(link.text), link.href) - abstract fun formatStrong(text: String): String - abstract fun formatStrikethrough(text: String): String - abstract fun formatEmphasis(text: String): String - abstract fun formatCode(code: String): String - abstract fun formatUnorderedList(text: String): String - abstract fun formatOrderedList(text: String): String - abstract fun formatListItem(text: String, kind: ListKind): String - abstract fun formatBreadcrumbs(items: Iterable): String - abstract fun formatNonBreakingSpace(): String - open fun formatSoftLineBreak(): String = "" - open fun formatIndentedSoftLineBreak(): String = "" - - open fun formatText(location: Location, nodes: Iterable, listKind: ListKind = ListKind.Unordered): String { - return nodes.map { formatText(location, it, listKind) }.joinToString("") + protected fun wrap(prefix: String, suffix: String, body: () -> Unit) { + to.append(prefix) + body() + to.append(suffix) + } + + protected fun wrapIfNotEmpty(prefix: String, suffix: String, body: () -> Unit, checkEndsWith: Boolean = false) { + val startLength = to.length + to.append(prefix) + body() + if (checkEndsWith && to.endsWith(suffix)) { + to.setLength(to.length - suffix.length) + } + else if (to.length > startLength + prefix.length) { + to.append(suffix) + } + else { + to.setLength(startLength) + } + } + + protected fun wrapInTag(tag: String, + body: () -> Unit, + newlineBeforeOpen: Boolean = false, + newlineAfterOpen: Boolean = false, + newlineAfterClose: Boolean = false) { + if (newlineBeforeOpen && !to.endsWith('\n')) to.appendln() + to.append("<$tag>") + if (newlineAfterOpen) to.appendln() + body() + to.append("") + if (newlineAfterClose) to.appendln() + } + + protected abstract fun ensureParagraph() + + abstract fun appendBlockCode(language: String, body: () -> Unit) + abstract fun appendHeader(level: Int = 1, body: () -> Unit) + abstract fun appendParagraph(body: () -> Unit) + abstract fun appendLine() + abstract fun appendAnchor(anchor: String) + + abstract fun appendTable(vararg columns: String, body: () -> Unit) + abstract fun appendTableBody(body: () -> Unit) + abstract fun appendTableRow(body: () -> Unit) + abstract fun appendTableCell(body: () -> Unit) + + abstract fun appendText(text: String) + + open fun appendSymbol(text: String) { + appendText(text) + } + + open fun appendKeyword(text: String) { + appendText(text) + } + + open fun appendIdentifier(text: String, kind: IdentifierKind, signature: String?) { + appendText(text) + } + + fun appendEntity(text: String) { + to.append(text) + } + + abstract fun appendLink(href: String, body: () -> Unit) + + open fun appendLink(link: FormatLink) { + appendLink(link.href) { appendText(link.text) } + } + + abstract fun appendStrong(body: () -> Unit) + abstract fun appendStrikethrough(body: () -> Unit) + abstract fun appendEmphasis(body: () -> Unit) + abstract fun appendCode(body: () -> Unit) + abstract fun appendUnorderedList(body: () -> Unit) + abstract fun appendOrderedList(body: () -> Unit) + abstract fun appendListItem(body: () -> Unit) + + abstract fun appendBreadcrumbSeparator() + abstract fun appendNonBreakingSpace() + open fun appendSoftLineBreak() { + } + + open fun appendIndentedSoftLineBreak() { } - fun formatText(location: Location, content: ContentNode, listKind: ListKind = ListKind.Unordered): String { - return StringBuilder().apply { formatText(location, content, this, listKind) }.toString() + fun appendContent(content: List) { + for (contentNode in content) { + appendContent(contentNode) + } } - open fun formatText(location: Location, content: ContentNode, to: StringBuilder, listKind: ListKind = ListKind.Unordered) { + open fun appendContent(content: ContentNode) { when (content) { - is ContentText -> to.append(formatText(content.text)) - is ContentSymbol -> to.append(formatSymbol(content.text)) - is ContentKeyword -> to.append(formatKeyword(content.text)) - is ContentIdentifier -> to.append(formatIdentifier(content.text, content.kind, content.signature)) - is ContentNonBreakingSpace -> to.append(formatNonBreakingSpace()) - is ContentSoftLineBreak -> to.append(formatSoftLineBreak()) - is ContentIndentedSoftLineBreak -> to.append(formatIndentedSoftLineBreak()) - is ContentEntity -> to.append(formatEntity(content.text)) - is ContentStrong -> to.append(formatStrong(formatText(location, content.children))) - is ContentStrikethrough -> to.append(formatStrikethrough(formatText(location, content.children))) - is ContentCode -> to.append(formatCode(formatText(location, content.children))) - is ContentEmphasis -> to.append(formatEmphasis(formatText(location, content.children))) - is ContentUnorderedList -> to.append(formatUnorderedList(formatText(location, content.children, ListKind.Unordered))) - is ContentOrderedList -> to.append(formatOrderedList(formatText(location, content.children, ListKind.Ordered))) - is ContentListItem -> to.append(formatListItem(formatText(location, content.children), listKind)) + is ContentText -> appendText(content.text) + is ContentSymbol -> appendSymbol(content.text) + is ContentKeyword -> appendKeyword(content.text) + is ContentIdentifier -> appendIdentifier(content.text, content.kind, content.signature) + is ContentNonBreakingSpace -> appendNonBreakingSpace() + is ContentSoftLineBreak -> appendSoftLineBreak() + is ContentIndentedSoftLineBreak -> appendIndentedSoftLineBreak() + is ContentEntity -> appendEntity(content.text) + is ContentStrong -> appendStrong { appendContent(content.children) } + is ContentStrikethrough -> appendStrikethrough { appendContent(content.children) } + is ContentCode -> appendCode { appendContent(content.children) } + is ContentEmphasis -> appendEmphasis { appendContent(content.children) } + is ContentUnorderedList -> appendUnorderedList { appendContent(content.children) } + is ContentOrderedList -> appendOrderedList { appendContent(content.children) } + is ContentListItem -> appendListItem { + val child = content.children.singleOrNull() + if (child is ContentParagraph) { + appendContent(child.children) + } + else { + appendContent(content.children) + } + } is ContentNodeLink -> { val node = content.node val linkTo = if (node != null) locationHref(location, node) else "#" - val linkText = formatText(location, content.children) - if (linkTo == ".") { - to.append(linkText) - } else { - to.append(formatLink(linkText, linkTo)) + appendLinkIfNotThisPage(linkTo, content) + } + is ContentExternalLink -> appendLinkIfNotThisPage(content.href, content) + + is ContentParagraph -> { + if (!content.isEmpty()) { + appendParagraph { appendContent(content.children) } } } - is ContentExternalLink -> { - val linkText = formatText(location, content.children) - if (content.href == ".") { - to.append(linkText) - } else { - to.append(formatLink(linkText, content.href)) + + is ContentBlockCode -> appendBlockCode(content.language) { + for ((index, contentNode) in content.children.withIndex()) { + appendContent(contentNode) + if (index < content.children.size - 1) { + to.append("\n") + } } } - is ContentParagraph -> appendParagraph(to, formatText(location, content.children)) - is ContentBlockCode -> appendBlockCode(to, content.children.map { formatText(location, it) }, content.language) - is ContentHeading -> appendHeader(to, formatText(location, content.children), content.level) - is ContentBlock -> to.append(formatText(location, content.children)) + is ContentHeading -> appendHeader(content.level) { appendContent(content.children) } + is ContentBlock -> appendContent(content.children) + } + } + + private fun appendLinkIfNotThisPage(href: String, content: ContentBlock) { + if (href == ".") { + appendContent(content.children) + } else { + appendLink(href) { appendContent(content.children) } } } @@ -120,7 +187,7 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, private fun DocumentationNode.isModuleOrPackage(): Boolean = kind == NodeKind.Module || kind == NodeKind.Package - protected open fun appendAsSignature(to: StringBuilder, node: ContentNode, block: () -> Unit) { + protected open fun appendAsSignature(node: ContentNode, block: () -> Unit) { block() } @@ -128,29 +195,40 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, block() } + protected open fun appendBreadcrumbs(path: Iterable) { + for ((index, item) in path.withIndex()) { + if (index > 0) { + appendBreadcrumbSeparator() + + } + appendLink(item) + } + } + fun Content.getSectionsWithSubjects(): Map> = sections.filter { it.subjectName != null }.groupBy { it.tag } - private fun ContentNode.signatureToText(location: Location): String { - return if (this is ContentBlock && this.isEmpty()) { - "" - } else { - val signatureAsCode = ContentCode() - signatureAsCode.append(this) - formatText(location, signatureAsCode) + private fun ContentNode.appendSignature() { + if (this is ContentBlock && this.isEmpty()) { + return } + + val signatureAsCode = ContentCode() + signatureAsCode.append(this) + appendContent(signatureAsCode) } open inner class PageBuilder(val nodes: Iterable) { open fun build() { val breakdownByLocation = nodes.groupBy { node -> - formatBreadcrumbs(node.path.filterNot { it.name.isEmpty() }.map { link(node, it) }) + node.path.filterNot { it.name.isEmpty() }.map { link(node, it) } } - for ((breadcrumbs, items) in breakdownByLocation) { - appendLine(to, breadcrumbs) - appendLine(to) - appendLocation(items.filter { it.kind != NodeKind.ExternalClass }) + for ((path, nodes) in breakdownByLocation) { + appendBreadcrumbs(path) + appendLine() + appendLine() + appendLocation(nodes.filter { it.kind != NodeKind.ExternalClass }) } } @@ -159,13 +237,13 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, if (singleNode != null && singleNode.isModuleOrPackage()) { if (singleNode.kind == NodeKind.Package) { val packageName = if (singleNode.name.isEmpty()) "" else singleNode.name - appendHeader(to, "Package " + formatText(packageName), 2) + appendHeader(2) { appendText("Package $packageName") } } - formatText(location, singleNode.content, to) + appendContent(singleNode.content) } else { val breakdownByName = nodes.groupBy { node -> node.name } for ((name, items) in breakdownByName) { - appendHeader(to, formatText(name)) + appendHeader { appendText(name) } appendDocumentation(items) } } @@ -178,6 +256,7 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, formatOverloadGroup(breakdownBySummary.values.single()) } else { for ((summary, items) in breakdownBySummary) { + ensureParagraph() appendAsOverloadGroup(to) { formatOverloadGroup(items) } @@ -186,44 +265,43 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } private fun formatOverloadGroup(items: List) { - items.forEach { - val rendered = languageService.render(it) - it.detailOrNull(NodeKind.Signature)?.let { - appendAnchor(to, it.name) + for ((index, item) in items.withIndex()) { + if (index > 0) appendLine() + val rendered = languageService.render(item) + item.detailOrNull(NodeKind.Signature)?.let { + appendAnchor(it.name) } - appendAsSignature(to, rendered) { - to.append(formatCode(formatText(location, rendered))) - it.appendSourceLink() + appendAsSignature(rendered) { + appendCode { appendContent(rendered) } + item.appendSourceLink() } - it.appendOverrides() - it.appendDeprecation() + item.appendOverrides() + item.appendDeprecation() } // All items have exactly the same documentation, so we can use any item to render it val item = items.first() item.details(NodeKind.OverloadGroupNote).forEach { - formatText(location, it.content, to) + appendContent(it.content) } - formatText(location, item.content.summary, to) + appendContent(item.content.summary) item.appendDescription() - appendLine(to) - appendLine(to) } private fun DocumentationNode.appendSourceLink() { val sourceUrl = details(NodeKind.SourceUrl).firstOrNull() if (sourceUrl != null) { to.append(" ") - appendLine(to, formatLink("(source)", sourceUrl.name)) - } else { - appendLine(to) + appendLink(sourceUrl.name) { to.append("(source)") } } } private fun DocumentationNode.appendOverrides() { overrides.forEach { - to.append("Overrides ") - val location = locationService.relativePathToLocation(this, it) - appendLine(to, formatLink(FormatLink(it.owner!!.name + "." + it.name, location))) + appendParagraph { + to.append("Overrides ") + val location = locationService.relativePathToLocation(this, it) + appendLink(FormatLink(it.owner!!.name + "." + it.name, location)) + } } } @@ -231,55 +309,52 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, if (deprecation != null) { val deprecationParameter = deprecation!!.details(NodeKind.Parameter).firstOrNull() val deprecationValue = deprecationParameter?.details(NodeKind.Value)?.firstOrNull() + appendLine() if (deprecationValue != null) { - to.append(formatStrong("Deprecated:")).append(" ") - appendLine(to, formatText(deprecationValue.name.removeSurrounding("\""))) - appendLine(to) + appendStrong { to.append("Deprecated:") } + appendText(" " + deprecationValue.name.removeSurrounding("\"")) + appendLine() + appendLine() } else if (deprecation?.content != Content.Empty) { - to.append(formatStrong("Deprecated:")).append(" ") - formatText(location, deprecation!!.content, to) + appendStrong { to.append("Deprecated:") } + to.append(" ") + appendContent(deprecation!!.content) } else { - appendLine(to, formatStrong("Deprecated")) - appendLine(to) + appendStrong { to.append("Deprecated") } + appendLine() + appendLine() } } } private fun DocumentationNode.appendDescription() { if (content.description != ContentEmpty) { - appendLine(to, formatText(location, content.description)) - appendLine(to) + appendContent(content.description) } content.getSectionsWithSubjects().forEach { appendSectionWithSubject(it.key, it.value) } for (section in content.sections.filter { it.subjectName == null }) { - val sectionText = buildString { - appendLine(this, formatStrong(formatText(section.tag))) - append(formatText(location, section)) + appendParagraph { + appendStrong { appendText(section.tag) } + appendLine() + appendContent(section) } - appendParagraph(to, sectionText) } } fun appendSectionWithSubject(title: String, subjectSections: List) { - appendHeader(to, title, 3) - var first: Boolean = true + appendHeader(3) { appendText(title) } subjectSections.forEach { val subjectName = it.subjectName if (subjectName != null) { - if (first) { - first = false - } - else { - appendLine(to) - } + ensureParagraph() - appendAnchor(to, subjectName) - to.append(formatCode(subjectName)).append(" - ") - formatText(location, it, to) - appendLine(to) + appendAnchor(subjectName) + appendCode { to.append(subjectName) } + to.append(" - ") + appendContent(it) } } } @@ -340,9 +415,9 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, node.inheritors.filter { it.kind != NodeKind.EnumItem }) if (node.kind == NodeKind.Module) { - appendHeader(to, "Index", 3) + appendHeader(3) { to.append("Index") } node.members(NodeKind.AllTypes).singleOrNull()?.let { allTypes -> - to.append(formatLink(link(node, allTypes, { "All Types" }))) + appendLink(link(node, allTypes, { "All Types" })) } } } @@ -350,25 +425,23 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, private fun appendSection(caption: String, members: List, sortMembers: Boolean = true) { if (members.isEmpty()) return - appendHeader(to, caption, 3) + appendHeader(3) { appendText(caption) } val children = if (sortMembers) members.sortedBy { it.name } else members val membersMap = children.groupBy { link(node, it) } - appendTable(to, "Name", "Summary") { - appendTableBody(to) { + appendTable("Name", "Summary") { + appendTableBody() { for ((memberLocation, members) in membersMap) { - appendTableRow(to) { - appendTableCell(to) { - to.append(formatLink(memberLocation)) + appendTableRow() { + appendTableCell { + appendLink(memberLocation) } - appendTableCell(to) { - val breakdownBySummary = members.groupBy { formatText(location, it.summary) } + appendTableCell { + val breakdownBySummary = members.groupBy { it.summary } for ((summary, items) in breakdownBySummary) { appendSummarySignatures(items) - if (!summary.isEmpty()) { - to.append(summary) - } + appendContent(summary) } } } @@ -380,19 +453,20 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, private fun appendSummarySignatures(items: List) { val summarySignature = languageService.summarizeSignatures(items) if (summarySignature != null) { - appendAsSignature(to, summarySignature) { - appendLine(to, summarySignature.signatureToText(location)) + appendAsSignature(summarySignature) { + summarySignature.appendSignature() } return } val renderedSignatures = items.map { languageService.render(it, RenderMode.SUMMARY) } renderedSignatures.subList(0, renderedSignatures.size - 1).forEach { - appendAsSignature(to, it) { - appendLine(to, it.signatureToText(location)) + appendAsSignature(it) { + it.appendSignature() } + appendLine() } - appendAsSignature(to, renderedSignatures.last()) { - to.append(renderedSignatures.last().signatureToText(location)) + appendAsSignature(renderedSignatures.last()) { + renderedSignatures.last().appendSignature() } } } @@ -401,26 +475,26 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, : PageBuilder(listOf(node)) { override fun build() { - to.append(formatText(location, node.owner!!.summary)) - appendHeader(to, "All Types", 3) + appendContent(node.owner!!.summary) + appendHeader(3) { to.append("All Types") } - appendTable(to, "Name", "Summary") { - appendTableBody(to) { + appendTable("Name", "Summary") { + appendTableBody() { for (type in node.members) { - appendTableRow(to) { - appendTableCell(to) { - to.append(formatLink(link(node, type) { + appendTableRow() { + appendTableCell { + appendLink(link(node, type) { if (it.kind == NodeKind.ExternalClass) it.name else it.qualifiedName() - })) + }) if (type.kind == NodeKind.ExternalClass) { val packageName = type.owner?.name if (packageName != null) { - to.append(formatText(" (extensions in package $packageName)")) + appendText(" (extensions in package $packageName)") } } } - appendTableCell(to) { - to.append(formatText(location, type.summary)) + appendTableCell { + appendContent(type.summary) } } } @@ -443,12 +517,11 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, PageBuilder(nodes).build() } } - } abstract class StructuredFormatService(locationService: LocationService, val languageService: LanguageService, override val extension: String, - val linkExtension: String = extension) : FormatService { + linkExtension: String = extension) : FormatService { val locationService: LocationService = locationService.withExtension(linkExtension) } diff --git a/core/src/main/kotlin/Java/JavadocParser.kt b/core/src/main/kotlin/Java/JavadocParser.kt index 1378a5a7..0fb98230 100644 --- a/core/src/main/kotlin/Java/JavadocParser.kt +++ b/core/src/main/kotlin/Java/JavadocParser.kt @@ -64,7 +64,7 @@ class JavadocParser(private val refGraph: NodeReferenceGraph) : JavaDocumentatio htmlBuilder.append(it.text) } } - val doc = Jsoup.parse(htmlBuilder.toString().trimStart()) + val doc = Jsoup.parse(htmlBuilder.toString().trim()) doc.body().childNodes().forEach { convertHtmlNode(it) } diff --git a/core/src/test/kotlin/format/GFMFormatTest.kt b/core/src/test/kotlin/format/GFMFormatTest.kt index d21885d3..5327c9dc 100644 --- a/core/src/test/kotlin/format/GFMFormatTest.kt +++ b/core/src/test/kotlin/format/GFMFormatTest.kt @@ -11,6 +11,10 @@ class GFMFormatTest { verifyGFMNodeByName("sample", "Foo") } + @Test fun listInTableCell() { + verifyGFMNodeByName("listInTableCell", "Foo") + } + private fun verifyGFMNodeByName(fileName: String, name: String) { verifyOutput("testdata/format/gfm/$fileName.kt", ".md") { model, output -> gfmService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members.filter { it.name == name }) diff --git a/core/src/test/kotlin/model/JavaTest.kt b/core/src/test/kotlin/model/JavaTest.kt index a3a3f772..a89b7a11 100644 --- a/core/src/test/kotlin/model/JavaTest.kt +++ b/core/src/test/kotlin/model/JavaTest.kt @@ -17,12 +17,12 @@ public class JavaTest { with(content.sections[0]) { assertEquals("Parameters", tag) assertEquals("name", subjectName) - assertEquals("is String parameter ", toTestString()) + assertEquals("is String parameter", toTestString()) } with(content.sections[1]) { assertEquals("Parameters", tag) assertEquals("value", subjectName) - assertEquals("is int parameter ", toTestString()) + assertEquals("is int parameter", toTestString()) } with(content.sections[2]) { assertEquals("Author", tag) diff --git a/core/testdata/format/accessor.md b/core/testdata/format/accessor.md index eb326727..dcdef0f8 100644 --- a/core/testdata/format/accessor.md +++ b/core/testdata/format/accessor.md @@ -1,6 +1,5 @@ [test](test/index) / [C](test/-c/index) / [x](test/-c/x) - # x `var x: String` @@ -9,14 +8,7 @@ The getter returns an empty string. - - - **Setter** The setter does nothing. - - - - diff --git a/core/testdata/format/annotatedTypeParameter.md b/core/testdata/format/annotatedTypeParameter.md index 7d26a162..0aa1b9d7 100644 --- a/core/testdata/format/annotatedTypeParameter.md +++ b/core/testdata/format/annotatedTypeParameter.md @@ -1,8 +1,5 @@ [test](test/index) / [containsAll](test/contains-all) - # containsAll -`fun <E> containsAll(elements: Collection<@UnsafeVariance E>): @UnsafeVariance E` - - +`fun containsAll(elements: Collection<@UnsafeVariance E>): @UnsafeVariance E` \ No newline at end of file diff --git a/core/testdata/format/annotationClass.md b/core/testdata/format/annotationClass.md index 03548aa3..2f4da736 100644 --- a/core/testdata/format/annotationClass.md +++ b/core/testdata/format/annotationClass.md @@ -1,14 +1,10 @@ [test](test/index) / [fancy](test/fancy/index) - # fancy `annotation class fancy` - - ### Constructors - | [<init>](test/fancy/-init-) | `fancy()` | diff --git a/core/testdata/format/annotationClass.package.md b/core/testdata/format/annotationClass.package.md index f7c8405d..f52b28b6 100644 --- a/core/testdata/format/annotationClass.package.md +++ b/core/testdata/format/annotationClass.package.md @@ -1,11 +1,8 @@ [test](test/index) - ## Package <root> - ### Annotations - | [fancy](test/fancy/index) | `annotation class fancy` | diff --git a/core/testdata/format/annotationParams.md b/core/testdata/format/annotationParams.md index 8cdd6e96..132078ce 100644 --- a/core/testdata/format/annotationParams.md +++ b/core/testdata/format/annotationParams.md @@ -1,8 +1,5 @@ [test](test/index) / [f](test/f) - # f -`@JvmName("FFF") fun f(): Unit` - - +`@JvmName("FFF") fun f(): Unit` \ No newline at end of file diff --git a/core/testdata/format/annotations.md b/core/testdata/format/annotations.md index b898d55c..cc27d5af 100644 --- a/core/testdata/format/annotations.md +++ b/core/testdata/format/annotations.md @@ -1,26 +1,18 @@ [test](test/index) / [Foo](test/-foo/index) - # Foo `data class Foo` - - ### Constructors - | [<init>](test/-foo/-init-) | `Foo()` | - ### Properties - | [x](test/-foo/x) | `val x: Int` | - ### Functions - -| [bar](test/-foo/bar) | `fun bar(notInlined: () -> Unit): Unit` | +| [bar](test/-foo/bar) | `fun bar(notInlined: () -> Unit): Unit` | diff --git a/core/testdata/format/arrayAverage.md b/core/testdata/format/arrayAverage.md index 9ffa3650..7cc31c47 100644 --- a/core/testdata/format/arrayAverage.md +++ b/core/testdata/format/arrayAverage.md @@ -1,25 +1,14 @@ [test](test/index) / [XArray](test/-x-array/index) - # XArray -`class XArray<T>` - - +`class XArray` ### Constructors - | [<init>](test/-x-array/-init-) | `XArray()` | - ### Extension Functions - -| [average](test/average) | `fun [XArray](test/-x-array/index)<out Byte>.average(): Double` -`fun [XArray](test/-x-array/index)<out Double>.average(): Double` -`fun [XArray](test/-x-array/index)<out Float>.average(): Double` -`fun [XArray](test/-x-array/index)<out Int>.average(): Double` -`fun [XArray](test/-x-array/index)<out Long>.average(): Double` -`fun [XArray](test/-x-array/index)<out Short>.average(): Double` | +| [average](test/average) | `fun `[`XArray`](test/-x-array/index)`.average(): Double`
    `fun `[`XArray`](test/-x-array/index)`.average(): Double`
    `fun `[`XArray`](test/-x-array/index)`.average(): Double`
    `fun `[`XArray`](test/-x-array/index)`.average(): Double`
    `fun `[`XArray`](test/-x-array/index)`.average(): Double`
    `fun `[`XArray`](test/-x-array/index)`.average(): Double` | diff --git a/core/testdata/format/bracket.html b/core/testdata/format/bracket.html index f96c6459..8f4310c3 100644 --- a/core/testdata/format/bracket.html +++ b/core/testdata/format/bracket.html @@ -7,9 +7,7 @@

    foo

    -fun foo(): Unit
    +fun foo(): Unit

    bar[]

    -
    -
    diff --git a/core/testdata/format/brokenLink.html b/core/testdata/format/brokenLink.html index 860ffc26..8803781a 100644 --- a/core/testdata/format/brokenLink.html +++ b/core/testdata/format/brokenLink.html @@ -7,9 +7,7 @@

    f

    -fun f(): Unit
    +fun f(): Unit

    This references noSuchIdentifier.

    -
    -
    diff --git a/core/testdata/format/classWithCompanionObject.html b/core/testdata/format/classWithCompanionObject.html index 679420bd..376bae9b 100644 --- a/core/testdata/format/classWithCompanionObject.html +++ b/core/testdata/format/classWithCompanionObject.html @@ -6,9 +6,7 @@ test / Klass

    Klass

    -class Klass
    -
    -
    +class Klass

    Constructors

    diff --git a/core/testdata/format/classWithCompanionObject.md b/core/testdata/format/classWithCompanionObject.md index 9398c3d3..45684c0e 100644 --- a/core/testdata/format/classWithCompanionObject.md +++ b/core/testdata/format/classWithCompanionObject.md @@ -1,26 +1,18 @@ [test](test/index) / [Klass](test/-klass/index) - # Klass `class Klass` - - ### Constructors - | [<init>](test/-klass/-init-) | `Klass()` | - ### Companion Object Properties - | [x](test/-klass/x) | `val x: Int` | - ### Companion Object Functions - | [foo](test/-klass/foo) | `fun foo(): Unit` | diff --git a/core/testdata/format/codeBlock.md b/core/testdata/format/codeBlock.md index 08710390..016ea9e8 100644 --- a/core/testdata/format/codeBlock.md +++ b/core/testdata/format/codeBlock.md @@ -1,31 +1,19 @@ [test](test/index) / [Throws](test/-throws/index) - # Throws `class Throws` This annotation indicates what exceptions should be declared by a function when compiled to a JVM method. - Example: - ``` Throws(IOException::class) fun readFile(name: String): String {...} ``` - - - - - ### Constructors - -| [<init>](test/-throws/-init-) | `Throws()` -This annotation indicates what exceptions should be declared by a function when compiled to a JVM method. - - | +| [<init>](test/-throws/-init-) | `Throws()`
    This annotation indicates what exceptions should be declared by a function when compiled to a JVM method. | diff --git a/core/testdata/format/codeSpan.html b/core/testdata/format/codeSpan.html index 216a15e9..f28e6957 100644 --- a/core/testdata/format/codeSpan.html +++ b/core/testdata/format/codeSpan.html @@ -7,9 +7,7 @@

    foo

    -fun foo(): Unit
    +fun foo(): Unit

    This is a code span.

    -
    -
    diff --git a/core/testdata/format/companionObjectExtension.md b/core/testdata/format/companionObjectExtension.md index 271da5b0..e019c184 100644 --- a/core/testdata/format/companionObjectExtension.md +++ b/core/testdata/format/companionObjectExtension.md @@ -1,23 +1,14 @@ [test](test/index) / [Foo](test/-foo/index) - # Foo `class Foo` - - ### Constructors - | [<init>](test/-foo/-init-) | `Foo()` | - ### Companion Object Extension Properties - -| [x](test/x) | `val Foo.Default.x: Int` -The default object property. - - | +| [x](test/x) | `val Foo.Default.x: Int`
    The default object property. | diff --git a/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html b/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html index 295366b3..ca0725a0 100644 --- a/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html +++ b/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html @@ -6,10 +6,8 @@ test / test / Bar

    Bar

    -class Bar : Foo
    +class Bar : Foo

    See xyzzy

    -
    -

    Constructors

    @@ -17,7 +15,8 @@ diff --git a/core/testdata/format/deprecated.class.html b/core/testdata/format/deprecated.class.html index 71470c63..4d998c69 100644 --- a/core/testdata/format/deprecated.class.html +++ b/core/testdata/format/deprecated.class.html @@ -8,8 +8,6 @@ class C
    Deprecated: This class sucks

    -
    -
    test / f

    f

    @@ -17,8 +15,6 @@ fun f(): Unit
    Deprecated: This function sucks

    -
    -
    test / p

    p

    @@ -26,7 +22,5 @@ val p: Int
    Deprecated: This property sucks

    -
    -
    diff --git a/core/testdata/format/emptyDescription.md b/core/testdata/format/emptyDescription.md index e82e7228..8c0fe109 100644 --- a/core/testdata/format/emptyDescription.md +++ b/core/testdata/format/emptyDescription.md @@ -1,11 +1,8 @@ [test](test/index) / [fn](test/fn) - # fn `fun fn(): Unit` Function fn - - diff --git a/core/testdata/format/entity.html b/core/testdata/format/entity.html index 9c778020..db6f833f 100644 --- a/core/testdata/format/entity.html +++ b/core/testdata/format/entity.html @@ -6,10 +6,8 @@ test / Bar

    Bar

    -class Bar
    +class Bar

    Copyright © JetBrains 2015 "

    -
    -

    Constructors

    <init> -Bar()

    See xyzzy

    +Bar() +

    See xyzzy

    @@ -17,7 +15,8 @@ diff --git a/core/testdata/format/enumClass.md b/core/testdata/format/enumClass.md index 4f390dab..d3a6f186 100644 --- a/core/testdata/format/enumClass.md +++ b/core/testdata/format/enumClass.md @@ -1,15 +1,11 @@ [test](test/index) / [InlineOption](test/-inline-option/index) - # InlineOption `enum class InlineOption` - - ### Enum Values - | [ONLY_LOCAL_RETURN](test/-inline-option/-o-n-l-y_-l-o-c-a-l_-r-e-t-u-r-n) | | | [LOCAL_CONTINUE_AND_BREAK](test/-inline-option/-l-o-c-a-l_-c-o-n-t-i-n-u-e_-a-n-d_-b-r-e-a-k) | | diff --git a/core/testdata/format/enumClass.value.md b/core/testdata/format/enumClass.value.md index bcb685d1..feed2fe5 100644 --- a/core/testdata/format/enumClass.value.md +++ b/core/testdata/format/enumClass.value.md @@ -1,8 +1,5 @@ [test](test/index) / [InlineOption](test/-inline-option/index) / [LOCAL_CONTINUE_AND_BREAK](test/-inline-option/-l-o-c-a-l_-c-o-n-t-i-n-u-e_-a-n-d_-b-r-e-a-k) - # LOCAL_CONTINUE_AND_BREAK -`LOCAL_CONTINUE_AND_BREAK` - - +`LOCAL_CONTINUE_AND_BREAK` \ No newline at end of file diff --git a/core/testdata/format/exceptionClass.md b/core/testdata/format/exceptionClass.md index b3464d6f..df3457d7 100644 --- a/core/testdata/format/exceptionClass.md +++ b/core/testdata/format/exceptionClass.md @@ -1,14 +1,10 @@ [test](test/index) / [MyException](test/-my-exception/index) - # MyException -`class MyException : [Exception](http://docs.oracle.com/javase/6/docs/api/java/lang/Exception.html)` - - +`class MyException : `[`Exception`](http://docs.oracle.com/javase/6/docs/api/java/lang/Exception.html) ### Constructors - | [<init>](test/-my-exception/-init-) | `MyException()` | diff --git a/core/testdata/format/exceptionClass.package.md b/core/testdata/format/exceptionClass.package.md index fa220fe7..e27dd0ab 100644 --- a/core/testdata/format/exceptionClass.package.md +++ b/core/testdata/format/exceptionClass.package.md @@ -1,11 +1,8 @@ [test](test/index) - ## Package <root> - ### Exceptions - -| [MyException](test/-my-exception/index) | `class MyException : [Exception](http://docs.oracle.com/javase/6/docs/api/java/lang/Exception.html)` | +| [MyException](test/-my-exception/index) | `class MyException : `[`Exception`](http://docs.oracle.com/javase/6/docs/api/java/lang/Exception.html) | diff --git a/core/testdata/format/extensionFunctionParameter.md b/core/testdata/format/extensionFunctionParameter.md index 6980912d..b459d49e 100644 --- a/core/testdata/format/extensionFunctionParameter.md +++ b/core/testdata/format/extensionFunctionParameter.md @@ -1,8 +1,5 @@ [test](test/index) / [apply](test/apply) - # apply -`inline fun <T> T.apply(f: T.() -> Unit): T` - - +`inline fun T.apply(f: T.() -> Unit): T` \ No newline at end of file diff --git a/core/testdata/format/extensionWithDocumentedReceiver.md b/core/testdata/format/extensionWithDocumentedReceiver.md index 6fd179c6..125da37e 100644 --- a/core/testdata/format/extensionWithDocumentedReceiver.md +++ b/core/testdata/format/extensionWithDocumentedReceiver.md @@ -1,15 +1,11 @@ [test](test/index) / [kotlin.String](test/kotlin.-string/index) / [fn](test/kotlin.-string/fn) - # fn `fun String.fn(): Unit` Function with receiver - **Receiver** must be a non-empty string - - diff --git a/core/testdata/format/extensions.class.md b/core/testdata/format/extensions.class.md index c66cdb01..f75b4dc8 100644 --- a/core/testdata/format/extensions.class.md +++ b/core/testdata/format/extensions.class.md @@ -1,16 +1,7 @@ [test](test/index) / [foo](test/foo/index) / [kotlin.String](test/foo/kotlin.-string/index) - ### Extensions for kotlin.String - -| [fn](test/foo/kotlin.-string/fn) | `fun String.fn(): Unit` -`fun String.fn(x: Int): Unit` -Function with receiver - - | -| [foobar](test/foo/kotlin.-string/foobar) | `val String.foobar: Int` -Property with receiver. - - | +| [fn](test/foo/kotlin.-string/fn) | `fun String.fn(): Unit`
    `fun String.fn(x: Int): Unit`
    Function with receiver | +| [foobar](test/foo/kotlin.-string/foobar) | `val String.foobar: Int`
    Property with receiver. | diff --git a/core/testdata/format/extensions.package.md b/core/testdata/format/extensions.package.md index 76ff3676..4dc0cfab 100644 --- a/core/testdata/format/extensions.package.md +++ b/core/testdata/format/extensions.package.md @@ -1,11 +1,8 @@ [test](test/index) / [foo](test/foo/index) - ## Package foo - ### Extensions for External Classes - | [kotlin.String](test/foo/kotlin.-string/index) | | diff --git a/core/testdata/format/functionWithDefaultParameter.md b/core/testdata/format/functionWithDefaultParameter.md index 21e9eff7..568c106c 100644 --- a/core/testdata/format/functionWithDefaultParameter.md +++ b/core/testdata/format/functionWithDefaultParameter.md @@ -1,8 +1,5 @@ [test](test/index) / [f](test/f) - # f -`fun f(x: String = ""): Unit` - - +`fun f(x: String = ""): Unit` \ No newline at end of file diff --git a/core/testdata/format/genericInheritedExtensions.md b/core/testdata/format/genericInheritedExtensions.md index e02683a9..a3091aeb 100644 --- a/core/testdata/format/genericInheritedExtensions.md +++ b/core/testdata/format/genericInheritedExtensions.md @@ -1,21 +1,15 @@ [test](test/index) / [Bar](test/-bar/index) - # Bar -`class Bar<T> : [Foo](test/-foo/index)<T>` - - +`class Bar : `[`Foo`](test/-foo/index)`` ### Constructors - | [<init>](test/-bar/-init-) | `Bar()` | - ### Extension Functions - -| [first](test/first) | `fun <T> [Foo](test/-foo/index)<T>.first(): Unit` | -| [second](test/second) | `fun <T> [Bar](test/-bar/index)<T>.second(): Unit` | +| [first](test/first) | `fun `[`Foo`](test/-foo/index)`.first(): Unit` | +| [second](test/second) | `fun `[`Bar`](test/-bar/index)`.second(): Unit` | diff --git a/core/testdata/format/gfm/listInTableCell.kt b/core/testdata/format/gfm/listInTableCell.kt new file mode 100644 index 00000000..2f4fdf54 --- /dev/null +++ b/core/testdata/format/gfm/listInTableCell.kt @@ -0,0 +1,8 @@ +class Foo { + /** + * 1. Foo + * 1. Bar + */ + fun foo() { + } +} diff --git a/core/testdata/format/gfm/listInTableCell.md b/core/testdata/format/gfm/listInTableCell.md new file mode 100644 index 00000000..73152ac9 --- /dev/null +++ b/core/testdata/format/gfm/listInTableCell.md @@ -0,0 +1,17 @@ +[test](test/index) / [Foo](test/-foo/index) + +# Foo + +`class Foo` + +### Constructors + +| Name | Summary | +|---|---| +| [<init>](test/-foo/-init-) | `Foo()` | + +### Functions + +| Name | Summary | +|---|---| +| [foo](test/-foo/foo) | `fun foo(): Unit`
    1. Foo
    2. Bar
    | diff --git a/core/testdata/format/gfm/sample.md b/core/testdata/format/gfm/sample.md index 1a26e599..c2af1c1e 100644 --- a/core/testdata/format/gfm/sample.md +++ b/core/testdata/format/gfm/sample.md @@ -1,33 +1,20 @@ [test](test/index) / [Foo](test/-foo/index) - # Foo `class Foo` The class Foo. - - - ### Constructors | Name | Summary | |---|---| -| [<init>](test/-foo/-init-) | `Foo()` -The class Foo. - - | +| [<init>](test/-foo/-init-) | `Foo()`
    The class Foo. | ### Functions | Name | Summary | |---|---| -| [bar](test/-foo/bar) | `fun bar(): Unit` -The method bar. - - | -| [baz](test/-foo/baz) | `fun baz(): Unit` -The method baz. - - | +| [bar](test/-foo/bar) | `fun bar(): Unit`
    The method bar. | +| [baz](test/-foo/baz) | `fun baz(): Unit`
    The method baz. | diff --git a/core/testdata/format/htmlEscaping.html b/core/testdata/format/htmlEscaping.html index ad8a7bed..7ddcec8e 100644 --- a/core/testdata/format/htmlEscaping.html +++ b/core/testdata/format/htmlEscaping.html @@ -7,9 +7,7 @@

    x

    -fun <T> x(): T?
    +fun <T> x(): T?

    Special characters: < is "less than", > is "greater than", & is "ampersand"

    -
    -
    diff --git a/core/testdata/format/inapplicableExtensionFunctions.md b/core/testdata/format/inapplicableExtensionFunctions.md index 8460cf2f..30246faa 100644 --- a/core/testdata/format/inapplicableExtensionFunctions.md +++ b/core/testdata/format/inapplicableExtensionFunctions.md @@ -1,20 +1,14 @@ [test](test/index) / [Bar](test/-bar/index) - # Bar -`class Bar : [Foo](test/-foo/index)<Char>` - - +`class Bar : `[`Foo`](test/-foo/index)`` ### Constructors - | [<init>](test/-bar/-init-) | `Bar()` | - ### Extension Functions - -| [xyzzy](test/xyzzy) | `fun [Bar](test/-bar/index).xyzzy(): Unit` | +| [xyzzy](test/xyzzy) | `fun `[`Bar`](test/-bar/index)`.xyzzy(): Unit` | diff --git a/core/testdata/format/inheritedCompanionObjectProperties.md b/core/testdata/format/inheritedCompanionObjectProperties.md index 9ec24edb..b3b3230e 100644 --- a/core/testdata/format/inheritedCompanionObjectProperties.md +++ b/core/testdata/format/inheritedCompanionObjectProperties.md @@ -1,38 +1,26 @@ [test](test/index) / [C](test/-c/index) - # C -`class C : [A](test/-a/index)` - - +`class C : `[`A`](test/-a/index) ### Constructors - | [<init>](test/-c/-init-) | `C()` | - ### Functions - | [xyzzy](test/-c/xyzzy) | `fun xyzzy(): Unit` | - ### Inherited Functions - | [foo](test/-a/foo) | `fun foo(): Unit` | - ### Companion Object Functions - | [shazam](test/-c/shazam) | `fun shazam(): Unit` | - ### Inherited Companion Object Functions - | [bar](test/-b/bar) | `fun bar(): Unit` | diff --git a/core/testdata/format/inheritedExtensions.md b/core/testdata/format/inheritedExtensions.md index 79137eac..611b4f6a 100644 --- a/core/testdata/format/inheritedExtensions.md +++ b/core/testdata/format/inheritedExtensions.md @@ -1,21 +1,15 @@ [test](test/index) / [Bar](test/-bar/index) - # Bar -`class Bar : [Foo](test/-foo/index)` - - +`class Bar : `[`Foo`](test/-foo/index) ### Constructors - | [<init>](test/-bar/-init-) | `Bar()` | - ### Extension Functions - -| [first](test/first) | `fun [Foo](test/-foo/index).first(): Unit` | -| [second](test/second) | `fun [Bar](test/-bar/index).second(): Unit` | +| [first](test/first) | `fun `[`Foo`](test/-foo/index)`.first(): Unit` | +| [second](test/second) | `fun `[`Bar`](test/-bar/index)`.second(): Unit` | diff --git a/core/testdata/format/inheritedMembers.md b/core/testdata/format/inheritedMembers.md index d58d3974..bed5bd44 100644 --- a/core/testdata/format/inheritedMembers.md +++ b/core/testdata/format/inheritedMembers.md @@ -1,38 +1,26 @@ [test](test/index) / [Bar](test/-bar/index) - # Bar -`class Bar : [Foo](test/-foo/index)` - - +`class Bar : `[`Foo`](test/-foo/index) ### Constructors - | [<init>](test/-bar/-init-) | `Bar()` | - ### Properties - | [secondProp](test/-bar/second-prop) | `val secondProp: Int` | - ### Inherited Properties - | [firstProp](test/-foo/first-prop) | `val firstProp: Int` | - ### Functions - | [second](test/-bar/second) | `fun second(): Unit` | - ### Inherited Functions - | [first](test/-foo/first) | `fun first(): Unit` | diff --git a/core/testdata/format/javaCodeInParam.md b/core/testdata/format/javaCodeInParam.md index 02d5d974..696abdc4 100644 --- a/core/testdata/format/javaCodeInParam.md +++ b/core/testdata/format/javaCodeInParam.md @@ -1,24 +1,14 @@ [test](test/index) / [C](test/-c/index) - # C -`protected open class C<T : Any>` - - - +`protected open class C` ### Parameters `T` - this is `some code` and other text - - ### Constructors - -| [<init>](test/-c/-init-) | `C()` - - - | +| [<init>](test/-c/-init-) | `C()` | diff --git a/core/testdata/format/javaCodeLiteralTags.md b/core/testdata/format/javaCodeLiteralTags.md index a705a01c..99dbccfd 100644 --- a/core/testdata/format/javaCodeLiteralTags.md +++ b/core/testdata/format/javaCodeLiteralTags.md @@ -1,32 +1,16 @@ [test](test/index) / [C](test/-c/index) - # C `protected open class C` - -`A<B>C` - - -A<B>C - - - +`AC` -### Constructors - - -| [<init>](test/-c/-init-) | `C()` - -`A<B>C` - - A<B>C - +### Constructors - | +| [<init>](test/-c/-init-) | `C()`
    `AC`
    A<B>C | diff --git a/core/testdata/format/javaDeprecated.html b/core/testdata/format/javaDeprecated.html index 35c0b820..619a3d5a 100644 --- a/core/testdata/format/javaDeprecated.html +++ b/core/testdata/format/javaDeprecated.html @@ -8,8 +8,6 @@

    foo

    open fun foo(): Unit
    -Deprecated: use #bar instead

    -
    -
    +Deprecated: use #bar instead diff --git a/core/testdata/format/javaLinkTag.html b/core/testdata/format/javaLinkTag.html index 997e52ab..20940cc2 100644 --- a/core/testdata/format/javaLinkTag.html +++ b/core/testdata/format/javaLinkTag.html @@ -6,10 +6,8 @@ test / Foo

    Foo

    -protected open class Foo
    -

    Call #bar() to do the job.

    -
    -
    +protected open class Foo +

    Call #bar() to do the job.

    Constructors

    <init> -Bar()

    Copyright © JetBrains 2015 "

    +Bar() +

    Copyright © JetBrains 2015 "

    @@ -17,7 +15,8 @@ diff --git a/core/testdata/format/javaLinkTagWithLabel.html b/core/testdata/format/javaLinkTagWithLabel.html index fdddadf9..9194229a 100644 --- a/core/testdata/format/javaLinkTagWithLabel.html +++ b/core/testdata/format/javaLinkTagWithLabel.html @@ -6,10 +6,8 @@ test / Foo

    Foo

    -protected open class Foo
    -

    Call this wonderful method to do the job.

    -
    -
    +protected open class Foo +

    Call this wonderful method to do the job.

    Constructors

    <init> -Foo()

    Call #bar() to do the job.

    +Foo() +

    Call #bar() to do the job.

    @@ -17,7 +15,8 @@ diff --git a/core/testdata/format/javaSeeTag.html b/core/testdata/format/javaSeeTag.html index e22e8452..607375fc 100644 --- a/core/testdata/format/javaSeeTag.html +++ b/core/testdata/format/javaSeeTag.html @@ -6,12 +6,9 @@ test / Foo

    Foo

    -open class Foo
    -

    +open class Foo

    See Also
    #bar

    -
    -

    Constructors

    <init> -Foo()

    Call this wonderful method to do the job.

    +Foo() +

    Call this wonderful method to do the job.

    @@ -19,8 +16,7 @@ +Foo()
    <init> -Foo()

    -
    diff --git a/core/testdata/format/javaSpaceInAuthor.md b/core/testdata/format/javaSpaceInAuthor.md index ddaaa35d..6d738087 100644 --- a/core/testdata/format/javaSpaceInAuthor.md +++ b/core/testdata/format/javaSpaceInAuthor.md @@ -1,24 +1,13 @@ [test](test/index) / [C](test/-c/index) - # C `protected open class C` - - - **Author** Dmitry Jemerov - - - ### Constructors - -| [<init>](test/-c/-init-) | `C()` - - - | +| [<init>](test/-c/-init-) | `C()` | diff --git a/core/testdata/format/javaSupertype.html b/core/testdata/format/javaSupertype.html index b2676459..421fe7a0 100644 --- a/core/testdata/format/javaSupertype.html +++ b/core/testdata/format/javaSupertype.html @@ -6,9 +6,7 @@ test / C / Bar

    Bar

    -open class Bar : Foo
    -
    -
    +open class Bar : Foo

    Constructors

    diff --git a/core/testdata/format/javadocHtml.md b/core/testdata/format/javadocHtml.md index 15b86bb4..8aba2059 100644 --- a/core/testdata/format/javadocHtml.md +++ b/core/testdata/format/javadocHtml.md @@ -1,40 +1,28 @@ [test](test/index) / [C](test/-c/index) - # C `open class C` -**Bold** **Strong** *Italic* *Emphasized* +**Bold** **Strong** *Italic* *Emphasized* + Paragraph - ~~Strikethrough~~ ~~Deleted~~ `Code` + ~~Strikethrough~~ ~~Deleted~~ `Code` + ``` Block code ``` * List Item - - - - - ### Constructors +| [<init>](test/-c/-init-) | `C()`
    **Bold** **Strong** *Italic* *Emphasized*
    Paragraph ~~Strikethrough~~ ~~Deleted~~ `Code` -| [<init>](test/-c/-init-) | `C()` -**Bold** **Strong** *Italic* *Emphasized* -Paragraph - - ~~Strikethrough~~ ~~Deleted~~ `Code` -``` -Block code ``` - - * List Item - - - - | +Block code
    ``` +
    +* List Item +
    | diff --git a/core/testdata/format/javadocOrderedList.md b/core/testdata/format/javadocOrderedList.md index 415e3479..00aa1bc4 100644 --- a/core/testdata/format/javadocOrderedList.md +++ b/core/testdata/format/javadocOrderedList.md @@ -1,26 +1,17 @@ [test](test/index) / [Bar](test/-bar/index) - # Bar `open class Bar` 1. Rinse 1. Repeat - - - - ### Constructors - -| [<init>](test/-bar/-init-) | `Bar()` - 1. Rinse +| [<init>](test/-bar/-init-) | `Bar()`
    +1. Rinse 1. Repeat - - - - | +
    | diff --git a/core/testdata/format/jdkLinks.md b/core/testdata/format/jdkLinks.md index 4f0344b5..460d3e32 100644 --- a/core/testdata/format/jdkLinks.md +++ b/core/testdata/format/jdkLinks.md @@ -1,20 +1,12 @@ [test](test/index) / [C](test/-c/index) - # C -`class C : [ClassLoader](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html)` +`class C : `[`ClassLoader`](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html) This is a [ClassLoader](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html) and I can get its [ClassLoader.getResource](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)) - - - ### Constructors - -| [<init>](test/-c/-init-) | `C()` -This is a [ClassLoader](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html) and I can get its [ClassLoader.getResource](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)) - - | +| [<init>](test/-c/-init-) | `C()`
    This is a [ClassLoader](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html) and I can get its [ClassLoader.getResource](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)) | diff --git a/core/testdata/format/linkWithLabel.html b/core/testdata/format/linkWithLabel.html index 32499d6f..8c7d228c 100644 --- a/core/testdata/format/linkWithLabel.html +++ b/core/testdata/format/linkWithLabel.html @@ -6,10 +6,8 @@ test / Bar

    Bar

    -class Bar
    +class Bar

    Use this method for best results.

    -
    -

    Constructors

    @@ -17,7 +15,8 @@ diff --git a/core/testdata/format/linkWithStarProjection.html b/core/testdata/format/linkWithStarProjection.html index 0e829e80..c810f3f4 100644 --- a/core/testdata/format/linkWithStarProjection.html +++ b/core/testdata/format/linkWithStarProjection.html @@ -6,9 +6,7 @@ test / KClassLoader

    KClassLoader

    -object KClassLoader
    -
    -
    +object KClassLoader

    Functions

    <init> -Bar()

    Use this method for best results.

    +Bar() +

    Use this method for best results.

    diff --git a/core/testdata/format/markdownInLinks.html b/core/testdata/format/markdownInLinks.html index 38158eac..46c2944a 100644 --- a/core/testdata/format/markdownInLinks.html +++ b/core/testdata/format/markdownInLinks.html @@ -7,9 +7,7 @@

    foo

    -fun foo(): Unit
    +fun foo(): Unit

    abdkas

    -
    -
    diff --git a/core/testdata/format/multipleTypeParameterConstraints.md b/core/testdata/format/multipleTypeParameterConstraints.md index 537b127a..14f048f4 100644 --- a/core/testdata/format/multipleTypeParameterConstraints.md +++ b/core/testdata/format/multipleTypeParameterConstraints.md @@ -1,8 +1,5 @@ [test](test/index) / [f](test/f) - # f -`fun <T> f(): Unit where T : [Appendable](http://docs.oracle.com/javase/6/docs/api/java/lang/Appendable.html), T : CharSequence` - - +`fun f(): Unit where T : `[`Appendable`](http://docs.oracle.com/javase/6/docs/api/java/lang/Appendable.html)`, T : CharSequence` \ No newline at end of file diff --git a/core/testdata/format/nullability.md b/core/testdata/format/nullability.md index ee50a0a5..6a4c3761 100644 --- a/core/testdata/format/nullability.md +++ b/core/testdata/format/nullability.md @@ -1,20 +1,14 @@ [test](test/index) / [C](test/-c/index) - # C -`class C<T>` - - +`class C` ### Constructors - | [<init>](test/-c/-init-) | `C()` | - ### Functions - -| [foo](test/-c/foo) | `fun foo(): Comparable<T>?` | +| [foo](test/-c/foo) | `fun foo(): Comparable?` | diff --git a/core/testdata/format/operatorOverloading.md b/core/testdata/format/operatorOverloading.md index 05fe3206..8e8d36eb 100644 --- a/core/testdata/format/operatorOverloading.md +++ b/core/testdata/format/operatorOverloading.md @@ -1,8 +1,5 @@ [test](test/index) / [C](test/-c/index) / [plus](test/-c/plus) - # plus -`fun plus(other: [C](test/-c/index)): [C](test/-c/index)` - - +`fun plus(other: `[`C`](test/-c/index)`): `[`C`](test/-c/index) \ No newline at end of file diff --git a/core/testdata/format/orderedList.html b/core/testdata/format/orderedList.html index 6b5fa007..518fbf5a 100644 --- a/core/testdata/format/orderedList.html +++ b/core/testdata/format/orderedList.html @@ -6,14 +6,11 @@ test / Bar

    Bar

    -class Bar
    +class Bar

    Usage instructions:

    -
    1. Rinse

      -
    2. Repeat

      -

    -
    -
    -
    +
    1. Rinse
    2. +
    3. Repeat
    4. +

    Constructors

    @@ -21,7 +18,8 @@ diff --git a/core/testdata/format/overloads.html b/core/testdata/format/overloads.html index 58241e56..ae50668a 100644 --- a/core/testdata/format/overloads.html +++ b/core/testdata/format/overloads.html @@ -14,7 +14,8 @@ f diff --git a/core/testdata/format/overloadsWithDescription.html b/core/testdata/format/overloadsWithDescription.html index 89bddaa4..aacdebfd 100644 --- a/core/testdata/format/overloadsWithDescription.html +++ b/core/testdata/format/overloadsWithDescription.html @@ -9,15 +9,12 @@ fun f(x: Int): Unit
    -fun f(x: String): Unit
    +fun f(x: String): Unit

    Performs an action on x.

    This is a long description.

    -
    -

    Parameters

    - -x - the value to perform the action on.
    -
    -
    + +

    +x - the value to perform the action on. diff --git a/core/testdata/format/overloadsWithDifferentDescriptions.html b/core/testdata/format/overloadsWithDifferentDescriptions.html index 549adbfa..83849f23 100644 --- a/core/testdata/format/overloadsWithDifferentDescriptions.html +++ b/core/testdata/format/overloadsWithDifferentDescriptions.html @@ -6,27 +6,22 @@ test / f

    f

    - -fun f(x: Int): Unit
    + +

    +fun f(x: Int): Unit

    Performs an action on x.

    This is a long description.

    -
    -

    Parameters

    - -x - the int value to perform the action on.
    -
    -
    - -fun f(x: String): Unit
    + +

    +x - the int value to perform the action on. +

    +fun f(x: String): Unit

    Performs an action on x.

    This is a long description.

    -
    -

    Parameters

    - -x - the string value to perform the action on.
    -
    -
    + +

    +x - the string value to perform the action on. diff --git a/core/testdata/format/overridingFunction.md b/core/testdata/format/overridingFunction.md index 2c898b9c..dcc1c426 100644 --- a/core/testdata/format/overridingFunction.md +++ b/core/testdata/format/overridingFunction.md @@ -1,9 +1,8 @@ [test](test/index) / [D](test/-d/index) / [f](test/-d/f) - # f `fun f(): Unit` -Overrides [C.f](test/-c/f) +Overrides [C.f](test/-c/f) diff --git a/core/testdata/format/paramTag.md b/core/testdata/format/paramTag.md index 20d8faac..dec4ad9c 100644 --- a/core/testdata/format/paramTag.md +++ b/core/testdata/format/paramTag.md @@ -1,15 +1,12 @@ [test](test/index) / [f](test/f) - # f -`fun f(x: String, y: Int): Unit` +`fun f(x: String, y: Int): Unit` ### Parameters `x` - A string `y` - A number with a really long description that spans multiple lines and goes -on and on and is very interesting to read - - +on and on and is very interesting to read \ No newline at end of file diff --git a/core/testdata/format/parameterAnchor.html b/core/testdata/format/parameterAnchor.html index ff9c9317..5a51e171 100644 --- a/core/testdata/format/parameterAnchor.html +++ b/core/testdata/format/parameterAnchor.html @@ -7,12 +7,11 @@

    processFiles

    -fun <T> processFiles(processor: () -> T): List<T>
    +fun <T> processFiles(processor: () -> T): List<T>

    Runs processor for each file and collects its results into single list

    Parameters

    - -processor - function to receive context for symbol resolution and file for processing
    -
    -
    + +

    +processor - function to receive context for symbol resolution and file for processing diff --git a/core/testdata/format/parenthesis.html b/core/testdata/format/parenthesis.html index 3ae75ccb..65272af2 100644 --- a/core/testdata/format/parenthesis.html +++ b/core/testdata/format/parenthesis.html @@ -7,9 +7,7 @@

    foo

    -fun foo(): Unit
    +fun foo(): Unit

    foo (bar)

    -
    -
    diff --git a/core/testdata/format/propertyVar.md b/core/testdata/format/propertyVar.md index f2110992..8232dff4 100644 --- a/core/testdata/format/propertyVar.md +++ b/core/testdata/format/propertyVar.md @@ -1,8 +1,5 @@ [test](test/index) / [x](test/x) - # x -`var x: Int` - - +`var x: Int` \ No newline at end of file diff --git a/core/testdata/format/receiverParameterTypeBound.md b/core/testdata/format/receiverParameterTypeBound.md index 872158ac..8a8c4220 100644 --- a/core/testdata/format/receiverParameterTypeBound.md +++ b/core/testdata/format/receiverParameterTypeBound.md @@ -1,20 +1,14 @@ [test](test/index) / [Foo](test/-foo/index) - # Foo `open class Foo` - - ### Constructors - | [<init>](test/-foo/-init-) | `Foo()` | - ### Extension Functions - -| [xyzzy](test/xyzzy) | `fun <T : [Foo](test/-foo/index)> T.xyzzy(): Unit` | +| [xyzzy](test/xyzzy) | `fun T.xyzzy(): Unit` | diff --git a/core/testdata/format/reifiedTypeParameter.md b/core/testdata/format/reifiedTypeParameter.md index 2e96018e..253f2438 100644 --- a/core/testdata/format/reifiedTypeParameter.md +++ b/core/testdata/format/reifiedTypeParameter.md @@ -1,8 +1,5 @@ [test](test/index) / [f](test/f) - # f -`inline fun <reified T> f(): Unit` - - +`inline fun f(): Unit` \ No newline at end of file diff --git a/core/testdata/format/returnWithLink.html b/core/testdata/format/returnWithLink.html index e5827e8e..7a52391b 100644 --- a/core/testdata/format/returnWithLink.html +++ b/core/testdata/format/returnWithLink.html @@ -7,10 +7,8 @@

    foo

    -fun foo(s1: String): String
    +fun foo(s1: String): String

    Return
    Returns s1 and does nothing else.

    -
    -
    diff --git a/core/testdata/format/see.html b/core/testdata/format/see.html index e39711bb..d9d1df13 100644 --- a/core/testdata/format/see.html +++ b/core/testdata/format/see.html @@ -6,26 +6,19 @@

    quux

    -fun quux(): Unit
    +fun quux(): Unit

    See Also

    foo

    bar

    -
    -
    test / foo

    foo

    -fun foo(): Unit
    -
    -
    -test / bar
    +fun foo(): Unittest / bar

    bar

    -fun bar(): Unit
    -
    -
    +fun bar(): Unit diff --git a/core/testdata/format/shadowedExtensionFunctions.md b/core/testdata/format/shadowedExtensionFunctions.md index 5218d299..3b0a9dc9 100644 --- a/core/testdata/format/shadowedExtensionFunctions.md +++ b/core/testdata/format/shadowedExtensionFunctions.md @@ -1,22 +1,15 @@ [test](test/index) / [Bar](test/-bar/index) - # Bar -`class Bar : [Foo](test/-foo/index)` - - +`class Bar : `[`Foo`](test/-foo/index) ### Constructors - | [<init>](test/-bar/-init-) | `Bar()` | - ### Extension Functions - -| [shazam](test/shazam) | `fun [Bar](test/-bar/index).shazam(i: Int): Unit` -`fun [Foo](test/-foo/index).shazam(): Unit` | -| [xyzzy](test/xyzzy) | `fun [Bar](test/-bar/index).xyzzy(): Unit` | +| [shazam](test/shazam) | `fun `[`Bar`](test/-bar/index)`.shazam(i: Int): Unit`
    `fun `[`Foo`](test/-foo/index)`.shazam(): Unit` | +| [xyzzy](test/xyzzy) | `fun `[`Bar`](test/-bar/index)`.xyzzy(): Unit` | diff --git a/core/testdata/format/starProjection.md b/core/testdata/format/starProjection.md index c73a5aa9..6f796e77 100644 --- a/core/testdata/format/starProjection.md +++ b/core/testdata/format/starProjection.md @@ -1,8 +1,6 @@ [test](test/index) / [kotlin.collections.Iterable](test/kotlin.collections.-iterable/index) - ### Extensions for kotlin.collections.Iterable - -| [containsFoo](test/kotlin.collections.-iterable/contains-foo) | `fun Iterable<*>.containsFoo(element: Any?): Boolean` | +| [containsFoo](test/kotlin.collections.-iterable/contains-foo) | `fun Iterable<*>.containsFoo(element: Any?): Boolean` | diff --git a/core/testdata/format/summarizeSignatures.md b/core/testdata/format/summarizeSignatures.md index b1707f40..d37f2301 100644 --- a/core/testdata/format/summarizeSignatures.md +++ b/core/testdata/format/summarizeSignatures.md @@ -1,23 +1,14 @@ [test](test/index) / [kotlin](test/kotlin/index) - ## Package kotlin - ### Types - -| [Array](test/kotlin/-array/index) | `class Array<T>` | +| [Array](test/kotlin/-array/index) | `class Array` | | [CharArray](test/kotlin/-char-array/index) | `class CharArray` | | [IntArray](test/kotlin/-int-array/index) | `class IntArray` | - ### Functions - -| [foo](test/kotlin/foo) | `fun <T> any_array<T>.foo(predicate: (T) -> Boolean): Boolean` - -Returns true if foo. - - | +| [foo](test/kotlin/foo) | `fun any_array.foo(predicate: (T) -> Boolean): Boolean`
    Returns true if foo. | diff --git a/core/testdata/format/summarizeSignaturesProperty.md b/core/testdata/format/summarizeSignaturesProperty.md index 9646b0f1..712aebd4 100644 --- a/core/testdata/format/summarizeSignaturesProperty.md +++ b/core/testdata/format/summarizeSignaturesProperty.md @@ -1,23 +1,14 @@ [test](test/index) / [kotlin](test/kotlin/index) - ## Package kotlin - ### Types - -| [Array](test/kotlin/-array/index) | `class Array<T>` | +| [Array](test/kotlin/-array/index) | `class Array` | | [CharArray](test/kotlin/-char-array/index) | `class CharArray` | | [IntArray](test/kotlin/-int-array/index) | `class IntArray` | - ### Properties - -| [foo](test/kotlin/foo) | `val <T> any_array<T>.foo: Int` - -Returns true if foo. - - | +| [foo](test/kotlin/foo) | `val any_array.foo: Int`
    Returns true if foo. | diff --git a/core/testdata/format/throwsTag.md b/core/testdata/format/throwsTag.md index 21225297..a476fa1b 100644 --- a/core/testdata/format/throwsTag.md +++ b/core/testdata/format/throwsTag.md @@ -1,6 +1,5 @@ [test](test/index) / [f](test/f) - # f `fun f(): Unit` @@ -9,6 +8,4 @@ `IllegalArgumentException` - on Mondays -`NullPointerException` - on Tuesdays - - +`NullPointerException` - on Tuesdays \ No newline at end of file diff --git a/core/testdata/format/tripleBackticks.html b/core/testdata/format/tripleBackticks.html index b085c67a..5b6c9fd3 100644 --- a/core/testdata/format/tripleBackticks.html +++ b/core/testdata/format/tripleBackticks.html @@ -7,11 +7,8 @@

    f

    -fun f(): Unit
    +fun f(): Unit

    Description

    -
    code sample

    -
    -
    -
    +
    code sample
    diff --git a/core/testdata/format/typeLink.html b/core/testdata/format/typeLink.html index 23054c8d..68c7b487 100644 --- a/core/testdata/format/typeLink.html +++ b/core/testdata/format/typeLink.html @@ -6,9 +6,7 @@ test / Bar

    Bar

    -class Bar : Foo
    -
    -
    +class Bar : Foo

    Constructors

    <init> -Bar()

    Usage instructions:

    +Bar() +

    Usage instructions:

    fun f(x: Int): Unit
    -fun f(x: String): Unit

    Performs an action on x.

    +fun f(x: String): Unit +

    Performs an action on x.

    diff --git a/core/testdata/format/typeParameterBounds.md b/core/testdata/format/typeParameterBounds.md index e2551580..58df82a3 100644 --- a/core/testdata/format/typeParameterBounds.md +++ b/core/testdata/format/typeParameterBounds.md @@ -1,15 +1,11 @@ [test](test/index) / [generic](test/generic) - # generic -`fun <T : R, R> generic(): Unit` +`fun generic(): Unit` generic function - ### Parameters -`T` - the first type parameter - - +`T` - the first type parameter \ No newline at end of file diff --git a/core/testdata/format/typeParameterVariance.md b/core/testdata/format/typeParameterVariance.md index 241c2e87..01f5562c 100644 --- a/core/testdata/format/typeParameterVariance.md +++ b/core/testdata/format/typeParameterVariance.md @@ -1,18 +1,14 @@ [test](test/index) / [Foo](test/-foo/index) - # Foo -`class Foo<out T>` +`class Foo` ### Parameters `T` - the class parameter type - - ### Constructors - | [<init>](test/-foo/-init-) | `Foo()` | diff --git a/core/testdata/format/typeProjectionVariance.md b/core/testdata/format/typeProjectionVariance.md index 7aa34593..5b8fc190 100644 --- a/core/testdata/format/typeProjectionVariance.md +++ b/core/testdata/format/typeProjectionVariance.md @@ -1,8 +1,6 @@ [test](test/index) / [kotlin.Array](test/kotlin.-array/index) - ### Extensions for kotlin.Array - -| [foo](test/kotlin.-array/foo) | `fun <T> Array<out T>.foo(): Unit` | +| [foo](test/kotlin.-array/foo) | `fun Array.foo(): Unit` | diff --git a/core/testdata/format/uninterpretedEmphasisCharacters.html b/core/testdata/format/uninterpretedEmphasisCharacters.html index 70409577..62850fb0 100644 --- a/core/testdata/format/uninterpretedEmphasisCharacters.html +++ b/core/testdata/format/uninterpretedEmphasisCharacters.html @@ -7,10 +7,8 @@

    foo

    -fun foo(): Unit
    +fun foo(): Unit

    This is emphasized text but text_with_underscores has to preserve the underscores. Single stars embedded in a word like Embedded*Star have to be preserved as well.

    -
    -
    diff --git a/core/testdata/format/varargsFunction.md b/core/testdata/format/varargsFunction.md index 723437aa..85ac9c92 100644 --- a/core/testdata/format/varargsFunction.md +++ b/core/testdata/format/varargsFunction.md @@ -1,8 +1,5 @@ [test](test/index) / [f](test/f) - # f -`fun f(vararg s: String): Unit` - - +`fun f(vararg s: String): Unit` \ No newline at end of file diff --git a/core/testdata/format/website/returnTag.md b/core/testdata/format/website/returnTag.md index 301635ad..418babad 100644 --- a/core/testdata/format/website/returnTag.md +++ b/core/testdata/format/website/returnTag.md @@ -5,15 +5,12 @@ layout: api - # indexOf -
    fun Foo.indexOf(
        char: Char,
        startIndex: Int = 0,
        ignoreCase: Boolean = false
    ): Int

    -
    +
    fun Foo.indexOf(
        char: Char,
        startIndex: Int = 0,
        ignoreCase: Boolean = false
    ): Int
    Returns the index within this string of the first occurrence of the specified character, starting from the specified startIndex. - ### Parameters ignoreCase - true to ignore character case when matching a character. By default false. @@ -21,5 +18,3 @@ Returns the index within this string of the first occurrence of the specified ch **Returns** An index of the first occurrence of char or -1 if none is found. - - diff --git a/core/testdata/format/website/sample.md b/core/testdata/format/website/sample.md index e416a039..3a52379b 100644 --- a/core/testdata/format/website/sample.md +++ b/core/testdata/format/website/sample.md @@ -5,28 +5,20 @@ layout: api - # foo -
    fun foo(): Int
    -
    +
    fun foo(): Int
    Groups elements of the original sequence by the key returned by the given keySelector function applied to each element and returns a map where each group key is associated with a list of corresponding elements. - ``` kotlin if (true) { println(property) } ``` +
    - - - -
    fun foo(i: Int): Int
    -
    - - +
    fun foo(i: Int): Int
    \ No newline at end of file -- cgit