diff options
Diffstat (limited to 'plugins')
5 files changed, 21 insertions, 11 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 2af547b8..a2a31340 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -27,11 +27,15 @@ open class HtmlRenderer( node: ContentGroup, pageContext: ContentPage, childrenCallback: FlowContent.() -> Unit - ) = when { - node.dci.kind == ContentKind.BriefComment -> div("brief") { childrenCallback() } - node.style.contains(TextStyle.Paragraph) -> p { childrenCallback() } - node.style.contains(TextStyle.Block) -> div { childrenCallback() } - else -> childrenCallback() + ) { + val additionalClasses = node.style.joinToString { it.toString().toLowerCase() } + return when { + node.dci.kind == ContentKind.BriefComment -> div("brief $additionalClasses") { childrenCallback() } + node.style.contains(TextStyle.Paragraph) -> p(additionalClasses) { childrenCallback() } + node.style.contains(TextStyle.Block) -> div(additionalClasses) { childrenCallback() } + additionalClasses.isNotBlank() -> span(additionalClasses) { childrenCallback() } + else -> childrenCallback() + } } override fun FlowContent.buildPlatformDependent(content: PlatformHintedContent, pageContext: ContentPage) { diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt index c8a5105d..b468c56b 100644 --- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt +++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt @@ -10,6 +10,7 @@ import org.jetbrains.dokka.model.Function import org.jetbrains.dokka.pages.ContentKind import org.jetbrains.dokka.pages.ContentNode import org.jetbrains.dokka.pages.PlatformData +import org.jetbrains.dokka.pages.TextStyle import org.jetbrains.dokka.utilities.DokkaLogger class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLogger) : SignatureProvider { @@ -26,7 +27,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog ) } - private fun signature(c: Classlike) = contentBuilder.contentFor(c, ContentKind.Symbol) { + private fun signature(c: Classlike) = contentBuilder.contentFor(c, ContentKind.Symbol, setOf(TextStyle.Monospace)) { platformText(c.visibility) { (it.takeIf { it !in ignoredVisibilities }?.name ?: "") + " " } if (c is Class) { text(c.modifier.name + " ") @@ -38,7 +39,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog is Object -> text("object ") is Annotation -> text("annotation class ") } - text(c.name!!) + link(c.name!!, c.dri) if (c is WithSupertypes) { c.supertypes.map { (p, dris) -> list(dris, prefix = " : ", platformData = setOf(p)) { @@ -48,7 +49,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog } } - private fun signature(f: Function) = contentBuilder.contentFor(f, ContentKind.Symbol) { + private fun signature(f: Function) = contentBuilder.contentFor(f, ContentKind.Symbol, setOf(TextStyle.Monospace)) { platformText(f.visibility) { (it.takeIf { it !in ignoredVisibilities }?.name ?: "") + " " } text(f.modifier.name + " ") text("fun ") @@ -62,7 +63,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog } text("(") list(f.parameters) { - link(it.name!!, it.dri) + text(it.name!!) text(": ") type(it.type) } @@ -74,7 +75,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog } } - private fun signature(t: TypeParameter) = contentBuilder.contentFor(t, ContentKind.Symbol) { + private fun signature(t: TypeParameter) = contentBuilder.contentFor(t, ContentKind.Symbol, setOf(TextStyle.Monospace)) { link(t.name, t.dri) list(t.bounds, prefix = " : ") { signatureForProjection(it) diff --git a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt index 5332b0f8..885fbfee 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt @@ -42,7 +42,6 @@ object DocTagToContentConverter : CommentsToContentConverter { ) fun buildNewLine() = listOf(ContentBreakLine( - dci, platforms )) diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index b92c058a..9bc06ae8 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -61,6 +61,7 @@ open class DefaultPageCreator( link(it.name.orEmpty(), it.dri) group { +buildSignature(it) + breakLine() group(kind = ContentKind.BriefComment) { text(it.briefDocumentation()) } @@ -70,6 +71,7 @@ open class DefaultPageCreator( link(it.name, it.dri) group { +buildSignature(it) + breakLine() group(kind = ContentKind.BriefComment) { text(it.briefDocumentation()) } diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt index b9e20919..f5880656 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt @@ -229,6 +229,10 @@ open class PageContentBuilder( block: DocumentableContentBuilder.() -> Unit ): ContentGroup = contentFor(dri, platformData, kind, styles, extra, block) + fun breakLine(platformData: Set<PlatformData> = mainPlatformData) { + contents += ContentBreakLine(platformData) + } + fun platformDependentHint( dri: DRI = mainDRI, platformData: Set<PlatformData> = mainPlatformData, |