Skip to content

Commit 01a17fc

Browse files
vmishenevIgnatBeresnev
authored andcommitted
Fix css bugs wih link and table row (#2284)
* Remove extra top margin in paragraph * Remove margin-bottom from platform-hinted * Fix link underlining in table and anchor icon * Make breakable names of constructors * Add test for breakable name of constructor (cherry picked from commit 9a61f49)
1 parent f7db503 commit 01a17fc

File tree

4 files changed

+55
-5
lines changed

4 files changed

+55
-5
lines changed

plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,9 @@ open class HtmlRenderer(
450450
it.filter { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } }
451451
.forEach {
452452
span("inline-flex") {
453-
it.build(this, pageContext, sourceSetRestriction)
453+
div {
454+
it.build(this, pageContext, sourceSetRestriction)
455+
}
454456
if (it is ContentLink && !anchorDestination.isNullOrBlank()) buildAnchorCopyButton(
455457
anchorDestination
456458
)

plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ open class DefaultPageCreator(
261261
needsAnchors = true,
262262
extra = PropertyContainer.empty<ContentNode>() + SimpleAttr.header("Constructors")
263263
) {
264-
link(it.name, it.dri, kind = ContentKind.Main)
264+
link(it.name, it.dri, kind = ContentKind.Main, styles = setOf(ContentStyle.RowTitle))
265265
sourceSetDependentHint(
266266
it.dri,
267267
it.sourceSets.toSet(),

plugins/base/src/main/resources/dokka/styles/style.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ html ::-webkit-scrollbar-thumb {
228228
margin-top: 8px;
229229
}
230230

231+
p.paragraph:first-child,
231232
.brief p.paragraph {
232233
margin-top: 0;
233234
}
@@ -746,7 +747,6 @@ td.content {
746747
}
747748

748749
.main-subrow .anchor-icon {
749-
padding: 0 8px;
750750
opacity: 0;
751751
transition: 0.2s 0.5s;
752752
}
@@ -765,8 +765,9 @@ td.content {
765765

766766
.main-subrow .anchor-wrapper {
767767
position: relative;
768-
width: 16px;
768+
width: 24px;
769769
height: 16px;
770+
margin-left: 3px;
770771
}
771772

772773
.inline-flex {
@@ -776,7 +777,6 @@ td.content {
776777
.platform-hinted {
777778
flex: auto;
778779
display: block;
779-
margin-bottom: 5px;
780780
}
781781

782782
.platform-hinted > .platform-bookmarks-row > .platform-bookmark {
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package content.functions
2+
3+
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
4+
import org.jetbrains.dokka.model.DClass
5+
import org.jetbrains.dokka.model.dfs
6+
import org.jetbrains.dokka.pages.*
7+
import org.junit.jupiter.api.Test
8+
import utils.assertNotNull
9+
import kotlin.test.assertEquals
10+
11+
class ContentForConstructors : BaseAbstractTest() {
12+
private val testConfiguration = dokkaConfiguration {
13+
sourceSets {
14+
sourceSet {
15+
sourceRoots = listOf("src/")
16+
analysisPlatform = "jvm"
17+
}
18+
}
19+
}
20+
21+
@Test
22+
fun `constructor name should have RowTitle style`() {
23+
testInline("""
24+
|/src/main/kotlin/test/source.kt
25+
|package test
26+
|
27+
|/**
28+
| * Dummy text.
29+
| */
30+
|class Example(val exampleParameter: Int) {
31+
|}
32+
""".trimIndent(), testConfiguration) {
33+
pagesTransformationStage = { module ->
34+
val classPage =
35+
module.dfs { it.name == "Example" && (it as ContentPage).documentable is DClass } as ContentPage
36+
val constructorsTable =
37+
classPage.content.dfs { it is ContentTable && it.dci.kind == ContentKind.Constructors } as ContentTable
38+
39+
assertEquals(1, constructorsTable.children.size)
40+
val primary = constructorsTable.children.first()
41+
val constructorName =
42+
primary.dfs { (it as? ContentText)?.text == "Example" }.assertNotNull("constructorName")
43+
44+
assert(ContentStyle.RowTitle in constructorName.style)
45+
}
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)