aboutsummaryrefslogtreecommitdiff
path: root/src/Formats
diff options
context:
space:
mode:
authorDmitry Jemerov <intelliyole@gmail.com>2015-12-03 12:13:17 +0100
committerDmitry Jemerov <intelliyole@gmail.com>2015-12-03 12:13:17 +0100
commit797cb4732c53bf1e3b2091add8cf731fc436607f (patch)
tree5470caa451bdea99c371793bcc5411e179d1df71 /src/Formats
parent610ca01d0e2d6443f19b4218b26863cdacce07f1 (diff)
parent90cf2ebccd12073a55ff6f187e5a378a2e96e23b (diff)
downloaddokka-797cb4732c53bf1e3b2091add8cf731fc436607f.tar.gz
dokka-797cb4732c53bf1e3b2091add8cf731fc436607f.tar.bz2
dokka-797cb4732c53bf1e3b2091add8cf731fc436607f.zip
Merge pull request #38 from mikehearn/style-css
Enable browsing of the output HTML with CSS
Diffstat (limited to 'src/Formats')
-rw-r--r--src/Formats/HtmlFormatService.kt7
-rw-r--r--src/Formats/HtmlTemplateService.kt9
2 files changed, 11 insertions, 5 deletions
diff --git a/src/Formats/HtmlFormatService.kt b/src/Formats/HtmlFormatService.kt
index e810ef7f..2c461905 100644
--- a/src/Formats/HtmlFormatService.kt
+++ b/src/Formats/HtmlFormatService.kt
@@ -3,6 +3,7 @@ package org.jetbrains.dokka
import com.google.inject.Inject
import com.google.inject.name.Named
import java.io.File
+import java.nio.file.Paths
public open class HtmlFormatService @Inject constructor(@Named("folders") locationService: LocationService,
signatureGenerator: LanguageService,
@@ -113,17 +114,19 @@ public open class HtmlFormatService @Inject constructor(@Named("folders") locati
override fun appendNodes(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
- templateService.appendHeader(to, getPageTitle(nodes))
+ templateService.appendHeader(to, getPageTitle(nodes), calcPathToRoot(location))
super.appendNodes(location, to, nodes)
templateService.appendFooter(to)
}
override fun appendOutline(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
- templateService.appendHeader(to, "Module Contents")
+ templateService.appendHeader(to, "Module Contents", calcPathToRoot(location))
super.appendOutline(location, to, nodes)
templateService.appendFooter(to)
}
+ private fun calcPathToRoot(location: Location) = Paths.get(location.path).parent.relativize(Paths.get(locationService.root.path + '/'))
+
override fun getOutlineFileName(location: Location): File {
return File("${location.path}-outline.html")
}
diff --git a/src/Formats/HtmlTemplateService.kt b/src/Formats/HtmlTemplateService.kt
index b9900757..ae42a31b 100644
--- a/src/Formats/HtmlTemplateService.kt
+++ b/src/Formats/HtmlTemplateService.kt
@@ -1,7 +1,9 @@
package org.jetbrains.dokka
+import java.nio.file.Path
+
public interface HtmlTemplateService {
- fun appendHeader(to: StringBuilder, title: String?)
+ fun appendHeader(to: StringBuilder, title: String?, basePath: Path)
fun appendFooter(to: StringBuilder)
companion object {
@@ -11,14 +13,15 @@ public interface HtmlTemplateService {
to.appendln("</BODY>")
to.appendln("</HTML>")
}
- override fun appendHeader(to: StringBuilder, title: String?) {
+ override fun appendHeader(to: StringBuilder, title: String?, basePath: Path) {
to.appendln("<HTML>")
to.appendln("<HEAD>")
if (title != null) {
to.appendln("<title>$title</title>")
}
if (css != null) {
- to.appendln("<link rel=\"stylesheet\" href=\"$css\">")
+ val cssPath = basePath.resolve(css)
+ to.appendln("<link rel=\"stylesheet\" href=\"$cssPath\">")
}
to.appendln("</HEAD>")
to.appendln("<BODY>")