aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/base/.gitignore2
-rw-r--r--plugins/javadoc/build.gradle.kts1
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt24
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt5
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt18
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt2
-rw-r--r--plugins/javadoc/src/main/resources/views/components/head.korte2
-rw-r--r--plugins/javadoc/src/main/resources/views/components/subNav.korte2
8 files changed, 37 insertions, 19 deletions
diff --git a/plugins/base/.gitignore b/plugins/base/.gitignore
new file mode 100644
index 00000000..a259cd26
--- /dev/null
+++ b/plugins/base/.gitignore
@@ -0,0 +1,2 @@
+src/main/resources/dokka/scripts/main.js
+src/main/resources/dokka/scripts/main.js.map \ No newline at end of file
diff --git a/plugins/javadoc/build.gradle.kts b/plugins/javadoc/build.gradle.kts
index 4414b1dd..1f39c3a1 100644
--- a/plugins/javadoc/build.gradle.kts
+++ b/plugins/javadoc/build.gradle.kts
@@ -14,6 +14,7 @@ dependencies {
implementation("com.soywiz.korlibs.korte:korte-jvm:1.10.3")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.10")
implementation(project(":plugins:base"))
+ implementation(project(":plugins:kotlin-as-java"))
}
configureBintrayPublication("javadocPlugin")
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt b/plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt
index f5ca4bb3..64fc539f 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt
@@ -4,15 +4,20 @@ import javadoc.pages.*
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.base.signatures.SignatureProvider
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
+import org.jetbrains.dokka.base.transformers.pages.comments.DocTagToContentConverter
import org.jetbrains.dokka.model.*
+import org.jetbrains.dokka.model.doc.Description
import org.jetbrains.dokka.pages.ContentKind
+import org.jetbrains.dokka.pages.DCI
import org.jetbrains.dokka.utilities.DokkaLogger
+import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
open class JavadocPageCreator(
commentsToContentConverter: CommentsToContentConverter,
- signatureProvider: SignatureProvider,
+ val signatureProvider: SignatureProvider,
val logger: DokkaLogger
) {
+
fun pageForModule(m: DModule): JavadocModulePageNode =
JavadocModulePageNode(
m.name.ifEmpty { "root" },
@@ -46,12 +51,18 @@ open class JavadocPageCreator(
) {
title(m.name, "0.0.1", dri = setOf(m.dri), kind = ContentKind.Main)
list("Packages", "Package", setOf(m.dri), ContentKind.Packages, m.packages.map { p ->
- val doc = p.documentation.entries.find { (k, _) -> k.platform == Platform.jvm }?.value?.let {
- it.children.joinToString("\n") { it.root.toString() }
+ val description = p.documentation.entries.find { (k, _) -> k.platform == Platform.jvm }?.value?.let {
+ it.children.firstIsInstanceOrNull<Description>()?.let { description ->
+ DocTagToContentConverter.buildContent(
+ description.root,
+ DCI(setOf(p.dri), JavadocContentKind.OverviewSummary),
+ sourceSets
+ )
+ }
}.orEmpty()
RowJavadocListEntry(
LinkJavadocListEntry(p.name, setOf(p.dri), JavadocContentKind.PackageSummary, sourceSets),
- doc
+ description
)
})
}
@@ -64,12 +75,9 @@ open class JavadocPageCreator(
) {
title(p.name, "0.0.1", dri = setOf(p.dri), kind = ContentKind.Packages)
list("Packages", "Package", setOf(p.dri), ContentKind.Packages, p.classlikes.map { c ->
- val doc = c.documentation.entries.find { (k, _) -> k.platform == Platform.jvm }?.value?.let {
- it.children.joinToString("\n") { it.root.toString() }
- }.orEmpty()
RowJavadocListEntry(
LinkJavadocListEntry(c.name.orEmpty(), setOf(c.dri), JavadocContentKind.Class, sourceSets),
- doc
+ listOf(signatureProvider.signature(c))
)
})
}
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt b/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt
index f58faa49..a90e46db 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt
@@ -6,6 +6,7 @@ import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.plugability.DokkaPlugin
import org.jetbrains.dokka.plugability.querySingle
+import org.jetbrains.dokka.kotlinAsJava.signatures.JavaSignatureProvider
class JavadocPlugin : DokkaPlugin() {
val dokkaJavadocPlugin by extending {
@@ -17,11 +18,11 @@ class JavadocPlugin : DokkaPlugin() {
val pageTranslator by extending {
val dokkaBasePlugin = plugin<DokkaBase>()
- CoreExtensions.documentableToPageTranslator providing { ctx ->
+ CoreExtensions.documentableToPageTranslator providing { context ->
JavadocDocumentableToPageTranslator(
dokkaBasePlugin.querySingle { commentsToContentConverter },
dokkaBasePlugin.querySingle { signatureProvider },
- ctx.logger
+ context.logger
)
}
}
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt b/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt
index a16812a8..aa7c2dfe 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt
@@ -8,10 +8,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import org.jetbrains.dokka.base.renderers.OutputWriter
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.pages.PageNode
-import org.jetbrains.dokka.pages.RendererSpecificPage
-import org.jetbrains.dokka.pages.RenderingStrategy
-import org.jetbrains.dokka.pages.RootPageNode
+import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.renderers.Renderer
import java.nio.file.Path
@@ -62,7 +59,7 @@ class KorteJavadocRenderer(val outputWriter: OutputWriter, val context: DokkaCon
private fun CoroutineScope.renderJavadocNode(node: JavadocPageNode) {
val link = locationProvider.resolve(node, skipExtension = true)
val dir = Paths.get(link).parent?.let { it.toNormalized() }.orEmpty()
- val pathToRoot = dir.split("/").joinToString("/") { ".." }.let {
+ val pathToRoot = dir.split("/").filter { it.isNotEmpty()} .joinToString("/") { ".." }.let {
if (it.isNotEmpty()) "$it/" else it
}
@@ -123,6 +120,15 @@ class KorteJavadocRenderer(val outputWriter: OutputWriter, val context: DokkaCon
)
}
+ private fun renderContentNode(content: ContentNode) = when(content) {
+ is ContentText -> content.text
+ is ContentComposite -> renderContent(content.children)
+ else -> ""
+ }
+
+ private fun renderContent(content: List<ContentNode>): String =
+ content.joinToString("") { renderContentNode(it) }
+
fun getTemplateConfig() = TemplateConfig().also { config ->
listOf(
TeFunction("curDate") { LocalDate.now() },
@@ -133,7 +139,7 @@ class KorteJavadocRenderer(val outputWriter: OutputWriter, val context: DokkaCon
TeFunction("createTabRow") { args ->
val (link, doc) = args.first() as RowJavadocListEntry
val dir = args[1] as String?
- (createLinkTag(locationProvider.resolve(link, dir.orEmpty()), link.name) to doc).pairToTag().trim()
+ (createLinkTag(locationProvider.resolve(link, dir.orEmpty()), link.name) to renderContent(doc)).pairToTag().trim()
},
TeFunction("createListRow") { args ->
val link = args.first() as LinkJavadocListEntry
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt b/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt
index df026be3..031ce970 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt
@@ -142,7 +142,7 @@ class LinkJavadocListEntry(
}
}
-data class RowJavadocListEntry(val link: LinkJavadocListEntry, val doc: String) : JavadocListEntry {
+data class RowJavadocListEntry(val link: LinkJavadocListEntry, val doc: List<ContentNode>) : JavadocListEntry {
override val stringTag: String = ""
}
diff --git a/plugins/javadoc/src/main/resources/views/components/head.korte b/plugins/javadoc/src/main/resources/views/components/head.korte
index 758e6fbc..d742a7a9 100644
--- a/plugins/javadoc/src/main/resources/views/components/head.korte
+++ b/plugins/javadoc/src/main/resources/views/components/head.korte
@@ -6,7 +6,7 @@
<link rel="stylesheet" type="text/css" href="{{ pathToRoot }}stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="{{ pathToRoot }}jquery/jquery-ui.css" title="Style">
<script src="{{ pathToRoot }}tag-search-index.js"></script>
- <script src="{{ pathToRoot }} jquery/jszip/dist/jszip.js"></script>
+ <script src="{{ pathToRoot }}jquery/jszip/dist/jszip.js"></script>
<script type="text/javascript" src="{{ pathToRoot }}script.js"></script>
<script type="text/javascript" src="{{ pathToRoot }}jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="{{ pathToRoot }}jquery/jszip-utils/dist/jszip-utils.min.js"></script>
diff --git a/plugins/javadoc/src/main/resources/views/components/subNav.korte b/plugins/javadoc/src/main/resources/views/components/subNav.korte
index 9cfbf588..69d8467d 100644
--- a/plugins/javadoc/src/main/resources/views/components/subNav.korte
+++ b/plugins/javadoc/src/main/resources/views/components/subNav.korte
@@ -1,6 +1,6 @@
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top" style="display: block;">
-<li><a href="../allclasses.html">All&nbsp;Classes</a></li>
+<li><a href="{{ pathToRoot }}allclasses.html">All&nbsp;Classes</a></li>
</ul>
{% if type != "bottom" %}
<ul class="navListSearch">