diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2023-05-31 13:53:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-31 13:53:07 +0200 |
commit | 63bed7cb2e47eb46772e680982c33ed3ee624c31 (patch) | |
tree | 3355f5c18c9d755caffa6f2fb6ca24a2f91a1acc /plugins/base/src/main/kotlin/renderers/html | |
parent | f45750699d089e0101dcde5d38c7e08ec2f03708 (diff) | |
download | dokka-63bed7cb2e47eb46772e680982c33ed3ee624c31.tar.gz dokka-63bed7cb2e47eb46772e680982c33ed3ee624c31.tar.bz2 dokka-63bed7cb2e47eb46772e680982c33ed3ee624c31.zip |
Fix missing tab entries for module names with space (#3019)
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 768b2c6b..94bd0aeb 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -215,7 +215,7 @@ open class HtmlRenderer( node.isAnchorable -> buildAnchor( node.anchor!!, node.anchorLabel!!, - node.sourceSetsFilters + node.buildSourceSetFilterValues() ) { childrenCallback() } node.extra[InsertTemplateExtra] != null -> node.extra[InsertTemplateExtra]?.let { templateCommand(it.command) } ?: Unit @@ -568,10 +568,15 @@ open class HtmlRenderer( private fun FlowContent.addSourceSetFilteringAttributes( contextNode: ContentGroup, ) { - attributes["data-filterable-current"] = contextNode.sourceSets.joinToString(" ") { - it.sourceSetIDs.merged.toString() - } - attributes["data-filterable-set"] = contextNode.sourceSets.joinToString(" ") { + attributes["data-filterable-current"] = contextNode.buildSourceSetFilterValues() + attributes["data-filterable-set"] = contextNode.buildSourceSetFilterValues() + } + + private fun ContentNode.buildSourceSetFilterValues(): String { + // This value is used in HTML and JS for filtering out source set declarations, + // it is expected that the separator is the same here and there. + // See https://github.com/Kotlin/dokka/issues/3011#issuecomment-1568620493 + return this.sourceSets.joinToString(",") { it.sourceSetIDs.merged.toString() } } @@ -699,7 +704,7 @@ open class HtmlRenderer( buildAnchor(anchor, anchorLabel, sourceSets) {} private fun FlowContent.buildAnchor(node: ContentNode) { - node.anchorLabel?.let { label -> buildAnchor(node.anchor!!, label, node.sourceSetsFilters) } + node.anchorLabel?.let { label -> buildAnchor(node.anchor!!, label, node.buildSourceSetFilterValues()) } } @@ -982,8 +987,5 @@ private val PageNode.isNavigable: Boolean private fun PropertyContainer<ContentNode>.extraHtmlAttributes() = allOfType<SimpleAttr>() private fun PropertyContainer<ContentNode>.extraTabbedContentType() = this[TabbedContentTypeExtra] -private val ContentNode.sourceSetsFilters: String - get() = sourceSets.sourceSetIDs.joinToString(" ") { it.toString() } - private val DisplaySourceSet.comparableKey get() = sourceSetIDs.merged.let { it.scopeId + it.sourceSetName } |