aboutsummaryrefslogtreecommitdiff
path: root/src/Formats
diff options
context:
space:
mode:
Diffstat (limited to 'src/Formats')
-rw-r--r--src/Formats/FormatService.kt2
-rw-r--r--src/Formats/HtmlFormatService.kt12
-rw-r--r--src/Formats/JekyllFormatService.kt2
-rw-r--r--src/Formats/KotlinWebsiteFormatService.kt6
-rw-r--r--src/Formats/OutlineService.kt2
-rw-r--r--src/Formats/StructuredFormatService.kt10
6 files changed, 17 insertions, 17 deletions
diff --git a/src/Formats/FormatService.kt b/src/Formats/FormatService.kt
index 642fad04..7e66a6b7 100644
--- a/src/Formats/FormatService.kt
+++ b/src/Formats/FormatService.kt
@@ -17,4 +17,4 @@ public interface FormatService {
}
/** Format content to [String] using specified [location] */
-fun FormatService.format(location: Location, nodes: Iterable<DocumentationNode>): String = kotlin.StringBuilder { appendNodes(location, this, nodes) }.toString()
+fun FormatService.format(location: Location, nodes: Iterable<DocumentationNode>): String = StringBuilder().apply { appendNodes(location, this, nodes) }.toString()
diff --git a/src/Formats/HtmlFormatService.kt b/src/Formats/HtmlFormatService.kt
index 78d3cff2..74b10255 100644
--- a/src/Formats/HtmlFormatService.kt
+++ b/src/Formats/HtmlFormatService.kt
@@ -112,13 +112,13 @@ public open class HtmlFormatService(locationService: LocationService,
override fun appendNodes(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
templateService.appendHeader(to, getPageTitle(nodes))
- super<StructuredFormatService>.appendNodes(location, to, nodes)
+ super.appendNodes(location, to, nodes)
templateService.appendFooter(to)
}
override fun appendOutline(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
templateService.appendHeader(to, "Module Contents")
- super<OutlineFormatService>.appendOutline(location, to, nodes)
+ super.appendOutline(location, to, nodes)
templateService.appendFooter(to)
}
@@ -144,16 +144,16 @@ public open class HtmlFormatService(locationService: LocationService,
fun getPageTitle(nodes: Iterable<DocumentationNode>): String? {
val breakdownByLocation = nodes.groupBy { node -> formatPageTitle(node) }
- return breakdownByLocation.keySet().singleOrNull()
+ return breakdownByLocation.keys.singleOrNull()
}
fun formatPageTitle(node: DocumentationNode): String {
val path = node.path
- if (path.size() == 1) {
+ if (path.size == 1) {
return path.first().name
}
- val qualifiedName = path.drop(1).map { it.name }.filter { it.length() > 0 }.join(".")
- if (qualifiedName.length() == 0 && path.size() == 2) {
+ val qualifiedName = path.drop(1).map { it.name }.filter { it.length > 0 }.joinToString(".")
+ if (qualifiedName.length == 0 && path.size == 2) {
return path.first().name + " / root package"
}
return path.first().name + " / " + qualifiedName
diff --git a/src/Formats/JekyllFormatService.kt b/src/Formats/JekyllFormatService.kt
index e4c3ccd5..98958293 100644
--- a/src/Formats/JekyllFormatService.kt
+++ b/src/Formats/JekyllFormatService.kt
@@ -9,7 +9,7 @@ public open class JekyllFormatService(locationService: LocationService,
appendFrontMatter(nodes, to)
to.appendln("---")
to.appendln("")
- super<MarkdownFormatService>.appendNodes(location, to, nodes)
+ super.appendNodes(location, to, nodes)
}
protected open fun appendFrontMatter(nodes: Iterable<DocumentationNode>, to: StringBuilder) {
diff --git a/src/Formats/KotlinWebsiteFormatService.kt b/src/Formats/KotlinWebsiteFormatService.kt
index 21fc9dae..3a9fc6cd 100644
--- a/src/Formats/KotlinWebsiteFormatService.kt
+++ b/src/Formats/KotlinWebsiteFormatService.kt
@@ -20,14 +20,14 @@ public class KotlinWebsiteFormatService(locationService: LocationService,
return ""
}
- override public fun formatCode(code: String): String = if (code.length() > 0) "<code>$code</code>" else ""
+ override public fun formatCode(code: String): String = if (code.length > 0) "<code>$code</code>" else ""
override fun formatStrikethrough(text: String): String = "<s>$text</s>"
override fun appendAsSignature(to: StringBuilder, block: () -> Unit) {
- val oldLength = to.length()
+ val oldLength = to.length
block()
- if (to.length() > oldLength) {
+ if (to.length > oldLength) {
to.append("<br/>") // since we've used HTML to format the signature, add an HTML line break following it
}
}
diff --git a/src/Formats/OutlineService.kt b/src/Formats/OutlineService.kt
index 31128d6d..6626cf51 100644
--- a/src/Formats/OutlineService.kt
+++ b/src/Formats/OutlineService.kt
@@ -25,5 +25,5 @@ public interface OutlineFormatService {
}
fun formatOutline(location: Location, nodes: Iterable<DocumentationNode>): String =
- StringBuilder { appendOutline(location, this, nodes) }.toString()
+ StringBuilder().apply { appendOutline(location, this, nodes) }.toString()
}
diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt
index 98277c9c..a9b058d1 100644
--- a/src/Formats/StructuredFormatService.kt
+++ b/src/Formats/StructuredFormatService.kt
@@ -46,11 +46,11 @@ public abstract class StructuredFormatService(locationService: LocationService,
public abstract fun formatNonBreakingSpace(): String
open fun formatText(location: Location, nodes: Iterable<ContentNode>, listKind: ListKind = ListKind.Unordered): String {
- return nodes.map { formatText(location, it, listKind) }.join("")
+ return nodes.map { formatText(location, it, listKind) }.joinToString("")
}
open fun formatText(location: Location, content: ContentNode, listKind: ListKind = ListKind.Unordered): String {
- return StringBuilder {
+ return StringBuilder().apply {
when (content) {
is ContentText -> append(formatText(content.text))
is ContentSymbol -> append(formatSymbol(content.text))
@@ -144,7 +144,7 @@ public abstract class StructuredFormatService(locationService: LocationService,
appendLine(to)
}
node.content.getSectionsWithSubjects().forEach {
- appendSectionWithSubject(it.getKey(), location, it.getValue(), to)
+ appendSectionWithSubject(it.key, location, it.value, to)
}
for (section in node.content.sections.filter { it.subjectName == null }) {
@@ -238,7 +238,7 @@ public abstract class StructuredFormatService(locationService: LocationService,
appendTableCell(to) {
val breakdownBySummary = members.groupBy { formatText(location, it.summary) }
for ((summary, items) in breakdownBySummary) {
- val signatureTexts = items map { signature ->
+ val signatureTexts = items.map { signature ->
val signatureText = languageService.render(signature, RenderMode.SUMMARY)
if (signatureText is ContentBlock && signatureText.isEmpty()) {
""
@@ -248,7 +248,7 @@ public abstract class StructuredFormatService(locationService: LocationService,
formatText(location, signatureAsCode)
}
}
- signatureTexts.subList(0, signatureTexts.size()-1).forEach {
+ signatureTexts.subList(0, signatureTexts.size -1).forEach {
appendAsSignature(to) {
appendLine(to, it)
}