diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2020-10-01 08:38:31 +0200 |
---|---|---|
committer | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2020-10-08 16:35:33 +0200 |
commit | 68553bf4c1de2b640a376f0ac4755a6c5bc7dd79 (patch) | |
tree | 034b33e61920f1fa21a1ba44f28ce1d529a79b17 /plugins/base | |
parent | fd88f63f7f2874df7a4a58a5c7126d8a5a15225b (diff) | |
download | dokka-68553bf4c1de2b640a376f0ac4755a6c5bc7dd79.tar.gz dokka-68553bf4c1de2b640a376f0ac4755a6c5bc7dd79.tar.bz2 dokka-68553bf4c1de2b640a376f0ac4755a6c5bc7dd79.zip |
Improve styles
Diffstat (limited to 'plugins/base')
14 files changed, 405 insertions, 290 deletions
diff --git a/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx b/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx index 47323e73..b11b36f6 100644 --- a/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx +++ b/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx @@ -26,6 +26,10 @@ export const NavigationPaneSearch = () => { setFilterValue('') } + const shouldShowPopup = (filterState: string): boolean => { + return filterState.trim().length !== 0 + } + useEffect(() => { const pathToRoot = (window as IWindow).pathToRoot const url = pathToRoot.endsWith('/') ? `${pathToRoot}scripts/navigation-pane.json` : `${pathToRoot}/scripts/navigation-pane.json` @@ -60,6 +64,7 @@ export const NavigationPaneSearch = () => { popupClassName={"navigation-pane-popup"} onSelect={onChangeSelected} onFilter={onFilter} + shouldShowPopup={shouldShowPopup} renderOptimization={false} /> <span className={"paneSearchInputClearIcon"} onClick={onClearClick}><ClearIcon /></span> diff --git a/plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx b/plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx index 804cc0bf..6d40336f 100644 --- a/plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx +++ b/plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx @@ -53,6 +53,22 @@ export class DokkaFuzzyFilterComponent extends Select { }) } } + + _showPopup(){ + if(this.props.shouldShowPopup){ + if (!this.node) { + return; + } + + const shownData = this.getListItems(this.filterValue()); + this.setState({ + showPopup: this.props.shouldShowPopup(this.filterValue()), + shownData + }) + } else { + super._showPopup() + } + } getListItems(rawFilterString: string, _: Option[]) { const filterPhrase = (rawFilterString ? rawFilterString : '').trim() diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 7a047d3c..abb4e85b 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -22,7 +22,6 @@ import org.jetbrains.dokka.plugability.query import org.jetbrains.dokka.plugability.querySingle import org.jetbrains.dokka.utilities.htmlEscape import org.jetbrains.dokka.utilities.urlEncoded -import java.io.File import java.net.URI open class HtmlRenderer( @@ -278,12 +277,8 @@ open class HtmlRenderer( val content = contentsForSourceSetDependent(divergentForPlatformDependent, pageContext) consumer.onTagContentUnsafe { - +createHTML().div("brief-with-platform-tags") { - consumer.onTagContentUnsafe { - +createHTML().div("inner-brief-with-platform-tags") { - consumer.onTagContentUnsafe { +it.key.first } - } - } + +createHTML().div("with-platform-tags") { + consumer.onTagContentUnsafe { +it.key.first } consumer.onTagContentUnsafe { +createHTML().span("pull-right") { @@ -296,7 +291,7 @@ open class HtmlRenderer( } } } - div("main-subrow") { + div { if (node.implicitlySourceSetHinted) { buildPlatformDependent(divergentForPlatformDependent, pageContext) } else { @@ -366,64 +361,141 @@ open class HtmlRenderer( .filter { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } } .takeIf { it.isNotEmpty() } ?.let { - val anchorName = node.dci.dri.first().anchor - withAnchor(anchorName) { - div(classes = "table-row") { - if (!style.contains(MultimoduleTable)) { - attributes["data-filterable-current"] = node.sourceSets.joinToString(" ") { - it.sourceSetIDs.merged.toString() - } - attributes["data-filterable-set"] = node.sourceSets.joinToString(" ") { - it.sourceSetIDs.merged.toString() - } - } + when (pageContext) { + is MultimoduleRootPage -> buildRowForMultiModule(node, it, pageContext, sourceSetRestriction, style) + is ModulePage -> buildRowForModule(node, it, pageContext, sourceSetRestriction, style) + else -> buildRowForContent(node, it, pageContext, sourceSetRestriction, style) + } + } + } - it.filterIsInstance<ContentLink>().takeIf { it.isNotEmpty() }?.let { - div("main-subrow " + node.style.joinToString(" ")) { - it.filter { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } } - .forEach { - span { - it.build(this, pageContext, sourceSetRestriction) - buildAnchor(anchorName) - } - if (ContentKind.shouldBePlatformTagged(node.dci.kind) && (node.sourceSets.size == 1 || pageContext is ModulePage)) - createPlatformTags(node) - } + private fun FlowContent.buildRowForMultiModule( + contextNode: ContentGroup, + toRender: List<ContentNode>, + pageContext: ContentPage, + sourceSetRestriction: Set<DisplaySourceSet>?, + style: Set<Style> + ) { + val anchorName = contextNode.dci.dri.first().anchor + withAnchor(anchorName) { + div(classes = "table-row") { + div("main-subrow " + contextNode.style.joinToString(separator = " ")) { + buildRowHeaderLink(toRender, pageContext, sourceSetRestriction, anchorName, "w-100") + div { + buildRowBriefSectionForDocs(toRender, pageContext, sourceSetRestriction) + } + } + } + } + } + + private fun FlowContent.buildRowForModule( + contextNode: ContentGroup, + toRender: List<ContentNode>, + pageContext: ContentPage, + sourceSetRestriction: Set<DisplaySourceSet>?, + style: Set<Style> + ) { + val anchorName = contextNode.dci.dri.first().anchor + withAnchor(anchorName) { + div(classes = "table-row") { + addSourceSetFilteringAttributes(contextNode) + div { + div("main-subrow " + contextNode.style.joinToString(separator = " ")) { + buildRowHeaderLink(toRender, pageContext, sourceSetRestriction, anchorName) + div("pull-right") { + if (ContentKind.shouldBePlatformTagged(contextNode.dci.kind)) { + createPlatformTags(contextNode, cssClasses = "no-gutters") } } + } + div { + buildRowBriefSectionForDocs(toRender, pageContext, sourceSetRestriction) + } + } + } + } + } - it.filter { it !is ContentLink }.takeIf { it.isNotEmpty() }?.let { - if (pageContext is ModulePage || pageContext is MultimoduleRootPage) { + private fun FlowContent.buildRowForContent( + contextNode: ContentGroup, + toRender: List<ContentNode>, + pageContext: ContentPage, + sourceSetRestriction: Set<DisplaySourceSet>?, + style: Set<Style> + ) { + val anchorName = contextNode.dci.dri.first().anchor + withAnchor(anchorName) { + div(classes = "table-row") { + addSourceSetFilteringAttributes(contextNode) + div("main-subrow keyValue " + contextNode.style.joinToString(separator = " ")) { + buildRowHeaderLink(toRender, pageContext, sourceSetRestriction, anchorName) + div { + toRender.filter { it !is ContentLink && !it.hasStyle(ContentStyle.RowTitle)}.takeIf { it.isNotEmpty() }?.let { + if (ContentKind.shouldBePlatformTagged(contextNode.dci.kind) && contextNode.sourceSets.size == 1) + createPlatformTags(contextNode) + + div("title") { it.forEach { - span(classes = if (it.dci.kind == ContentKind.Comment) "brief-comment" else "") { - 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) - } - } + it.build(this, pageContext, sourceSetRestriction) } } } } } } + } } - private fun FlowContent.createPlatformTagBubbles(sourceSets: List<DisplaySourceSet>) { + private fun FlowContent.buildRowHeaderLink( + toRender: List<ContentNode>, + pageContext: ContentPage, + sourceSetRestriction: Set<DisplaySourceSet>?, + anchorName: String, + classes: String = "" + ) { + toRender.filter { it is ContentLink || it.hasStyle(ContentStyle.RowTitle) }.takeIf { it.isNotEmpty() }?.let { + div(classes) { + it.filter { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } } + .forEach { + span("inline-flex") { + it.build(this, pageContext, sourceSetRestriction) + if(it is ContentLink) buildAnchor(anchorName) + } + } + } + } + } + + private fun FlowContent.addSourceSetFilteringAttributes( + contextNode: ContentGroup, + ) { + attributes["data-filterable-current"] = contextNode.sourceSets.joinToString(" ") { + it.sourceSetIDs.merged.toString() + } + attributes["data-filterable-set"] = contextNode.sourceSets.joinToString(" ") { + it.sourceSetIDs.merged.toString() + } + } + + private fun FlowContent.buildRowBriefSectionForDocs( + toRender: List<ContentNode>, + pageContext: ContentPage, + sourceSetRestriction: Set<DisplaySourceSet>?, + ){ + toRender.filter { it !is ContentLink }.takeIf { it.isNotEmpty() }?.let { + it.forEach { + span(classes = if (it.dci.kind == ContentKind.Comment) "brief-comment" else "") { + it.build(this, pageContext, sourceSetRestriction) + } + } + } + } + + private fun FlowContent.createPlatformTagBubbles(sourceSets: List<DisplaySourceSet>, cssClasses: String = "") { if (shouldRenderSourceSetBubbles) { - div("platform-tags") { - sourceSets.forEach { + div("platform-tags " + cssClasses) { + sourceSets.sortedBy { it.name }.forEach { div("platform-tag") { when (it.platform.key) { "common" -> classes = classes + "common-like" @@ -440,12 +512,13 @@ open class HtmlRenderer( private fun FlowContent.createPlatformTags( node: ContentNode, - sourceSetRestriction: Set<DisplaySourceSet>? = null + sourceSetRestriction: Set<DisplaySourceSet>? = null, + cssClasses: String = "" ) { node.takeIf { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } }?.let { createPlatformTagBubbles(node.sourceSets.filter { sourceSetRestriction == null || it in sourceSetRestriction - }) + }.sortedBy { it.name }, cssClasses) } } diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt index 465f8cb7..6273e789 100644 --- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt +++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt @@ -63,7 +63,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog contentBuilder.contentFor( e, ContentKind.Symbol, - setOf(TextStyle.Monospace, TextStyle.Block) + e.stylesIfDeprecated(it), + setOf(TextStyle.Monospace) + e.stylesIfDeprecated(it), sourceSets = setOf(it) ) { group(styles = setOf(TextStyle.Block)) { diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index 41881baf..f5fbb51e 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -117,7 +117,7 @@ open class DefaultPageCreator( link(it.name, it.dri) if (it.sourceSets.size == 1 || (documentations.isNotEmpty() && haveSameContent)) { - documentations.first()?.let { firstSentenceComment(kind = ContentKind.Comment, content = it) } + documentations.first()?.let { firstSentenceComment(kind = ContentKind.Comment, content = it.root) } } } } @@ -169,8 +169,8 @@ open class DefaultPageCreator( ) { link(it.name, it.dri, kind = ContentKind.Main) sourceSetDependentHint(it.dri, it.sourceSets.toSet(), kind = ContentKind.SourceSetDependentHint) { - contentForBrief(it) +buildSignature(it) + contentForBrief(it) } } s.safeAs<WithExtraProperties<Documentable>>()?.let { it.extra[InheritorsInfo] }?.let { inheritors -> @@ -206,8 +206,8 @@ open class DefaultPageCreator( group(kind = ContentKind.Cover) { cover(e.name) sourceSetDependentHint(e.dri, e.sourceSets.toSet()) { - +contentForDescription(e) +buildSignature(e) + +contentForDescription(e) } } group(styles = setOf(ContentStyle.TabbedContent)) { @@ -226,8 +226,8 @@ open class DefaultPageCreator( group(kind = ContentKind.Cover, sourceSets = mainSourcesetData + extensions.sourceSets) { cover(c.name.orEmpty()) sourceSetDependentHint(c.dri, c.sourceSets) { - +contentForDescription(c) +buildSignature(c) + +contentForDescription(c) } } @@ -249,8 +249,8 @@ open class DefaultPageCreator( kind = ContentKind.SourceSetDependentHint, styles = emptySet() ) { - contentForBrief(it) +buildSignature(it) + contentForBrief(it) } } } @@ -267,8 +267,8 @@ open class DefaultPageCreator( ) { link(it.name, it.dri) sourceSetDependentHint(it.dri, it.sourceSets.toSet(), kind = ContentKind.SourceSetDependentHint) { - contentForBrief(it) +buildSignature(it) + contentForBrief(it) } } } @@ -464,7 +464,8 @@ open class DefaultPageCreator( documentable.sourceSets.forEach { sourceSet -> documentable.documentation[sourceSet]?.children?.firstOrNull()?.root?.let { group(sourceSets = setOf(sourceSet), kind = ContentKind.BriefComment) { - comment(it) + if(documentable.hasSeparatePage) firstSentenceComment(it) + else comment(it) } } } @@ -495,13 +496,13 @@ open class DefaultPageCreator( } divergentGroup(ContentDivergentGroup.GroupID("member")) { instance(setOf(d.dri), d.sourceSets.toSet()) { - before { - +contentForDescription(d) - +contentForComments(d) - } divergent(kind = ContentKind.Symbol) { +buildSignature(d) } + after { + +contentForDescription(d) + +contentForComments(d) + } } } } @@ -535,15 +536,15 @@ open class DefaultPageCreator( ) { elements.map { instance(setOf(it.dri), it.sourceSets.toSet(), extra = PropertyContainer.withAll(SymbolAnchorHint)) { - before { - contentForBrief(it) - contentForSinceKotlin(it) - } divergent { group { +buildSignature(it) } } + after { + contentForBrief(it) + contentForSinceKotlin(it) + } } } } @@ -566,4 +567,7 @@ open class DefaultPageCreator( private val Documentable.descriptions: SourceSetDependent<Description> get() = groupedTags.withTypeUnnamed<Description>() + + private val Documentable.hasSeparatePage: Boolean + get() = this !is DTypeAlias } diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt index 42700f20..4bebd9f1 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt @@ -289,14 +289,14 @@ open class PageContentBuilder( } fun firstSentenceComment( - content: Description, + content: DocTag, kind: Kind = ContentKind.Comment, sourceSets: Set<DokkaSourceSet> = mainSourcesetData, styles: Set<Style> = mainStyles, extra: PropertyContainer<ContentNode> = mainExtra ){ val builtDescription = commentsConverter.buildContent( - content.root, + content, DCI(mainDRI, kind), sourceSets ) diff --git a/plugins/base/src/main/resources/dokka/styles/style.css b/plugins/base/src/main/resources/dokka/styles/style.css index 7c1b2803..97ac19f7 100644 --- a/plugins/base/src/main/resources/dokka/styles/style.css +++ b/plugins/base/src/main/resources/dokka/styles/style.css @@ -3,7 +3,7 @@ @import url('jetbrains-mono.css'); :root { - --breadcrumb-font-color: #A6AFBA; + --breadcrumb-font-color: #637282; --hover-link-color: #5B5DEF; --average-color: #637282; --footer-height: 64px; @@ -62,7 +62,7 @@ background-color: white; } -.tabs-section-body > .table { +.tabs-section-body > div { margin-top: 12px; } @@ -130,9 +130,13 @@ width: 100%; } +.cover p.paragraph { + margin-top: 4px; +} + .divergent-group { background-color: white; - padding: 16px 8px; + padding: 8px 0px 8px 0; margin-bottom: 2px; } @@ -164,15 +168,15 @@ #leftColumn { width: 280px; - min-height: 100%; border-right: 1px solid #DADFE6; - flex: 0 0 auto; + display: flex; + flex-direction: column; } #sideMenu { - max-height: calc(100% - 140px); padding-top: 16px; position: relative; + max-height: calc(100% - 140px); } #sideMenu img { @@ -238,6 +242,13 @@ code.paragraph { font-weight: bold; position: relative; line-height: 24px; + font-family: JetBrains Mono, Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; + font-size: 14px; + min-height: 43px; +} + +.symbol > a { + color: var(--hover-link-color); } .copy-icon { @@ -313,6 +324,12 @@ code.paragraph { overflow: hidden; } + +.sideMenuPart a:hover { + text-decoration: none; + color: var(--average-color); +} + .sideMenuPart > .overview:before { box-sizing: border-box; content: ''; @@ -398,16 +415,6 @@ td:first-child { font-size: 12px; } -.symbol { - font-family: JetBrains Mono, Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; - font-size: 12px; - min-height: 43px; -} - -.symbol > a { - color: var(--hover-link-color); -} - .identifier { color: darkblue; font-size: 12px; @@ -417,7 +424,6 @@ td:first-child { .brief { white-space: pre-wrap; overflow: hidden; - padding-top: 8px; } h1, h2, h3, h4, h5, h6 { @@ -518,9 +524,8 @@ blockquote { } code, pre { - font-family: Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; color: #333; - font-size: 12px; + font-size: 14px; } pre { @@ -657,20 +662,23 @@ footer { letter-spacing: normal; text-align: center; outline: none; - color: #fff - } .platform-tags { display: flex; flex-wrap: wrap; + padding-bottom: 8px; } .platform-tags > .platform-tag { align-self: center; } +.platform-tags > .platform-tag:first-of-type { + margin-left: auto; +} + .platform-tag.jvm-like { background-color: #4DBB5F; color: white; @@ -728,16 +736,16 @@ td.content { display: flex; flex-direction: row; padding: 0; - justify-content: space-between; flex-wrap: wrap; } -.main-subrow > span { +.main-subrow > div > span { display: flex; position: relative; } -.main-subrow > span > a { +.main-subrow > div > span > a, +.main-subrow > div > span > span[data-unresolved-link] { text-decoration: none; font-style: normal; font-weight: 600; @@ -745,7 +753,7 @@ td.content { color: #282E34; } -.main-subrow > span > a:hover { +.main-subrow > div > span > a:hover { color: var(--hover-link-color); } @@ -776,6 +784,10 @@ td.content { position: relative; } +.inline-flex { + display: inline-flex; +} + .platform-hinted { flex: auto; display: block; @@ -853,17 +865,12 @@ td.content { top: 0; } -.inner-brief-with-platform-tags { - display: block; - width: 100% -} - -.brief-with-platform-tags { +.with-platform-tags { display: flex; } -.brief-with-platform-tags ~ .main-subrow { - padding-top: 16px; +.with-platform-tags ~ .main-subrow { + padding-top: 8px; } .cover .with-platform-tabs { @@ -893,7 +900,7 @@ td.content { } .table-row .with-platform-tabs .sourceset-depenent-content .brief { - padding: 16px; + padding: 8px; background-color: #f4f4f4; } @@ -1074,6 +1081,15 @@ div.runnablesample { margin-bottom: 0.2em; } +.w-100 { + width: 100%; +} + +.no-gutters { + margin: 0; + padding: 0; +} + @media screen and (max-width: 1119px) { /* TODO this feels wrong as only is an aproximation of correct solution*/ .filter-section { @@ -1136,7 +1152,8 @@ div.runnablesample { margin-left: -0.5em; } #content { - padding: 0 var(--mobile-horizontal-spacing-for-content); + padding: var(--mobile-horizontal-spacing-for-content); + padding-top: 0; } #sideMenu { padding-bottom: 16px; diff --git a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt index 1116dfa9..2dce7e28 100644 --- a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt +++ b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt @@ -84,9 +84,6 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { - group { pWrapped("comment to function") } - } divergent { bareSignature( emptyMap(), @@ -98,6 +95,9 @@ class ContentForParamsTest : AbstractCoreTest() { "abc" to ParamAttributes(emptyMap(), emptySet(), "String") ) } + after { + group { pWrapped("comment to function") } + } } } } @@ -129,10 +129,6 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { - unnamedTag("Author") { group { +"Kordyjan" } } - unnamedTag("Since") { group { +"0.11" } } - } divergent { bareSignature( emptyMap(), @@ -144,6 +140,10 @@ class ContentForParamsTest : AbstractCoreTest() { "abc" to ParamAttributes(emptyMap(), emptySet(), "String") ) } + after { + unnamedTag("Author") { group { +"Kordyjan" } } + unnamedTag("Since") { group { +"0.11" } } + } } } } @@ -176,11 +176,6 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { - group { pWrapped("comment to function") } - unnamedTag("Author") { group { +"Kordyjan" } } - unnamedTag("Since") { group { +"0.11" } } - } divergent { bareSignature( emptyMap(), @@ -192,6 +187,11 @@ class ContentForParamsTest : AbstractCoreTest() { "abc" to ParamAttributes(emptyMap(), emptySet(), "String") ) } + after { + group { pWrapped("comment to function") } + unnamedTag("Author") { group { +"Kordyjan" } } + unnamedTag("Since") { group { +"0.11" } } + } } } } @@ -223,7 +223,18 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } + after { group { pWrapped("comment to function") } header(2) { +"Parameters" } group { @@ -237,17 +248,6 @@ class ContentForParamsTest : AbstractCoreTest() { } } } - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } } } } @@ -281,7 +281,15 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { + divergent { + bareSignature( + emptyMap(), "", "", emptySet(), "function", null, + "first" to ParamAttributes(emptyMap(), emptySet(), "String"), + "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), + "third" to ParamAttributes(emptyMap(), emptySet(), "Double") + ) + } + after { group { group { group { +"comment to function" } } } header(2) { +"Parameters" } group { @@ -289,28 +297,20 @@ class ContentForParamsTest : AbstractCoreTest() { table { group { +"first" - group { group { +"comment to first param" } } + group { group { +"comment to first param" } } } group { +"second" - group { group { +"comment to second param" } } + group { group { +"comment to second param" } } } group { +"third" - group { group { +"comment to third param" } } + group { group { +"comment to third param" } } } } } } } - divergent { - bareSignature( - emptyMap(), "", "", emptySet(), "function", null, - "first" to ParamAttributes(emptyMap(), emptySet(), "String"), - "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), - "third" to ParamAttributes(emptyMap(), emptySet(), "Double") - ) - } } } } @@ -343,7 +343,15 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { + divergent { + bareSignature( + emptyMap(), "", "", emptySet(), "function", null, + "first" to ParamAttributes(emptyMap(), emptySet(), "String"), + "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), + "third" to ParamAttributes(emptyMap(), emptySet(), "Double") + ) + } + after { header(2) { +"Parameters" } group { platformHinted { @@ -364,14 +372,6 @@ class ContentForParamsTest : AbstractCoreTest() { } } } - divergent { - bareSignature( - emptyMap(), "", "", emptySet(), "function", null, - "first" to ParamAttributes(emptyMap(), emptySet(), "String"), - "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), - "third" to ParamAttributes(emptyMap(), emptySet(), "Double") - ) - } } } } @@ -404,7 +404,19 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { + divergent { + bareSignatureWithReceiver( + emptyMap(), + "", + "", + emptySet(), + "String", + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } + after { group { pWrapped("comment to function") } header(2) { +"Parameters" } group { @@ -422,18 +434,6 @@ class ContentForParamsTest : AbstractCoreTest() { } } } - divergent { - bareSignatureWithReceiver( - emptyMap(), - "", - "", - emptySet(), - "String", - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } } } } @@ -466,7 +466,15 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { + divergent { + bareSignature( + emptyMap(), "", "", emptySet(), "function", null, + "first" to ParamAttributes(emptyMap(), emptySet(), "String"), + "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), + "third" to ParamAttributes(emptyMap(), emptySet(), "Double") + ) + } + after { group { group { group { +"comment to function" } } } header(2) { +"Parameters" } group { @@ -484,14 +492,6 @@ class ContentForParamsTest : AbstractCoreTest() { } } } - divergent { - bareSignature( - emptyMap(), "", "", emptySet(), "function", null, - "first" to ParamAttributes(emptyMap(), emptySet(), "String"), - "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), - "third" to ParamAttributes(emptyMap(), emptySet(), "Double") - ) - } } } } @@ -527,7 +527,15 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { + divergent { + bareSignature( + emptyMap(), "", "", emptySet(), "function", null, + "first" to ParamAttributes(emptyMap(), emptySet(), "String"), + "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), + "third" to ParamAttributes(emptyMap(), emptySet(), "Double") + ) + } + after { group { pWrapped("comment to function") } unnamedTag("Author") { group { +"Kordyjan" } } unnamedTag("Since") { group { +"0.11" } } @@ -552,14 +560,6 @@ class ContentForParamsTest : AbstractCoreTest() { } } } - divergent { - bareSignature( - emptyMap(), "", "", emptySet(), "function", null, - "first" to ParamAttributes(emptyMap(), emptySet(), "String"), - "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), - "third" to ParamAttributes(emptyMap(), emptySet(), "Double") - ) - } } } } diff --git a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt index aa9ac045..d5d1966d 100644 --- a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt +++ b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt @@ -81,7 +81,18 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } + after { header(2) { +"See also" } group { platformHinted { @@ -95,17 +106,6 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } } } - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } } } } @@ -136,7 +136,18 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } + after { header(2) { +"See also" } group { platformHinted { @@ -152,17 +163,6 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } } } - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } } } } @@ -193,7 +193,18 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } + after { header(2) { +"See also" } group { platformHinted { @@ -207,17 +218,6 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } } } - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } } } } @@ -248,7 +248,18 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } + after { header(2) { +"See also" } group { platformHinted { @@ -264,17 +275,6 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } } } - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } } } } @@ -308,7 +308,18 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } + after { group { group { group { +"random comment"} } } unnamedTag("Author") { group { +"pikinier20" } } unnamedTag("Since") { group { +"0.11" } } @@ -328,17 +339,6 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } } } - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } } } } @@ -370,7 +370,18 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } + after { header(2) { +"See also" } group { platformHinted { @@ -386,17 +397,6 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } } } - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } } } } @@ -428,7 +428,18 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - before { + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } + after { header(2) { +"See also" } group { platformHinted { @@ -449,17 +460,6 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } } } - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } } } } diff --git a/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt b/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt index b3da3f71..df1bfbc6 100644 --- a/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt +++ b/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt @@ -212,7 +212,6 @@ class ConstructorsSignaturesTest : AbstractCoreTest() { group { header(1) { +"SomeClass" } platformHinted { - skipAllNotMatching() group { +"class" link { +"SomeClass" } @@ -220,6 +219,7 @@ class ConstructorsSignaturesTest : AbstractCoreTest() { group { link { +"String" } } +")" } + skipAllNotMatching() } } group { @@ -229,11 +229,6 @@ class ConstructorsSignaturesTest : AbstractCoreTest() { link { +"SomeClass" } platformHinted { group { - group { - group { +"ctor comment" } - } - } - group { +"fun" link { +"SomeClass" } +"(a:" @@ -242,6 +237,11 @@ class ConstructorsSignaturesTest : AbstractCoreTest() { } +")" } + group { + group { + group { +"ctor comment" } + } + } } } } diff --git a/plugins/base/src/test/kotlin/enums/EnumsTest.kt b/plugins/base/src/test/kotlin/enums/EnumsTest.kt index 3d1495fe..134a1cc6 100644 --- a/plugins/base/src/test/kotlin/enums/EnumsTest.kt +++ b/plugins/base/src/test/kotlin/enums/EnumsTest.kt @@ -211,15 +211,15 @@ class EnumsTest : AbstractCoreTest() { platformHinted { group { group { - group { - +"Sample docs for E1" - } + link { +"E1" } + +"()" } } group { group { - link { +"E1" } - +"()" + group { + +"Sample docs for E1" + } } } } diff --git a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt index f67d73bb..38c7569a 100644 --- a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt +++ b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt @@ -209,7 +209,7 @@ class LinkableContentTest : AbstractCoreTest() { val function = classChildren.find { it.name == "printWithExclamation" } val text = function.cast<MemberPageNode>().content.cast<ContentGroup>().children.last() .cast<ContentDivergentGroup>().children.single() - .cast<ContentDivergentInstance>().before + .cast<ContentDivergentInstance>().after .cast<ContentGroup>().children.last() .cast<ContentGroup>().children.last() .cast<PlatformHintedContent>().children.single() diff --git a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt index ad0d421e..8c78eff7 100644 --- a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt @@ -209,7 +209,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() { renderedContent.match( Div( Div( - Div("ab-"), + "ab-", Span() ), Div(Div(Div("ab"))) @@ -281,7 +281,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() { HtmlRenderer(context).render(page) renderedContent.match( Div( - Div(Div("ab-"), Span()), + Div("ab-", Span()), Div(Div(Div("ab"))), "ab+" ) @@ -319,8 +319,8 @@ class DivergentTest : HtmlRenderingOnlyTestBase() { HtmlRenderer(context).render(page) renderedContent.match( - Div(Div(Div("a-"), Span()), Div(Div(Div("a"))), "ab+"), - Div(Div(Div("b-"), Span()), Div(Div(Div(("b")))), "ab+") + Div(Div("a-", Span()), Div(Div(Div("a"))), "ab+"), + Div(Div("b-", Span()), Div(Div(Div(("b")))), "ab+") ) } } diff --git a/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt index d72b5c33..4662db4e 100644 --- a/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt @@ -58,7 +58,7 @@ class DivergentSignatureTest : AbstractCoreTest() { val content = writerPlugin.renderedContent("example/example/-clock/get-time.html") assert(content.count() == 1) - assert(content.select("[data-filterable-current=example/common example/js example/jvm]").single().brief == "common") + assert(content.select("[data-filterable-current=example/common example/js example/jvm]").single().brief == "") } } } @@ -75,8 +75,8 @@ class DivergentSignatureTest : AbstractCoreTest() { renderingStage = { _, _ -> val content = writerPlugin.renderedContent("example/example/-clock/get-times-in-millis.html") assert(content.count() == 2) - assert(content.select("[data-filterable-current=example/common example/jvm]").single().brief == "Time in minis common") - assert(content.select("[data-filterable-current=example/js]").single().brief == "JS implementation of getTimeInMillis js" ) + assert(content.select("[data-filterable-current=example/common example/jvm]").single().brief == "Time in minis") + assert(content.select("[data-filterable-current=example/js]").single().brief == "JS implementation of getTimeInMillis" ) } } } @@ -93,9 +93,9 @@ class DivergentSignatureTest : AbstractCoreTest() { renderingStage = { _, _ -> val content = writerPlugin.renderedContent("example/example/-clock/get-year.html") assert(content.count() == 3) - assert(content.select("[data-filterable-current=example/jvm]").single().brief == "JVM custom kdoc jvm") - assert(content.select("[data-filterable-current=example/js]").single().brief == "JS custom kdoc js") - assert(content.select("[data-filterable-current=example/common]").single().brief == "common") + assert(content.select("[data-filterable-current=example/jvm]").single().brief == "JVM custom kdoc") + assert(content.select("[data-filterable-current=example/js]").single().brief == "JS custom kdoc") + assert(content.select("[data-filterable-current=example/common]").single().brief == "") } } } @@ -104,5 +104,5 @@ class DivergentSignatureTest : AbstractCoreTest() { .let { Jsoup.parse(it) }.select("#content").single().select("div.divergent-group") private val Element.brief: String - get() = children().select(".brief-with-platform-tags").text() + get() = children().select("p").text() } |