aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-03-11 13:56:21 +0100
committerKamil Doległo <kamilok1965@users.noreply.github.com>2020-03-11 14:36:37 +0100
commit356be7009f857032f87bf0e5943cdef7f1438f65 (patch)
tree3b865af714b103a10a837c86ef7bb3b25071f67a /plugins
parent5636115aee8d13870f0d3f172667fca1b3f78276 (diff)
downloaddokka-356be7009f857032f87bf0e5943cdef7f1438f65.tar.gz
dokka-356be7009f857032f87bf0e5943cdef7f1438f65.tar.bz2
dokka-356be7009f857032f87bf0e5943cdef7f1438f65.zip
Refactor brief documentation, remove `Parameters` block from functions' pages
Diffstat (limited to 'plugins')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt1
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt47
2 files changed, 33 insertions, 15 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 390730a3..2af547b8 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -28,6 +28,7 @@ open class HtmlRenderer(
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()
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
index 3fc9592a..b92c058a 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
@@ -4,8 +4,6 @@ import org.jetbrains.dokka.base.signatures.SignatureProvider
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Annotation
-import org.jetbrains.dokka.model.Enum
import org.jetbrains.dokka.model.Function
import org.jetbrains.dokka.model.doc.TagWrapper
import org.jetbrains.dokka.pages.*
@@ -45,8 +43,8 @@ open class DefaultPageCreator(
block("Packages", 2, ContentKind.Packages, m.packages, m.platformData.toSet()) {
link(it.name, it.dri)
}
- text("Index\n")
- text("Link to allpage here")
+// text("Index\n") TODO
+// text("Link to allpage here")
}
protected open fun contentForPackage(p: Package) = contentBuilder.contentFor(p) {
@@ -61,17 +59,28 @@ open class DefaultPageCreator(
) = contentBuilder.contentFor(s as Documentable) {
block("Types", 2, ContentKind.Classlikes, s.classlikes, platformData.toSet()) {
link(it.name.orEmpty(), it.dri)
- +buildSignature(it)
- text(it.briefDocTagString)
+ group {
+ +buildSignature(it)
+ group(kind = ContentKind.BriefComment) {
+ text(it.briefDocumentation())
+ }
+ }
}
block("Functions", 2, ContentKind.Functions, s.functions, platformData.toSet()) {
link(it.name, it.dri)
- +buildSignature(it)
- text(it.briefDocTagString)
+ group {
+ +buildSignature(it)
+ group(kind = ContentKind.BriefComment) {
+ text(it.briefDocumentation())
+ }
+ }
}
block("Properties", 2, ContentKind.Properties, s.properties, platformData.toSet()) {
link(it.name, it.dri)
- text(it.briefDocTagString)
+ group(kind = ContentKind.BriefComment) {
+ text(it.briefDocumentation())
+ }
+
}
}
@@ -83,8 +92,12 @@ open class DefaultPageCreator(
if (c is WithConstructors) {
block("Constructors", 2, ContentKind.Constructors, c.constructors, c.platformData.toSet()) {
link(it.name, it.dri)
- +buildSignature(it)
- text(it.briefDocTagString)
+ group {
+ +buildSignature(it)
+ group(kind = ContentKind.BriefComment) {
+ text(it.briefDocumentation())
+ }
+ }
}
}
@@ -109,11 +122,15 @@ open class DefaultPageCreator(
header(1) { text(f.name) }
+buildSignature(f)
+contentForComments(f)
- block("Parameters", 2, ContentKind.Parameters, f.children, f.platformData.toSet()) {
- text(it.name ?: "<receiver>")
- it.documentation.forEach { it.value.children.forEach { comment(it.root) } }
- }
}
protected open fun TagWrapper.toHeaderString() = this.javaClass.toGenericString().split('.').last()
+
+ protected open fun Documentable.briefDocumentation() =
+ documentation.values
+ .firstOrNull()
+ ?.children
+ ?.firstOrNull()
+ ?.root
+ ?.docTagSummary() ?: ""
} \ No newline at end of file