aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src
diff options
context:
space:
mode:
authorBłażej Kardyś <bkardys@virtuslab.com>2020-11-20 17:23:10 +0100
committerBłażej Kardyś <bkardys@virtuslab.com>2020-11-27 03:15:02 +0100
commit3cb4702a68139788de6e1f7b087ced345f2b71ba (patch)
treea383471c9915ae4aaff078b4f3b81bb99a4fde35 /plugins/base/src
parent076a5f421c5e4621539efd814be612f43fef33f5 (diff)
downloaddokka-3cb4702a68139788de6e1f7b087ced345f2b71ba.tar.gz
dokka-3cb4702a68139788de6e1f7b087ced345f2b71ba.tar.bz2
dokka-3cb4702a68139788de6e1f7b087ced345f2b71ba.zip
Changing how multimodule location provider works and improving gfm link substitution
Diffstat (limited to 'plugins/base/src')
-rw-r--r--plugins/base/src/main/kotlin/DokkaBase.kt3
-rw-r--r--plugins/base/src/main/kotlin/generation/SingleModuleGeneration.kt2
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt1
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt3
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt4
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/DokkaBaseLocationProvider.kt5
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt4
-rw-r--r--plugins/base/src/main/kotlin/resolvers/shared/PackageList.kt5
-rw-r--r--plugins/base/src/main/kotlin/templating/ImmediateHtmlCommandConsumer.kt3
9 files changed, 11 insertions, 19 deletions
diff --git a/plugins/base/src/main/kotlin/DokkaBase.kt b/plugins/base/src/main/kotlin/DokkaBase.kt
index c4dacdcd..ac070ab4 100644
--- a/plugins/base/src/main/kotlin/DokkaBase.kt
+++ b/plugins/base/src/main/kotlin/DokkaBase.kt
@@ -32,8 +32,7 @@ import org.jetbrains.dokka.plugability.DokkaPlugin
import org.jetbrains.dokka.transformers.documentation.PreMergeDocumentableTransformer
import org.jetbrains.dokka.transformers.pages.PageTransformer
-class
-DokkaBase : DokkaPlugin() {
+class DokkaBase : DokkaPlugin() {
val preMergeDocumentableTransformer by extensionPoint<PreMergeDocumentableTransformer>()
val pageMergerStrategy by extensionPoint<PageMergerStrategy>()
diff --git a/plugins/base/src/main/kotlin/generation/SingleModuleGeneration.kt b/plugins/base/src/main/kotlin/generation/SingleModuleGeneration.kt
index eb405a3d..1689a1dd 100644
--- a/plugins/base/src/main/kotlin/generation/SingleModuleGeneration.kt
+++ b/plugins/base/src/main/kotlin/generation/SingleModuleGeneration.kt
@@ -8,6 +8,8 @@ import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.DokkaException
import org.jetbrains.dokka.Timer
import org.jetbrains.dokka.base.DokkaBase
+import org.jetbrains.dokka.generation.Generation
+import org.jetbrains.dokka.generation.exitGenerationGracefully
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.pages.RootPageNode
import org.jetbrains.dokka.plugability.DokkaContext
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index ba5329bf..3bafb8f5 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -712,7 +712,6 @@ open class HtmlRenderer(
buildHtml(page, page.embeddedResources) {
div("main-content") {
id = "content"
- // TODO: Investigate possible problem
attributes["pageIds"] = "${context.configuration.moduleName}::${page.pageId}"
content(this, page)
}
diff --git a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
index fbebec70..cc97bb72 100644
--- a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
@@ -70,7 +70,8 @@ open class NavigationSearchInstaller(val context: DokkaContext) : NavigationData
open class NavigationPageInstaller(val context: DokkaContext) : NavigationDataProvider(), PageTransformer {
override fun invoke(input: RootPageNode): RootPageNode =
- input.modified(children = input.children + NavigationPage(navigableChildren(input)))
+ input.modified(children = input.children + NavigationPage(navigableChildren(input),
+ (listOf(input) + input.children).firstOrNull { it is ContentPage && it.name.isNotBlank() }?.name.orEmpty()))
}
class CustomResourceInstaller(val dokkaContext: DokkaContext) : PageTransformer {
diff --git a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
index 293ca2d4..c956b308 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
@@ -4,7 +4,6 @@ import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.resolvers.external.ExternalLocationProvider
import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentation
import org.jetbrains.dokka.base.resolvers.shared.PackageList
-import org.jetbrains.dokka.base.resolvers.anchors.SymbolAnchorHint
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.DisplaySourceSet
import org.jetbrains.dokka.pages.RootPageNode
@@ -14,8 +13,7 @@ import org.jetbrains.dokka.plugability.query
abstract class DefaultLocationProvider(
protected val pageGraphRoot: RootPageNode,
- protected val dokkaContext: DokkaContext,
- protected val extension: String
+ protected val dokkaContext: DokkaContext
) : LocationProvider {
protected val externalLocationProviderFactories =
dokkaContext.plugin<DokkaBase>().query { externalLocationProviderFactory }
diff --git a/plugins/base/src/main/kotlin/resolvers/local/DokkaBaseLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DokkaBaseLocationProvider.kt
index b1213b19..fa133045 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/DokkaBaseLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/DokkaBaseLocationProvider.kt
@@ -8,9 +8,8 @@ import org.jetbrains.dokka.utilities.urlEncoded
abstract class DokkaBaseLocationProvider(
pageGraphRoot: RootPageNode,
- dokkaContext: DokkaContext,
- extension: String
-) : DefaultLocationProvider(pageGraphRoot, dokkaContext, extension) {
+ dokkaContext: DokkaContext
+) : DefaultLocationProvider(pageGraphRoot, dokkaContext) {
/**
* Anchors should be unique and should contain sourcesets, dri and contentKind.
diff --git a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt
index 437a1c58..c10029bc 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt
@@ -14,8 +14,8 @@ import java.util.*
open class DokkaLocationProvider(
pageGraphRoot: RootPageNode,
dokkaContext: DokkaContext,
- extension: String = ".html"
-) : DokkaBaseLocationProvider(pageGraphRoot, dokkaContext, extension) {
+ val extension: String = ".html"
+) : DokkaBaseLocationProvider(pageGraphRoot, dokkaContext) {
protected open val PAGE_WITH_CHILDREN_SUFFIX = "index"
protected open val pathsIndex: Map<PageNode, List<String>> = IdentityHashMap<PageNode, List<String>>().apply {
diff --git a/plugins/base/src/main/kotlin/resolvers/shared/PackageList.kt b/plugins/base/src/main/kotlin/resolvers/shared/PackageList.kt
index e4b8fb6f..089bda55 100644
--- a/plugins/base/src/main/kotlin/resolvers/shared/PackageList.kt
+++ b/plugins/base/src/main/kotlin/resolvers/shared/PackageList.kt
@@ -1,7 +1,6 @@
package org.jetbrains.dokka.base.resolvers.shared
import org.jetbrains.dokka.base.renderers.PackageListService
-import java.io.File
import java.net.URL
data class PackageList(
@@ -15,9 +14,6 @@ data class PackageList(
if (offlineMode && url.protocol.toLowerCase() != "file")
return null
- /*if (!File(url.file).isFile)
- return null*/
-
val packageListStream = url.readContent()
val (params, packages) = packageListStream
@@ -31,7 +27,6 @@ data class PackageList(
return PackageList(format, packages.filter(String::isNotBlank).toSet(), locations, url)
}
-
private fun splitParams(params: List<String>) = params.asSequence()
.map { it.removePrefix("${PackageListService.DOKKA_PARAM_PREFIX}.").split(":", limit = 2) }
.groupBy({ (key, _) -> key }, { (_, value) -> value })
diff --git a/plugins/base/src/main/kotlin/templating/ImmediateHtmlCommandConsumer.kt b/plugins/base/src/main/kotlin/templating/ImmediateHtmlCommandConsumer.kt
index a2a3b31e..2b721e8c 100644
--- a/plugins/base/src/main/kotlin/templating/ImmediateHtmlCommandConsumer.kt
+++ b/plugins/base/src/main/kotlin/templating/ImmediateHtmlCommandConsumer.kt
@@ -2,10 +2,9 @@ package org.jetbrains.dokka.base.templating
import org.jetbrains.dokka.base.renderers.html.TemplateBlock
import org.jetbrains.dokka.base.renderers.html.command.consumers.ImmediateResolutionTagConsumer
-import org.jetbrains.dokka.plugability.DokkaContext
interface ImmediateHtmlCommandConsumer {
- fun canProcess(command:Command): Boolean
+ fun canProcess(command: Command): Boolean
fun <R> processCommand(command: Command, block: TemplateBlock, tagConsumer: ImmediateResolutionTagConsumer<R>)