aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2020-11-10 16:54:57 +0100
committerGitHub <noreply@github.com>2020-11-10 16:54:57 +0100
commit07e43676665bdc009e135b767e6d43c536b413fa (patch)
treed389a7257ef4a508a7672abca16c626965c1e04d /plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
parent470ccfca37041ff0f1924318fae8820f674d26f4 (diff)
downloaddokka-07e43676665bdc009e135b767e6d43c536b413fa.tar.gz
dokka-07e43676665bdc009e135b767e6d43c536b413fa.tar.bz2
dokka-07e43676665bdc009e135b767e6d43c536b413fa.zip
New breadcrumbs (#1590)
Add top navbar
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt37
1 files changed, 21 insertions, 16 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 05eda494..615bbfc3 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -99,8 +99,7 @@ open class HtmlRenderer(
node.hasStyle(TextStyle.Span) -> span() { childrenCallback() }
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(pageContext)
+ node.dci.kind == ContentKind.Cover -> div("cover $additionalClasses") { //TODO this can be removed
childrenCallback()
}
node.hasStyle(TextStyle.Paragraph) -> p(additionalClasses) { childrenCallback() }
@@ -110,8 +109,8 @@ open class HtmlRenderer(
}
}
- private fun FlowContent.filterButtons(page: ContentPage) {
- if (shouldRenderSourceSetBubbles) {
+ private fun FlowContent.filterButtons(page: PageNode) {
+ if (shouldRenderSourceSetBubbles && page is ContentPage) {
div(classes = "filter-section") {
id = "filter-section"
page.content.withDescendants().flatMap { it.sourceSets }.distinct().forEach {
@@ -584,13 +583,22 @@ open class HtmlRenderer(
override fun FlowContent.buildNavigation(page: PageNode) =
- div(classes = "breadcrumbs") {
- 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)
+ div("navigation-wrapper") {
+ id = "navigation-wrapper"
+ div(classes = "breadcrumbs") {
+ 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)
+ }
+ }
+ }
+ div("pull-right d-flex") {
+ filterButtons(page)
+ div {
+ id = "searchBar"
}
}
}
@@ -706,7 +714,7 @@ open class HtmlRenderer(
override fun buildPage(page: ContentPage, content: (FlowContent, ContentPage) -> Unit): String =
buildHtml(page, page.embeddedResources) {
- div {
+ div("main-content") {
id = "content"
attributes["pageIds"] = page.pageId
content(this, page)
@@ -762,15 +770,12 @@ open class HtmlRenderer(
id = "leftToggler"
span("icon-toggler")
}
- div {
- id = "searchBar"
- }
script(type = ScriptType.textJavaScript, src = page.root("scripts/pages.js")) {}
script(type = ScriptType.textJavaScript, src = page.root("scripts/main.js")) {}
content()
div(classes = "footer") {
span("go-to-top-icon") {
- a(href = "#container")
+ a(href = "#content")
}
span { text("© 2020 Copyright") }
span("pull-right") {