diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-05-17 17:22:46 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-05-19 09:56:32 +0200 |
commit | 65eb3ef308773a10d6fc07050f8e16357431f6d5 (patch) | |
tree | 91369f750b09a6864583fef4a65bb9d5692963a8 | |
parent | 9a77287304af906d3d8f14bf6852bf3bc3b759d6 (diff) | |
download | dokka-65eb3ef308773a10d6fc07050f8e16357431f6d5.tar.gz dokka-65eb3ef308773a10d6fc07050f8e16357431f6d5.tar.bz2 dokka-65eb3ef308773a10d6fc07050f8e16357431f6d5.zip |
Rename platformRestriction to sourceSetRestriction
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt | 36 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt | 18 |
2 files changed, 18 insertions, 36 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt index e229f3a6..a089f8f5 100644 --- a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt @@ -28,7 +28,7 @@ abstract class DefaultRenderer<T>( abstract fun T.buildList( node: ContentList, pageContext: ContentPage, - platformRestriction: Set<SourceSetData>? = null + sourceSetRestriction: Set<SourceSetData>? = null ) abstract fun T.buildNewLine() @@ -36,7 +36,7 @@ abstract class DefaultRenderer<T>( abstract fun T.buildTable( node: ContentTable, pageContext: ContentPage, - platformRestriction: Set<SourceSetData>? = null + sourceSetRestriction: Set<SourceSetData>? = null ) abstract fun T.buildText(textNode: ContentText) @@ -51,9 +51,9 @@ abstract class DefaultRenderer<T>( open fun T.buildGroup( node: ContentGroup, pageContext: ContentPage, - platformRestriction: Set<SourceSetData>? = null + sourceSetRestriction: Set<SourceSetData>? = null ) = - wrapGroup(node, pageContext) { node.children.forEach { it.build(this, pageContext, platformRestriction) } } + wrapGroup(node, pageContext) { node.children.forEach { it.build(this, pageContext, sourceSetRestriction) } } open fun T.buildDivergent(node: ContentDivergentGroup, pageContext: ContentPage) = node.children.forEach { it.build(this, pageContext) } @@ -64,9 +64,9 @@ abstract class DefaultRenderer<T>( open fun T.buildLinkText( nodes: List<ContentNode>, pageContext: ContentPage, - platformRestriction: Set<SourceSetData>? = null + sourceSetRestriction: Set<SourceSetData>? = null ) { - nodes.forEach { it.build(this, pageContext, platformRestriction) } + nodes.forEach { it.build(this, pageContext, sourceSetRestriction) } } open fun T.buildCode(code: List<ContentNode>, language: String, pageContext: ContentPage) { @@ -76,39 +76,39 @@ abstract class DefaultRenderer<T>( open fun T.buildHeader( node: ContentHeader, pageContext: ContentPage, - platformRestriction: Set<SourceSetData>? = null + sourceSetRestriction: Set<SourceSetData>? = null ) { - buildHeader(node.level) { node.children.forEach { it.build(this, pageContext, platformRestriction) } } + buildHeader(node.level) { node.children.forEach { it.build(this, pageContext, sourceSetRestriction) } } } open fun ContentNode.build( builder: T, pageContext: ContentPage, - platformRestriction: Set<SourceSetData>? = null + sourceSetRestriction: Set<SourceSetData>? = null ) = - builder.buildContentNode(this, pageContext, platformRestriction) + builder.buildContentNode(this, pageContext, sourceSetRestriction) open fun T.buildContentNode( node: ContentNode, pageContext: ContentPage, - platformRestriction: Set<SourceSetData>? = null + sourceSetRestriction: Set<SourceSetData>? = null ) { - if (platformRestriction == null || node.sourceSets.any { it in platformRestriction } ) { + if (sourceSetRestriction == null || node.sourceSets.any { it in sourceSetRestriction } ) { when (node) { is ContentText -> buildText(node) - is ContentHeader -> buildHeader(node, pageContext, platformRestriction) + is ContentHeader -> buildHeader(node, pageContext, sourceSetRestriction) is ContentCode -> buildCode(node.children, node.language, pageContext) is ContentDRILink -> buildLink(locationProvider.resolve(node.address, node.sourceSets.toList(), pageContext)) { - buildLinkText(node.children, pageContext, platformRestriction) + buildLinkText(node.children, pageContext, sourceSetRestriction) } is ContentResolvedLink -> buildLink(node.address) { - buildLinkText(node.children, pageContext, platformRestriction) + buildLinkText(node.children, pageContext, sourceSetRestriction) } is ContentEmbeddedResource -> buildResource(node, pageContext) - is ContentList -> buildList(node, pageContext, platformRestriction) - is ContentTable -> buildTable(node, pageContext, platformRestriction) - is ContentGroup -> buildGroup(node, pageContext, platformRestriction) + is ContentList -> buildList(node, pageContext, sourceSetRestriction) + is ContentTable -> buildTable(node, pageContext, sourceSetRestriction) + is ContentGroup -> buildGroup(node, pageContext, sourceSetRestriction) is ContentBreakLine -> buildNewLine() is PlatformHintedContent -> buildPlatformDependent(node, pageContext) is ContentDivergentGroup -> buildDivergent(node, pageContext) diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 97f0bdbd..9acb0f8f 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -40,24 +40,6 @@ open class HtmlRenderer( } } - private fun FlowContent.wrapPlatformTagged( - node: ContentGroup, - pageContext: ContentPage, - childrenCallback: FlowContent.() -> Unit - ) { - div("platform-tagged") { - node.sourceSets.forEach { - div("platform-tag") { - if (it.sourceSetName.equals("common", ignoreCase = true)) classes = classes + "common" - text(it.sourceSetName) - } - } - div("content") { - childrenCallback() - } - } - } - override fun FlowContent.buildPlatformDependent(content: PlatformHintedContent, pageContext: ContentPage) = buildPlatformDependent(content.sourceSets.map { it to setOf(content.inner) }.toMap(), pageContext) |