diff options
author | Marcin Aman <maman@virtuslab.com> | 2020-08-20 19:00:04 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-08-25 17:49:30 +0200 |
commit | c9af371aa18dc50490dc3927ed88dfe8836c1bde (patch) | |
tree | 6b974aa9be26d9e3544327d17722d8f26e14cd4d /plugins/base/src/main/kotlin/renderers | |
parent | 7196323582dce7ca3f9b07262a1f94ecd8514539 (diff) | |
download | dokka-c9af371aa18dc50490dc3927ed88dfe8836c1bde.tar.gz dokka-c9af371aa18dc50490dc3927ed88dfe8836c1bde.tar.bz2 dokka-c9af371aa18dc50490dc3927ed88dfe8836c1bde.zip |
Improve styles and functionality on module page #1336
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 22fb3e63..0118dcfd 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -386,23 +386,31 @@ open class HtmlRenderer( it.build(this, pageContext, sourceSetRestriction) buildAnchor(anchorName) } - if (ContentKind.shouldBePlatformTagged(node.dci.kind) && (node.sourceSets.size == 1)) + if (ContentKind.shouldBePlatformTagged(node.dci.kind) && (node.sourceSets.size == 1 || pageContext is ModulePage)) createPlatformTags(node) } } } it.filter { it !is ContentLink }.takeIf { it.isNotEmpty() }?.let { - div("platform-dependent-row keyValue") { - val title = it.filter { it.style.contains(ContentStyle.RowTitle) } - div { - title.forEach { + if(pageContext is ModulePage){ + it.forEach { + span(classes = if(it.dci.kind == ContentKind.Comment) "brief-comment" else "") { it.build(this, pageContext, sourceSetRestriction) } } - div("title") { - (it - title).forEach { - it.build(this, pageContext, sourceSetRestriction) + } else { + div("platform-dependent-row keyValue") { + val title = it.filter { it.style.contains(ContentStyle.RowTitle) } + div { + title.forEach { + it.build(this, pageContext, sourceSetRestriction) + } + } + div("title") { + (it - title).forEach { + it.build(this, pageContext, sourceSetRestriction) + } } } } @@ -513,13 +521,20 @@ open class HtmlRenderer( override fun FlowContent.buildNavigation(page: PageNode) = div(classes = "breadcrumbs") { - locationProvider.ancestors(page).asReversed().forEach { node -> - text("/") - if (node.isNavigable) buildLink(node, page) - else text(node.name) + val path = locationProvider.ancestors(page).filterNot { it is RendererSpecificPage }.asReversed() + if(path.isNotEmpty()){ + buildNavigationElement(path.first(), page) + path.drop(1).forEach { node -> + text("/") + buildNavigationElement(node, page) + } } } + private fun FlowContent.buildNavigationElement(node: PageNode, page: PageNode) = + if (node.isNavigable) buildLink(node, page) + else text(node.name) + private fun FlowContent.buildLink(to: PageNode, from: PageNode) = locationProvider.resolve(to, from)?.let { path -> buildLink(path) { |