aboutsummaryrefslogtreecommitdiff
path: root/plugins/javadoc/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/javadoc/src')
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocDocumentableToPageTranslator.kt5
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt10
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt2
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocContentNodes.kt6
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/pages.kt17
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt2
-rw-r--r--plugins/javadoc/src/main/resources/views/components/head.korte2
-rw-r--r--plugins/javadoc/src/main/resources/views/components/indexPage.korte2
-rw-r--r--plugins/javadoc/src/main/resources/views/components/pageStart.korte29
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocModuleTemplateMapTest.kt4
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt2
11 files changed, 20 insertions, 61 deletions
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocDocumentableToPageTranslator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocDocumentableToPageTranslator.kt
index f8723f33..8cfd4911 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocDocumentableToPageTranslator.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocDocumentableToPageTranslator.kt
@@ -5,14 +5,15 @@ import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentCon
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.pages.ModulePageNode
import org.jetbrains.dokka.pages.RootPageNode
+import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.transformers.documentation.DocumentableToPageTranslator
import org.jetbrains.dokka.utilities.DokkaLogger
class JavadocDocumentableToPageTranslator(
- private val commentsToContentConverter: CommentsToContentConverter,
+ private val context: DokkaContext,
private val signatureProvider: SignatureProvider,
private val logger: DokkaLogger
) : DocumentableToPageTranslator {
override fun invoke(module: DModule): RootPageNode =
- JavadocPageCreator(commentsToContentConverter, signatureProvider, logger).pageForModule(module)
+ JavadocPageCreator(context, signatureProvider, logger).pageForModule(module)
} \ No newline at end of file
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt
index 0379a752..45d8c61f 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt
@@ -15,14 +15,16 @@ import org.jetbrains.dokka.model.doc.TagWrapper
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.model.properties.WithExtraProperties
import org.jetbrains.dokka.pages.*
+import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.utilities.DokkaLogger
import kotlin.reflect.KClass
open class JavadocPageCreator(
- commentsToContentConverter: CommentsToContentConverter,
+ context: DokkaContext,
private val signatureProvider: SignatureProvider,
val logger: DokkaLogger
) {
+ private val documentationVersion = context.configuration.moduleVersion
fun pageForModule(m: DModule): JavadocModulePageNode =
JavadocModulePageNode(
@@ -80,7 +82,7 @@ open class JavadocPageCreator(
JavadocContentKind.OverviewSummary,
m.jvmSourceSets.toDisplaySourceSets()
) {
- title(m.name, m.brief(), "0.0.1", dri = setOf(m.dri), kind = ContentKind.Main)
+ title(m.name, m.brief(), documentationVersion, dri = setOf(m.dri), kind = ContentKind.Main)
leafList(setOf(m.dri),
ContentKind.Packages, JavadocList(
"Packages", "Package",
@@ -99,7 +101,7 @@ open class JavadocPageCreator(
JavadocContentKind.PackageSummary,
p.jvmSourceSets.toDisplaySourceSets()
) {
- title(p.name, p.brief(), "0.0.1", dri = setOf(p.dri), kind = ContentKind.Packages)
+ title("Package ${p.name}", p.brief(), dri = setOf(p.dri), kind = ContentKind.Packages)
val rootList = p.classlikes.groupBy { it::class }.map { (key, value) ->
JavadocList(key.tabTitle, key.colTitle, value.map { c ->
RowJavadocListEntry(
@@ -133,7 +135,7 @@ open class JavadocPageCreator(
title(
c.name.orEmpty(),
c.brief(),
- "0.0.1",
+ documentationVersion,
parent = c.dri.packageName,
dri = setOf(c.dri),
kind = JavadocContentKind.Class
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt
index e86816a3..50eb319d 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt
@@ -30,7 +30,7 @@ class JavadocPlugin : DokkaPlugin() {
val pageTranslator by extending {
CoreExtensions.documentableToPageTranslator providing { context ->
JavadocDocumentableToPageTranslator(
- dokkaBasePlugin.querySingle { commentsToContentConverter },
+ context,
dokkaBasePlugin.querySingle { signatureProvider },
context.logger
)
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocContentNodes.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocContentNodes.kt
index 2b6ebb1c..6115cbff 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocContentNodes.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocContentNodes.kt
@@ -79,13 +79,13 @@ class JavaContentGroupBuilder(val sourceSets: Set<DisplaySourceSet>) {
data class TitleNode(
val title: String,
val subtitle: List<ContentNode>,
- val version: String,
+ val version: String?,
val parent: String?,
val dri: Set<DRI>,
val kind: Kind,
override val sourceSets: Set<DisplaySourceSet>
) : JavadocContentNode(dri, kind, sourceSets) {
- override fun hasAnyContent(): Boolean = !title.isBlank() || !version.isBlank() || subtitle.isNotEmpty()
+ override fun hasAnyContent(): Boolean = !title.isBlank() || !version.isNullOrBlank() || subtitle.isNotEmpty()
override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): TitleNode = this
@@ -96,7 +96,7 @@ data class TitleNode(
fun JavaContentGroupBuilder.title(
title: String,
subtitle: List<ContentNode>,
- version: String,
+ version: String? = null,
parent: String? = null,
dri: Set<DRI>,
kind: Kind
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/pages.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/pages.kt
deleted file mode 100644
index 14aa1903..00000000
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/pages.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.jetbrains.dokka.javadoc.pages
-
-internal const val jQueryVersion = "3.3.1"
-internal const val jQueryMigrateVersion = "3.0.1"
-
-//class PackageSummary(val page: PageNode) : RendererSpecificPage {
-// override val name = "package-summary"
-// override val children = emptyList<PageNode>()
-// override fun modified(name: String, children: List<PageNode>) = this
-//
-// override val strategy = RenderingStrategy.Write(content())
-//
-// private fun content(): String = pageStart(page.name, "0.0.1", page.name, "../") + // TODO
-// topNavbar(page, "???")
-//
-//}
-
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt
index 46cad6f5..f7305152 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt
@@ -22,7 +22,7 @@ internal class JavadocContentToTemplateMapTranslator(
) {
fun templateMapForPageNode(node: JavadocPageNode): TemplateMap =
- mapOf<String, Any?>(
+ mapOf(
"docName" to "docName", // todo docname
"pathToRoot" to pathToRoot(node),
"contextRoot" to node,
diff --git a/plugins/javadoc/src/main/resources/views/components/head.korte b/plugins/javadoc/src/main/resources/views/components/head.korte
index fff6a0c8..6db0b31e 100644
--- a/plugins/javadoc/src/main/resources/views/components/head.korte
+++ b/plugins/javadoc/src/main/resources/views/components/head.korte
@@ -1,5 +1,5 @@
<head>
- <title>{{ title }}</title>
+ <title>{{ title }} {% if version != null %}{{ version }} API {% endif %}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2020-03-25">
<link rel="stylesheet" type="text/css" href="{{ pathToRoot }}stylesheet.css" title="Style">
diff --git a/plugins/javadoc/src/main/resources/views/components/indexPage.korte b/plugins/javadoc/src/main/resources/views/components/indexPage.korte
index f57d4ddf..84679fad 100644
--- a/plugins/javadoc/src/main/resources/views/components/indexPage.korte
+++ b/plugins/javadoc/src/main/resources/views/components/indexPage.korte
@@ -1,6 +1,6 @@
<main role="main">
<div class="header">
- <h1 {{ h1Title(kind)|raw }}class="title">{{ title }}</h1>
+ <h1 {{ h1Title(kind)|raw }}class="title">{{ title }} {% if version != null %}{{ version }} API {% endif %}</h1>
</div>
<div class="header">
<div class="subtitle">
diff --git a/plugins/javadoc/src/main/resources/views/components/pageStart.korte b/plugins/javadoc/src/main/resources/views/components/pageStart.korte
deleted file mode 100644
index 92be7495..00000000
--- a/plugins/javadoc/src/main/resources/views/components/pageStart.korte
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE HTML>
-<!-- NewPage -->
-<html lang="en">
-<head>
-<title>$documentTitle ({{ title }} {{ version }} API)</title>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<meta name="dc.created" content="{{ curDate() }}">
-<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 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>
-<!--[if IE]>
-<script type="text/javascript" src="{{ pathToRoot }}jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
-<![endif]-->
-<script type="text/javascript" src="{{ pathToRoot }}jquery/jquery-{{ jQueryVersion() }}.js"></script>
-<script type="text/javascript" src="{{ pathToRoot }}jquery/jquery-migrate-{{ jQueryMigrateVersion() }}.js"></script>
-<script type="text/javascript" src="{{ pathToRoot }}jquery/jquery-ui.js"></script>
-</head>
-<body>
-<script type="text/javascript">
-var pathtoroot = "{{ pathToRoot }}";
-</script>
-<noscript>
-<div>JavaScript is disabled on your browser.</div>
-</noscript>
-<header role="banner">
-<nav role="navigation">
-<div class="fixedNav"> \ No newline at end of file
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocModuleTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocModuleTemplateMapTest.kt
index 8a999fb3..d192abde 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocModuleTemplateMapTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocModuleTemplateMapTest.kt
@@ -64,9 +64,11 @@ internal class JavadocModuleTemplateMapTest : AbstractJavadocTemplateMapTest() {
/src/com/test/package1/Test1.java
package com.test.package1;
public class Test1 {}
- """
+ """,
+ configuration = config.copy(moduleVersion = "1.2.3-SNAPSHOT")
) {
val moduleTemplateMap = singlePageOfType<JavadocModulePageNode>().templateMap
+ assertEquals("1.2.3-SNAPSHOT", moduleTemplateMap["version"])
val list = assertIsInstance<List<*>>(moduleTemplateMap["list"])
assertEquals(2, list.size, "Expected two entries in 'list'")
assertEquals("com.test.package0", assertIsInstance<RowJavadocListEntry>(list[0]).link.name)
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt
index 9816c11c..356e5772 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt
@@ -31,7 +31,7 @@ internal class JavadocPackageTemplateMapTest : AbstractJavadocTemplateMapTest()
val map = singlePageOfType<JavadocPackagePageNode>().templateMap
assertEquals("Class Summary", ((map["lists"] as List<*>).first() as Map<String, *>)["tabTitle"])
assertEquals("Class", ((map["lists"] as List<*>).first() as Map<String, *>)["colTitle"])
- assertEquals("com.test.package0", map["title"])
+ assertEquals("Package com.test.package0", map["title"])
assertEquals("", map["subtitle"])
assertEquals("package", map["kind"])