diff options
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt index f2fce191..57a3d8d1 100644 --- a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt @@ -170,6 +170,23 @@ abstract class DefaultRenderer<T>( renderPages(newRoot) } } + + protected fun ContentDivergentGroup.groupDivergentInstances( + pageContext: ContentPage, + beforeTransformer: (ContentDivergentInstance, ContentPage, DokkaSourceSet) -> String, + afterTransformer: (ContentDivergentInstance, ContentPage, DokkaSourceSet) -> String + ): Map<Pair<String, String>, List<Pair<ContentDivergentInstance, DokkaSourceSet>>> = + children.flatMap { instance -> + instance.sourceSets.map { sourceSet -> + Pair(instance, sourceSet) to Pair( + beforeTransformer(instance, pageContext, sourceSet), + afterTransformer(instance, pageContext, sourceSet) + ) + } + }.groupBy( + Pair<Pair<ContentDivergentInstance, DokkaSourceSet>, Pair<String, String>>::second, + Pair<Pair<ContentDivergentInstance, DokkaSourceSet>, Pair<String, String>>::first + ) } -fun ContentPage.sourceSets() = this.content.sourceSets +fun ContentPage.sourceSets() = this.content.sourceSets
\ No newline at end of file |