aboutsummaryrefslogtreecommitdiff
path: root/plugins/gfm/src/main
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-07-10 11:46:15 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-07-10 15:57:55 +0200
commit205c451cdbe238bb8c5841418ab1a7d68410e117 (patch)
tree4f33f4e7823a5652164817117d3656dbb0ae2dd5 /plugins/gfm/src/main
parent6b446b6bae2ac8a33be613c7fc4d34506607f63a (diff)
downloaddokka-205c451cdbe238bb8c5841418ab1a7d68410e117.tar.gz
dokka-205c451cdbe238bb8c5841418ab1a7d68410e117.tar.bz2
dokka-205c451cdbe238bb8c5841418ab1a7d68410e117.zip
Apply requested changes
Diffstat (limited to 'plugins/gfm/src/main')
-rw-r--r--plugins/gfm/src/main/kotlin/GfmPlugin.kt15
1 files changed, 8 insertions, 7 deletions
diff --git a/plugins/gfm/src/main/kotlin/GfmPlugin.kt b/plugins/gfm/src/main/kotlin/GfmPlugin.kt
index 6774e31b..15fe6943 100644
--- a/plugins/gfm/src/main/kotlin/GfmPlugin.kt
+++ b/plugins/gfm/src/main/kotlin/GfmPlugin.kt
@@ -145,11 +145,9 @@ open class CommonmarkRenderer(
}.groupBy(Pair<DokkaSourceSet, String>::second, Pair<DokkaSourceSet, String>::first)
distinct.filter { it.key.isNotBlank() }.forEach { (text, platforms) ->
- append(
- platforms.joinToString(
- prefix = " [",
- postfix = "] $text "
- ) { it.displayName })
+ append(" ")
+ buildSourceSetTags(platforms.toSet())
+ append(" $text ")
buildNewLine()
}
}
@@ -255,7 +253,7 @@ open class CommonmarkRenderer(
distinct.values.forEach { entry ->
val (instance, sourceSets) = entry.getInstanceAndSourceSets()
- append(sourceSets.joinToString(prefix = "[", postfix = "]") { it.displayName })
+ buildSourceSetTags(sourceSets)
buildNewLine()
instance.before?.let {
append("Brief description")
@@ -270,7 +268,7 @@ open class CommonmarkRenderer(
.values.forEach { innerEntry ->
val (innerInstance, innerSourceSets) = innerEntry.getInstanceAndSourceSets()
if(sourceSets.size > 1) {
- append(innerSourceSets.joinToString(prefix = "[", postfix = "]") { it.displayName })
+ buildSourceSetTags(innerSourceSets)
buildNewLine()
}
innerInstance.divergent.build(this@buildDivergent, pageContext, setOf(innerSourceSets.first())) // It's workaround to render content only once
@@ -327,6 +325,9 @@ open class CommonmarkRenderer(
private fun String.withEntersAsHtml(): String = replace("\n", "<br>")
private fun List<Pair<ContentDivergentInstance, DokkaSourceSet>>.getInstanceAndSourceSets() = this.let { Pair(it.first().first, it.map { it.second }.toSet()) }
+
+ private fun StringBuilder.buildSourceSetTags(sourceSets: Set<DokkaSourceSet>) =
+ append(sourceSets.joinToString(prefix = "[", postfix = "]") { it.displayName })
}
class MarkdownLocationProviderFactory(val context: DokkaContext) : LocationProviderFactory {