diff options
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 79e49d53..e73a36b2 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -14,6 +14,7 @@ import org.jetbrains.dokka.plugability.plugin import org.jetbrains.dokka.plugability.query import org.jetbrains.dokka.plugability.querySingle import java.io.File +import java.net.URI open class HtmlRenderer( context: DokkaContext @@ -493,6 +494,8 @@ open class HtmlRenderer( } } + private fun resolveLink(link: String, page: PageNode) : String = if (URI(link).isAbsolute) link else page.root(link) + open fun buildHtml(page: PageNode, resources: List<String>, content: FlowContent.() -> Unit) = createHTML().html { head { @@ -500,9 +503,9 @@ open class HtmlRenderer( title(page.name) with(resources) { filter { it.substringBefore('?').substringAfterLast('.') == "css" } - .forEach { link(rel = LinkRel.stylesheet, href = page.root(it)) } + .forEach { link(rel = LinkRel.stylesheet, href = resolveLink(it,page)) } filter { it.substringBefore('?').substringAfterLast('.') == "js" } - .forEach { script(type = ScriptType.textJavaScript, src = page.root(it)) { async = true } } + .forEach { script(type = ScriptType.textJavaScript, src = resolveLink(it,page)) { async = true } } } script { unsafe { +"""var pathToRoot = "${locationProvider.resolveRoot(page)}";""" } } } |