diff options
author | Vadim Mishenev <vad-mishenev@yandex.ru> | 2023-08-08 17:15:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-08 17:15:51 +0300 |
commit | 2fd8e9096706545f8b77e1e66bcc876d7e29f82c (patch) | |
tree | ae26f4e51569440928692859d5ecd11ade69e587 /plugins/base/src/main/kotlin/renderers | |
parent | 80549e1f061d1eb22b12fc9a068536655ae299f7 (diff) | |
download | dokka-2fd8e9096706545f8b77e1e66bcc876d7e29f82c.tar.gz dokka-2fd8e9096706545f8b77e1e66bcc876d7e29f82c.tar.bz2 dokka-2fd8e9096706545f8b77e1e66bcc876d7e29f82c.zip |
Fix and refactor Sample Transformer (#3102)
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/innerTemplating/DefaultTemplateModelFactory.kt | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/innerTemplating/DefaultTemplateModelFactory.kt b/plugins/base/src/main/kotlin/renderers/html/innerTemplating/DefaultTemplateModelFactory.kt index aae2f65d..4f4cdd7c 100644 --- a/plugins/base/src/main/kotlin/renderers/html/innerTemplating/DefaultTemplateModelFactory.kt +++ b/plugins/base/src/main/kotlin/renderers/html/innerTemplating/DefaultTemplateModelFactory.kt @@ -91,29 +91,30 @@ class DefaultTemplateModelFactory(val context: DokkaContext) : TemplateModelFact get() = URI(this).isAbsolute private fun Appendable.resourcesForPage(pathToRoot: String, resources: List<String>): Unit = - resources.forEach { + resources.forEach { resource -> + val resourceHtml = with(createHTML()) { when { - it.URIExtension == "css" -> + + resource.URIExtension == "css" -> link( rel = LinkRel.stylesheet, - href = if (it.isAbsolute) it else "$pathToRoot$it" + href = if (resource.isAbsolute) resource else "$pathToRoot$resource" ) - it.URIExtension == "js" -> + resource.URIExtension == "js" -> script( type = ScriptType.textJavaScript, - src = if (it.isAbsolute) it else "$pathToRoot$it" + src = if (resource.isAbsolute) resource else "$pathToRoot$resource" ) { - if (it == "scripts/main.js" || it.endsWith("_deferred.js")) + if (resource == "scripts/main.js" || resource.endsWith("_deferred.js")) defer = true else async = true } - it.isImage() -> link(href = if (it.isAbsolute) it else "$pathToRoot$it") + resource.isImage() -> link(href = if (resource.isAbsolute) resource else "$pathToRoot$resource") else -> null } } - if (resourceHtml != null) { append(resourceHtml) } |