aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/translators
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2021-12-06 16:20:51 +0300
committerIgnat Beresnev <ignat.beresnev@jetbrains.com>2021-12-06 16:20:51 +0300
commitc68c05a1e8876e9b8555df7bcdfeaca3e100f0d1 (patch)
treed9c20d2118d6679175ef8ab9f7dfc6d49aba5af3 /plugins/base/src/main/kotlin/translators
parent35a69e0322fcd271dccadcc2ee8cbb61dcafe62e (diff)
downloaddokka-c68c05a1e8876e9b8555df7bcdfeaca3e100f0d1.tar.gz
dokka-c68c05a1e8876e9b8555df7bcdfeaca3e100f0d1.tar.bz2
dokka-c68c05a1e8876e9b8555df7bcdfeaca3e100f0d1.zip
Description list support for JavaDocs (#2213)
Diffstat (limited to 'plugins/base/src/main/kotlin/translators')
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt12
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt11
2 files changed, 21 insertions, 2 deletions
diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
index 7d4f5c05..8c3fcd84 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
@@ -173,6 +173,18 @@ open class PageContentBuilder(
contents += ListBuilder(true, mainDRI, sourceSets, kind, styles, extra).apply(operation).build()
}
+ fun descriptionList(
+ kind: Kind = ContentKind.Main,
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
+ styles: Set<Style> = mainStyles,
+ extra: PropertyContainer<ContentNode> = mainExtra,
+ operation: ListBuilder.() -> Unit = {}
+ ) {
+ contents += ListBuilder(false, mainDRI, sourceSets, kind, styles + ListStyle.DescriptionList, extra)
+ .apply(operation)
+ .build()
+ }
+
internal fun headers(vararg label: String) = contentFor(mainDRI, mainSourcesetData) {
label.forEach { text(it) }
}
diff --git a/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt b/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt
index d74a1ca4..f9f591b2 100644
--- a/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt
@@ -14,17 +14,21 @@ import org.jetbrains.dokka.base.parsers.MarkdownParser
import org.jetbrains.dokka.base.translators.parseHtmlEncodedWithNormalisedSpaces
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.doc.*
+import org.jetbrains.dokka.model.doc.Deprecated
import org.jetbrains.dokka.utilities.DokkaLogger
import org.jetbrains.dokka.utilities.enumValueOrNull
+import org.jetbrains.dokka.utilities.htmlEscape
import org.jetbrains.kotlin.idea.kdoc.resolveKDocLink
import org.jetbrains.kotlin.idea.refactoring.fqName.getKotlinFqName
import org.jetbrains.kotlin.idea.util.CommentSaver.Companion.tokenType
import org.jetbrains.kotlin.psi.psiUtil.getNextSiblingIgnoringWhitespace
import org.jetbrains.kotlin.psi.psiUtil.siblings
import org.jsoup.Jsoup
-import org.jsoup.nodes.*
+import org.jsoup.nodes.Comment
+import org.jsoup.nodes.Element
+import org.jsoup.nodes.Node
+import org.jsoup.nodes.TextNode
import java.util.*
-import org.jetbrains.dokka.utilities.htmlEscape
interface JavaDocumentationParser {
fun parseDocumentation(element: PsiNamedElement): DocumentationNode
@@ -396,6 +400,9 @@ class JavadocParser(
"ul" -> ifChildrenPresent { Ul(children) }
"ol" -> ifChildrenPresent { Ol(children) }
"li" -> listOf(Li(children))
+ "dl" -> ifChildrenPresent { Dl(children) }
+ "dt" -> listOf(Dt(children))
+ "dd" -> listOf(Dd(children))
"a" -> listOf(createLink(element, children))
"table" -> ifChildrenPresent { Table(children) }
"tr" -> ifChildrenPresent { Tr(children) }