Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix css bugs wih link and table row #2284

Merged
merged 5 commits into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ open class HtmlRenderer(
it.filter { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } }
.forEach {
span("inline-flex") {
it.build(this, pageContext, sourceSetRestriction)
div {
it.build(this, pageContext, sourceSetRestriction)
}
if (it is ContentLink && !anchorDestination.isNullOrBlank()) buildAnchorCopyButton(
anchorDestination
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ open class DefaultPageCreator(
needsAnchors = true,
extra = PropertyContainer.empty<ContentNode>() + SimpleAttr.header("Constructors")
) {
link(it.name, it.dri, kind = ContentKind.Main)
link(it.name, it.dri, kind = ContentKind.Main, styles = setOf(ContentStyle.RowTitle))
sourceSetDependentHint(
it.dri,
it.sourceSets.toSet(),
Expand Down
6 changes: 3 additions & 3 deletions plugins/base/src/main/resources/dokka/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ html ::-webkit-scrollbar-thumb {
margin-top: 8px;
}

p.paragraph:first-child,
.brief p.paragraph {
margin-top: 0;
}
Expand Down Expand Up @@ -746,7 +747,6 @@ td.content {
}

.main-subrow .anchor-icon {
padding: 0 8px;
opacity: 0;
transition: 0.2s 0.5s;
}
Expand All @@ -765,8 +765,9 @@ td.content {

.main-subrow .anchor-wrapper {
position: relative;
width: 16px;
width: 24px;
height: 16px;
margin-left: 3px;
}

.inline-flex {
Expand All @@ -776,7 +777,6 @@ td.content {
.platform-hinted {
flex: auto;
display: block;
margin-bottom: 5px;
}

.platform-hinted > .platform-bookmarks-row > .platform-bookmark {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package content.functions

import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.model.DClass
import org.jetbrains.dokka.model.dfs
import org.jetbrains.dokka.pages.*
import org.junit.jupiter.api.Test
import utils.assertNotNull
import kotlin.test.assertEquals

class ContentForConstructors : BaseAbstractTest() {
private val testConfiguration = dokkaConfiguration {
sourceSets {
sourceSet {
sourceRoots = listOf("src/")
analysisPlatform = "jvm"
}
}
}

@Test
fun `constructor name should have RowTitle style`() {
testInline("""
|/src/main/kotlin/test/source.kt
|package test
|
|/**
| * Dummy text.
| */
|class Example(val exampleParameter: Int) {
|}
""".trimIndent(), testConfiguration) {
pagesTransformationStage = { module ->
val classPage =
module.dfs { it.name == "Example" && (it as ContentPage).documentable is DClass } as ContentPage
val constructorsTable =
classPage.content.dfs { it is ContentTable && it.dci.kind == ContentKind.Constructors } as ContentTable

assertEquals(1, constructorsTable.children.size)
val primary = constructorsTable.children.first()
val constructorName =
primary.dfs { (it as? ContentText)?.text == "Example" }.assertNotNull("constructorName")

assert(ContentStyle.RowTitle in constructorName.style)
}
}
}
}