aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorBłażej Kardyś <bkardys@virtuslab.com>2020-03-11 13:05:14 +0100
committerBłażej Kardyś <bkardys@virtuslab.com>2020-03-11 13:10:16 +0100
commit5636115aee8d13870f0d3f172667fca1b3f78276 (patch)
treea7b3621bf88ee298887e57dcbcd039f5df1f34cd /plugins
parent11b223daa2c54d2b86efb5e6054fd7205ed0b37a (diff)
downloaddokka-5636115aee8d13870f0d3f172667fca1b3f78276.tar.gz
dokka-5636115aee8d13870f0d3f172667fca1b3f78276.tar.bz2
dokka-5636115aee8d13870f0d3f172667fca1b3f78276.zip
Classlike header and other ui fixes
Diffstat (limited to 'plugins')
-rw-r--r--plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt1
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt14
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt6
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt1
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/JavadocParser.kt4
5 files changed, 19 insertions, 7 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt
index 33be5dfe..0e0001b9 100644
--- a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt
@@ -81,6 +81,7 @@ abstract class DefaultRenderer<T>(
is ContentList -> buildList(node, pageContext, platformRestriction)
is ContentTable -> buildTable(node, pageContext, platformRestriction)
is ContentGroup -> buildGroup(node, pageContext, platformRestriction)
+ is ContentBreakLine -> buildNewLine()
is PlatformHintedContent -> buildPlatformDependent(node, pageContext)
else -> buildError(node)
}
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index aaa9c0a4..390730a3 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -172,10 +172,16 @@ open class HtmlRenderer(
language: String,
pageContext: ContentPage
) {
- buildNewLine()
- code.forEach {
- +((it as? ContentText)?.text ?: run { context.logger.error("Cannot cast $it as ContentText!"); "" })
- buildNewLine()
+ span(classes = "code") {
+ val iterator = code.iterator()
+ while (iterator.hasNext()) {
+ val element = iterator.next()
+ +((element as? ContentText)?.text
+ ?: run { context.logger.error("Cannot cast $element as ContentText!"); "" })
+ if (iterator.hasNext()) {
+ buildNewLine()
+ }
+ }
}
}
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 900f5c19..5332b0f8 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
@@ -41,6 +41,11 @@ object DocTagToContentConverter : CommentsToContentConverter {
)
)
+ fun buildNewLine() = listOf(ContentBreakLine(
+ dci,
+ platforms
+ ))
+
return when (docTag) {
is H1 -> buildHeader(1)
is H2 -> buildHeader(2)
@@ -51,6 +56,7 @@ object DocTagToContentConverter : CommentsToContentConverter {
is Ul -> buildList(false)
is Ol -> buildList(true)
is Li -> buildChildren(docTag)
+ is Br -> buildNewLine()
is B -> buildChildren(docTag, setOf(TextStyle.Strong))
is I -> buildChildren(docTag, setOf(TextStyle.Italic))
is P -> buildChildren(docTag, newStyles = setOf(TextStyle.Paragraph))
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
index c82af936..3fc9592a 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
@@ -76,6 +76,7 @@ open class DefaultPageCreator(
}
protected open fun contentForClasslike(c: Classlike) = contentBuilder.contentFor(c) {
+ header(1) { text(c.name.orEmpty()) }
+buildSignature(c)
+contentForComments(c)
diff --git a/plugins/base/src/main/kotlin/translators/psi/JavadocParser.kt b/plugins/base/src/main/kotlin/translators/psi/JavadocParser.kt
index 5b9af028..a791f256 100644
--- a/plugins/base/src/main/kotlin/translators/psi/JavadocParser.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/JavadocParser.kt
@@ -59,7 +59,6 @@ class JavadocParser(
is PsiInlineDocTag -> listOfNotNull(convertInlineDocTag(it))
is PsiDocParamRef -> listOfNotNull(it.toDocumentationLink())
is PsiDocTagValue,
- is PsiWhiteSpace -> listOfNotNull(Text(it.text))
is LeafPsiElement -> Jsoup.parse(it.text).body().childNodes().mapNotNull { convertHtmlNode(it) }
else -> null
}
@@ -74,7 +73,7 @@ class JavadocParser(
private fun createBlock(element: Element): DocTag {
val children = element.childNodes().mapNotNull { convertHtmlNode(it) }
return when (element.tagName()) {
- "p" -> P(children)
+ "p" -> P(listOf(Br, Br) + children)
"b" -> B(children)
"strong" -> Strong(children)
"i" -> I(children)
@@ -85,7 +84,6 @@ class JavadocParser(
"ol" -> Ol(children)
"li" -> Li(children)
//"a" -> createLink(element, children) // TODO: add proper inline link handling
- "br" -> Br
else -> Text(body = element.ownText())
}
}