aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/renderers/HtmlRenderer.kt
diff options
context:
space:
mode:
authorPaweł Marks <pmarks@virtuslab.com>2019-11-20 08:09:59 +0100
committerBłażej Kardyś <bkardys@virtuslab.com>2019-11-25 16:24:16 +0100
commit87c65d1bf22dc0dbc6da8d007fafc73382432812 (patch)
tree6191094093bd0162c7adf3b5ca16474c2448f74d /core/src/main/kotlin/renderers/HtmlRenderer.kt
parent8a057a4611684a6a4616e136d480c005997070cd (diff)
downloaddokka-87c65d1bf22dc0dbc6da8d007fafc73382432812.tar.gz
dokka-87c65d1bf22dc0dbc6da8d007fafc73382432812.tar.bz2
dokka-87c65d1bf22dc0dbc6da8d007fafc73382432812.zip
Mathjax plugin implemented
Diffstat (limited to 'core/src/main/kotlin/renderers/HtmlRenderer.kt')
-rw-r--r--core/src/main/kotlin/renderers/HtmlRenderer.kt8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/src/main/kotlin/renderers/HtmlRenderer.kt b/core/src/main/kotlin/renderers/HtmlRenderer.kt
index f750140a..3b778671 100644
--- a/core/src/main/kotlin/renderers/HtmlRenderer.kt
+++ b/core/src/main/kotlin/renderers/HtmlRenderer.kt
@@ -4,6 +4,9 @@ import org.jetbrains.dokka.htmlEscape
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.resolvers.LocationProvider
import java.io.File
+import java.net.URL
+import java.nio.file.Path
+import java.nio.file.Paths
open class HtmlRenderer(fileWriter: FileWriter, locationProvider: LocationProvider) : DefaultRenderer(fileWriter, locationProvider) {
@@ -69,11 +72,16 @@ open class HtmlRenderer(fileWriter: FileWriter, locationProvider: LocationProvid
)
}
+ protected open fun buildScripts(page: PageNode) =
+ page.embeddedResources.filter { URL(it).path.substringAfterLast('.') == "js" }
+ .joinToString(separator = "") { """<script type = "text/javascript" async src = "$it"></script>""" + "\n" }
+
protected open fun buildStartHtml(page: PageNode) = """<!DOCTYPE html>
|<html>
|<head>
|<title>${page.name}</title>
|<link rel="stylesheet" href="${locationProvider.resolveRoot(page)}style.css" />
+ |${buildScripts(page)}
|</head>
|<body>
|""".trimMargin()