diff options
-rw-r--r-- | core/src/main/kotlin/Formats/HtmlTemplateService.kt | 2 | ||||
-rw-r--r-- | core/src/main/kotlin/Locations/Location.kt | 10 | ||||
-rw-r--r-- | core/src/test/kotlin/format/FileGeneratorTestCase.kt | 7 |
3 files changed, 9 insertions, 10 deletions
diff --git a/core/src/main/kotlin/Formats/HtmlTemplateService.kt b/core/src/main/kotlin/Formats/HtmlTemplateService.kt index 84e01910..a65a7b18 100644 --- a/core/src/main/kotlin/Formats/HtmlTemplateService.kt +++ b/core/src/main/kotlin/Formats/HtmlTemplateService.kt @@ -24,7 +24,7 @@ interface HtmlTemplateService { to.appendln("<title>$title</title>") } if (css != null) { - val cssPath = basePath.resolve(css) + val cssPath = basePath.resolve(css).toUnixString() to.appendln("<link rel=\"stylesheet\" href=\"$cssPath\">") } to.appendln("</HEAD>") diff --git a/core/src/main/kotlin/Locations/Location.kt b/core/src/main/kotlin/Locations/Location.kt index 17538ff5..0e6572d9 100644 --- a/core/src/main/kotlin/Locations/Location.kt +++ b/core/src/main/kotlin/Locations/Location.kt @@ -13,8 +13,8 @@ interface Location { * $file: [File] for this location * $path: [String] representing path of this location */ -data class FileLocation(val file: File): Location { - override val path : String +data class FileLocation(val file: File) : Location { + override val path: String get() = file.path override fun relativePathTo(other: Location, anchor: String?): String { @@ -30,7 +30,6 @@ data class FileLocation(val file: File): Location { } } - fun relativePathToNode(qualifiedName: List<String>, hasMembers: Boolean): String { val parts = qualifiedName.map { identifierToFilename(it) }.filterNot { it.isEmpty() } return if (!hasMembers) { @@ -41,6 +40,7 @@ fun relativePathToNode(qualifiedName: List<String>, hasMembers: Boolean): String } } + fun relativePathToNode(node: DocumentationNode) = relativePathToNode(node.path.map { it.name }, node.members.any()) fun identifierToFilename(path: String): String { @@ -56,4 +56,6 @@ fun NodeLocationAwareGenerator.relativePathToLocation(owner: DocumentationNode, fun NodeLocationAwareGenerator.relativeToRoot(from: Location): File { val file = File(from.path) return file.relativeTo(root) -}
\ No newline at end of file +} + +fun File.toUnixString() = toString().replace(File.separatorChar, '/') diff --git a/core/src/test/kotlin/format/FileGeneratorTestCase.kt b/core/src/test/kotlin/format/FileGeneratorTestCase.kt index 644d5baa..948426ea 100644 --- a/core/src/test/kotlin/format/FileGeneratorTestCase.kt +++ b/core/src/test/kotlin/format/FileGeneratorTestCase.kt @@ -1,9 +1,6 @@ package org.jetbrains.dokka.tests -import org.jetbrains.dokka.DocumentationNode -import org.jetbrains.dokka.FileGenerator -import org.jetbrains.dokka.FormatService -import org.jetbrains.dokka.relativeToRoot +import org.jetbrains.dokka.* import org.junit.Before import org.junit.Rule import org.junit.rules.TemporaryFolder @@ -30,7 +27,7 @@ abstract class FileGeneratorTestCase { if (sb.isNotBlank() && !sb.endsWith('\n')) { sb.appendln() } - sb.appendln("<!-- File: ${relativeToRoot(loc)} -->") + sb.appendln("<!-- File: ${relativeToRoot(loc).toUnixString()} -->") } sb.append(loc.file.readText()) } |