From a128cdd43265134a2a2c6b45f5d55b3543a9c794 Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Mon, 6 Apr 2020 22:24:30 +0200 Subject: Fix unnecessary wrapping of signatures, changes in layout --- .../documentables/PageContentBuilder.kt | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt') diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt index 74d0011f..d9a78d0d 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt @@ -39,7 +39,7 @@ open class PageContentBuilder( ): ContentGroup = DocumentableContentBuilder(d.dri, platformData, styles, extra) .apply(block) - .build(d.platformData.toSet(), kind, styles, extra) + .build(platformData, kind, styles, extra) @ContentBuilderMarker open inner class DocumentableContentBuilder( @@ -123,12 +123,12 @@ open class PageContentBuilder( extra: PropertyContainer = mainExtra, operation: DocumentableContentBuilder.() -> List ) { - contents += ContentTable( - emptyList(), - operation(), - DCI(setOf(mainDRI), kind), - platformData, styles, extra - ) + contents += ContentTable( + emptyList(), + operation(), + DCI(setOf(mainDRI), kind), + platformData, styles, extra + ) } fun block( @@ -148,7 +148,6 @@ open class PageContentBuilder( emptyList(), elements.map { buildGroup(it.dri, it.platformData.toSet(), kind, styles, extra) { - // TODO this will fail operation(it) } }, @@ -244,10 +243,6 @@ open class PageContentBuilder( block: DocumentableContentBuilder.() -> Unit ): ContentGroup = contentFor(dri, platformData, kind, styles, extra, block) - fun breakLine(platformData: Set = mainPlatformData) { - contents += ContentBreakLine(platformData) - } - fun platformDependentHint( dri: DRI = mainDRI, platformData: Set = mainPlatformData, @@ -273,8 +268,9 @@ open class PageContentBuilder( fun platformText( value: PlatformDependent, + platforms: Set = value.keys, transform: (T) -> String - ) = value.entries.forEach { (p, v) -> + ) = value.entries.filter { it.key in platforms }.forEach { (p, v) -> transform(v).takeIf { it.isNotBlank() }?.also { text(it, platformData = setOf(p)) } } } -- cgit