From 430d7d6453a0b63dcabecd54aea915410cd35103 Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Tue, 5 May 2020 11:53:16 +0200 Subject: Add a draft version of divergent rendering --- plugins/gfm/src/main/kotlin/GfmPlugin.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'plugins/gfm/src') diff --git a/plugins/gfm/src/main/kotlin/GfmPlugin.kt b/plugins/gfm/src/main/kotlin/GfmPlugin.kt index b7e9f6ab..fead66f1 100644 --- a/plugins/gfm/src/main/kotlin/GfmPlugin.kt +++ b/plugins/gfm/src/main/kotlin/GfmPlugin.kt @@ -63,7 +63,11 @@ open class CommonmarkRenderer( append("]($address)") } - override fun StringBuilder.buildList(node: ContentList, pageContext: ContentPage, platformRestriction: SourceSetData?) { + override fun StringBuilder.buildList( + node: ContentList, + pageContext: ContentPage, + platformRestriction: Set? + ) { buildParagraph() buildListLevel(node, pageContext) buildParagraph() @@ -92,7 +96,7 @@ open class CommonmarkRenderer( node.children, pageContext, "${node.extra.allOfType().find { it.extraKey == "start" }?.extraValue - ?: 1.also { context.logger.error("No starting number specified for ordered list in node ${pageContext.dri.first()}!")}}." + ?: 1.also { context.logger.error("No starting number specified for ordered list in node ${pageContext.dri.first()}!") }}." ) } else { buildListItem(node.children, pageContext, "*") @@ -109,7 +113,7 @@ open class CommonmarkRenderer( override fun StringBuilder.buildPlatformDependent(content: PlatformHintedContent, pageContext: ContentPage) { val distinct = content.sourceSets.map { - it to StringBuilder().apply {buildContentNode(content.inner, pageContext, it) }.toString() + it to StringBuilder().apply {buildContentNode(content.inner, pageContext, setOf(it)) }.toString() }.groupBy(Pair::second, Pair::first) if (distinct.size == 1) @@ -124,7 +128,11 @@ open class CommonmarkRenderer( append("Resource") } - override fun StringBuilder.buildTable(node: ContentTable, pageContext: ContentPage, platformRestriction: SourceSetData?) { + override fun StringBuilder.buildTable( + node: ContentTable, + pageContext: ContentPage, + platformRestriction: Set? + ) { buildParagraph() val size = node.children.firstOrNull()?.children?.size ?: 0 -- cgit