aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Formats
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin/Formats')
-rw-r--r--core/src/main/kotlin/Formats/HtmlFormatService.kt9
-rw-r--r--core/src/main/kotlin/Formats/HtmlTemplateService.kt6
-rw-r--r--core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt4
3 files changed, 7 insertions, 12 deletions
diff --git a/core/src/main/kotlin/Formats/HtmlFormatService.kt b/core/src/main/kotlin/Formats/HtmlFormatService.kt
index 560d8597..0073553c 100644
--- a/core/src/main/kotlin/Formats/HtmlFormatService.kt
+++ b/core/src/main/kotlin/Formats/HtmlFormatService.kt
@@ -80,7 +80,7 @@ open class HtmlOutputBuilder(to: StringBuilder,
}
override fun appendNodes(nodes: Iterable<DocumentationNode>) {
- templateService.appendHeader(to, getPageTitle(nodes), locationService.calcPathToRoot(location))
+ templateService.appendHeader(to, getPageTitle(nodes), generator.relativeToRoot(location))
super.appendNodes(nodes)
templateService.appendFooter(to)
}
@@ -108,7 +108,7 @@ open class HtmlFormatService @Inject constructor(generator: NodeLocationAwareGen
HtmlOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms, templateService)
override fun appendOutline(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
- templateService.appendHeader(to, "Module Contents", locationService.calcPathToRoot(location))
+ templateService.appendHeader(to, "Module Contents", generator.relativeToRoot(location))
super.appendOutline(location, to, nodes)
templateService.appendFooter(to)
}
@@ -132,11 +132,6 @@ open class HtmlFormatService @Inject constructor(generator: NodeLocationAwareGen
}
}
-private fun LocationService.calcPathToRoot(location: Location): Path {
- val path = Paths.get(location.path)
- return path.parent?.relativize(Paths.get(root.path + '/')) ?: path
-}
-
fun getPageTitle(nodes: Iterable<DocumentationNode>): String? {
val breakdownByLocation = nodes.groupBy { node -> formatPageTitle(node) }
return breakdownByLocation.keys.singleOrNull()
diff --git a/core/src/main/kotlin/Formats/HtmlTemplateService.kt b/core/src/main/kotlin/Formats/HtmlTemplateService.kt
index 22832e34..84e01910 100644
--- a/core/src/main/kotlin/Formats/HtmlTemplateService.kt
+++ b/core/src/main/kotlin/Formats/HtmlTemplateService.kt
@@ -1,9 +1,9 @@
package org.jetbrains.dokka
-import java.nio.file.Path
+import java.io.File
interface HtmlTemplateService {
- fun appendHeader(to: StringBuilder, title: String?, basePath: Path)
+ fun appendHeader(to: StringBuilder, title: String?, basePath: File)
fun appendFooter(to: StringBuilder)
companion object {
@@ -16,7 +16,7 @@ interface HtmlTemplateService {
to.appendln("</BODY>")
to.appendln("</HTML>")
}
- override fun appendHeader(to: StringBuilder, title: String?, relativePathToRoot: String) {
+ override fun appendHeader(to: StringBuilder, title: String?, basePath: File) {
to.appendln("<HTML>")
to.appendln("<HEAD>")
to.appendln("<meta charset=\"UTF-8\">")
diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt
index 208756c8..6ced75b5 100644
--- a/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt
+++ b/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt
@@ -4,13 +4,13 @@ import com.google.inject.Inject
import com.google.inject.name.Named
import org.jetbrains.dokka.Utilities.impliedPlatformsName
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
-import java.nio.file.Path
+import java.io.File
object EmptyHtmlTemplateService : HtmlTemplateService {
override fun appendFooter(to: StringBuilder) {}
- override fun appendHeader(to: StringBuilder, title: String?, basePath: Path) {}
+ override fun appendHeader(to: StringBuilder, title: String?, basePath: File) {}
}