aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-07-16 13:47:41 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-07-16 15:53:58 +0200
commitc461b042819a79188420fbcd3899cbc8189cd3c6 (patch)
tree01b464def045de0736b7879708160794b179ec2b /plugins/base/src/main
parent4c9768f086e140db185a034a08b68e6a8f948bf0 (diff)
downloaddokka-c461b042819a79188420fbcd3899cbc8189cd3c6.tar.gz
dokka-c461b042819a79188420fbcd3899cbc8189cd3c6.tar.bz2
dokka-c461b042819a79188420fbcd3899cbc8189cd3c6.zip
Fix bug with filtering buttons not being created
Diffstat (limited to 'plugins/base/src/main')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 44ca5e20..f331acc8 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -12,6 +12,7 @@ import org.jetbrains.dokka.base.renderers.DefaultRenderer
import org.jetbrains.dokka.base.renderers.TabSortingStrategy
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.properties.PropertyContainer
+import org.jetbrains.dokka.model.withDescendants
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.plugin
@@ -38,9 +39,9 @@ open class HtmlRenderer(
private val tabSortingStrategy = context.plugin<DokkaBase>().querySingle { tabSortingStrategy }
- private fun <T: ContentNode> sortTabs(strategy: TabSortingStrategy, tabs: Collection<T>) : List<T> {
+ private fun <T : ContentNode> sortTabs(strategy: TabSortingStrategy, tabs: Collection<T>): List<T> {
val sorted = strategy.sort(tabs)
- if(sorted.size != tabs.size)
+ if (sorted.size != tabs.size)
context.logger.warn("Tab sorting strategy has changed number of tabs from ${tabs.size} to ${sorted.size}")
return sorted;
}
@@ -93,7 +94,7 @@ open class HtmlRenderer(
node.dci.kind == ContentKind.Symbol -> div("symbol $additionalClasses") { childrenCallback() }
node.dci.kind == ContentKind.BriefComment -> div("brief $additionalClasses") { childrenCallback() }
node.dci.kind == ContentKind.Cover -> div("cover $additionalClasses") {
- filterButtons(node)
+ filterButtons(pageContext)
childrenCallback()
}
node.hasStyle(TextStyle.Paragraph) -> p(additionalClasses) { childrenCallback() }
@@ -102,11 +103,11 @@ open class HtmlRenderer(
}
}
- private fun FlowContent.filterButtons(group: ContentGroup) {
+ private fun FlowContent.filterButtons(page: ContentPage) {
if (isMultiplatform) {
div(classes = "filter-section") {
id = "filter-section"
- group.sourceSets.forEach {
+ page.content.withDescendants().flatMap { it.sourceSets }.distinct().forEach {
button(classes = "platform-tag platform-selector") {
attributes["data-active"] = ""
attributes["data-filter"] = it.sourceSetID.toString()