aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/pages/ContentNodes.kt9
-rw-r--r--core/src/main/resources/dokka/styles/style.css5
-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
7 files changed, 32 insertions, 8 deletions
diff --git a/core/src/main/kotlin/pages/ContentNodes.kt b/core/src/main/kotlin/pages/ContentNodes.kt
index 2e14dfb9..6a8ad3b3 100644
--- a/core/src/main/kotlin/pages/ContentNodes.kt
+++ b/core/src/main/kotlin/pages/ContentNodes.kt
@@ -25,6 +25,15 @@ data class ContentText(
override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentNode = copy(extra = newExtras)
}
+data class ContentBreakLine(
+ override val dci: DCI,
+ override val platforms: Set<PlatformData>,
+ override val style: Set<Style> = emptySet(),
+ override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
+): ContentNode {
+ override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentNode = copy(extra = newExtras)
+}
+
/** Headers */
data class ContentHeader(
override val children: List<ContentNode>,
diff --git a/core/src/main/resources/dokka/styles/style.css b/core/src/main/resources/dokka/styles/style.css
index 4a76dd96..9aa2eb10 100644
--- a/core/src/main/resources/dokka/styles/style.css
+++ b/core/src/main/resources/dokka/styles/style.css
@@ -41,6 +41,10 @@
pointer-events: all;
}
+.code {
+ font-family: sans-serif;
+}
+
.sideMenuPart > .navButton {
margin-left:0.25em
}
@@ -99,7 +103,6 @@ td:first-child {
h1, h2, h3, h4, h5, h6 {
color:#222;
- margin:0 0 20px;
}
p, ul, ol, table, pre, dl {
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())
}
}