diff options
Diffstat (limited to 'plugins/base/src')
3 files changed, 14 insertions, 9 deletions
diff --git a/plugins/base/src/main/kotlin/DokkaBase.kt b/plugins/base/src/main/kotlin/DokkaBase.kt index 5a7164d1..d84207a5 100644 --- a/plugins/base/src/main/kotlin/DokkaBase.kt +++ b/plugins/base/src/main/kotlin/DokkaBase.kt @@ -233,7 +233,7 @@ class DokkaBase : DokkaPlugin() { } val sourcesetDependencyAppender by extending { - htmlPreprocessors providing ::SourcesetDependencyAppender order { after(rootCreator) } applyIf { !delayTemplateSubstitution } + htmlPreprocessors providing ::SourcesetDependencyAppender order { after(rootCreator) } } val resolveLinkConsumer by extending { diff --git a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt index c5a92009..92f7324c 100644 --- a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt +++ b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt @@ -5,6 +5,8 @@ import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.DokkaBaseConfiguration import org.jetbrains.dokka.base.renderers.sourceSets import org.jetbrains.dokka.base.templating.AddToSearch +import org.jetbrains.dokka.base.templating.AddToSourcesetDependencies +import org.jetbrains.dokka.base.templating.toJsonString import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.* import org.jetbrains.dokka.pages.* @@ -169,15 +171,15 @@ class SourcesetDependencyAppender(val context: DokkaContext) : PageTransformer { it.sourceSetID to it.dependentSourceSets }.toMap() - fun createDependenciesJson(): String = "sourceset_dependencies = '{${ - dependenciesMap.entries.joinToString(", ") { - "\"${it.key}\": [${ - it.value.joinToString(",") { - "\"$it\"" + fun createDependenciesJson(): String = + dependenciesMap.map { (key, values) -> key.toString() to values.map { it.toString() } }.toMap() + .let { content -> + if (context.configuration.delayTemplateSubstitution) { + toJsonString(AddToSourcesetDependencies(context.configuration.moduleName, content)) + } else { + "sourceset_dependencies='${toJsonString(content)}'" } - }]" - } - }}'" + } val deps = RendererSpecificResourcePage( name = name, diff --git a/plugins/base/src/main/kotlin/templating/AddToSourcesetDependencies.kt b/plugins/base/src/main/kotlin/templating/AddToSourcesetDependencies.kt new file mode 100644 index 00000000..3f1680b7 --- /dev/null +++ b/plugins/base/src/main/kotlin/templating/AddToSourcesetDependencies.kt @@ -0,0 +1,3 @@ +package org.jetbrains.dokka.base.templating + +data class AddToSourcesetDependencies(val moduleName: String, val content: Map<String, List<String>>) : Command
\ No newline at end of file |