diff options
author | Błażej Kardyś <bkardys@virtuslab.com> | 2020-05-05 17:45:12 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-05-14 13:30:33 +0200 |
commit | 3f2a790190da4f40ea6d8a976aa1929b2a1b002b (patch) | |
tree | 752ee84451954e9ea5e6d4133e18e41aaee2f7b1 /plugins/gfm/src/main | |
parent | a440f0cb8756019131a2c15389e747aea3c585e7 (diff) | |
download | dokka-3f2a790190da4f40ea6d8a976aa1929b2a1b002b.tar.gz dokka-3f2a790190da4f40ea6d8a976aa1929b2a1b002b.tar.bz2 dokka-3f2a790190da4f40ea6d8a976aa1929b2a1b002b.zip |
Changing approach from platform-driven to source-set-driven
Diffstat (limited to 'plugins/gfm/src/main')
-rw-r--r-- | plugins/gfm/src/main/kotlin/GfmPlugin.kt | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/gfm/src/main/kotlin/GfmPlugin.kt b/plugins/gfm/src/main/kotlin/GfmPlugin.kt index c65f3673..b7e9f6ab 100644 --- a/plugins/gfm/src/main/kotlin/GfmPlugin.kt +++ b/plugins/gfm/src/main/kotlin/GfmPlugin.kt @@ -7,6 +7,7 @@ import org.jetbrains.dokka.base.renderers.PackageListCreator import org.jetbrains.dokka.base.renderers.RootCreator import org.jetbrains.dokka.base.resolvers.local.DefaultLocationProvider import org.jetbrains.dokka.base.resolvers.local.LocationProviderFactory +import org.jetbrains.dokka.model.SourceSetData import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.DokkaPlugin @@ -62,7 +63,7 @@ open class CommonmarkRenderer( append("]($address)") } - override fun StringBuilder.buildList(node: ContentList, pageContext: ContentPage, platformRestriction: PlatformData?) { + override fun StringBuilder.buildList(node: ContentList, pageContext: ContentPage, platformRestriction: SourceSetData?) { buildParagraph() buildListLevel(node, pageContext) buildParagraph() @@ -107,15 +108,15 @@ open class CommonmarkRenderer( } override fun StringBuilder.buildPlatformDependent(content: PlatformHintedContent, pageContext: ContentPage) { - val distinct = content.platforms.map { + val distinct = content.sourceSets.map { it to StringBuilder().apply {buildContentNode(content.inner, pageContext, it) }.toString() - }.groupBy(Pair<PlatformData, String>::second, Pair<PlatformData, String>::first) + }.groupBy(Pair<SourceSetData, String>::second, Pair<SourceSetData, String>::first) if (distinct.size == 1) append(distinct.keys.single()) else distinct.forEach { text, platforms -> - append(platforms.joinToString(prefix = " [", postfix = "] $text") { it.name }) + append(platforms.joinToString(prefix = " [", postfix = "] $text") { "${it.moduleName}/${it.sourceSetName}" }) } } @@ -123,7 +124,7 @@ open class CommonmarkRenderer( append("Resource") } - override fun StringBuilder.buildTable(node: ContentTable, pageContext: ContentPage, platformRestriction: PlatformData?) { + override fun StringBuilder.buildTable(node: ContentTable, pageContext: ContentPage, platformRestriction: SourceSetData?) { buildParagraph() val size = node.children.firstOrNull()?.children?.size ?: 0 |