diff options
Diffstat (limited to 'core/src/main/kotlin/Locations')
3 files changed, 11 insertions, 9 deletions
diff --git a/core/src/main/kotlin/Locations/FoldersLocationService.kt b/core/src/main/kotlin/Locations/FoldersLocationService.kt index 89b34ed1..83e1cf6a 100644 --- a/core/src/main/kotlin/Locations/FoldersLocationService.kt +++ b/core/src/main/kotlin/Locations/FoldersLocationService.kt @@ -4,8 +4,9 @@ import com.google.inject.Inject import com.google.inject.name.Named import java.io.File -public fun FoldersLocationService(root: String): FoldersLocationService = FoldersLocationService(File(root), "") -public class FoldersLocationService @Inject constructor(@Named("outputDir") val rootFile: File, val extension: String) : FileLocationService { +class FoldersLocationService @Inject constructor(@Named("outputDir") val rootFile: File, val extension: String) : FileLocationService { + constructor(root: String): this(File(root), "") + override val root: Location get() = FileLocation(rootFile) diff --git a/core/src/main/kotlin/Locations/LocationService.kt b/core/src/main/kotlin/Locations/LocationService.kt index 80bc0236..63c236ed 100644 --- a/core/src/main/kotlin/Locations/LocationService.kt +++ b/core/src/main/kotlin/Locations/LocationService.kt @@ -2,7 +2,7 @@ package org.jetbrains.dokka import java.io.File -public interface Location { +interface Location { val path: String get fun relativePathTo(other: Location, anchor: String? = null): String } @@ -15,7 +15,7 @@ public interface Location { * $file: [File] for this location * $path: [String] representing path of this location */ -public data class FileLocation(val file: File): Location { +data class FileLocation(val file: File): Location { override val path : String get() = file.path @@ -41,7 +41,7 @@ public data class FileLocation(val file: File): Location { * * [SingleFolderLocationService] – all documentation is generated into single folder using fully qualified names * for file names. */ -public interface LocationService { +interface LocationService { fun withExtension(newExtension: String) = this fun location(node: DocumentationNode): Location = location(node.path.map { it.name }, node.members.any()) @@ -56,7 +56,7 @@ public interface LocationService { } -public interface FileLocationService: LocationService { +interface FileLocationService: LocationService { override fun withExtension(newExtension: String): FileLocationService = this override fun location(node: DocumentationNode): FileLocation = location(node.path.map { it.name }, node.members.any()) @@ -64,7 +64,7 @@ public interface FileLocationService: LocationService { } -public fun identifierToFilename(path: String): String { +fun identifierToFilename(path: String): String { val escaped = path.replace('<', '-').replace('>', '-') val lowercase = escaped.replace("[A-Z]".toRegex()) { matchResult -> "-" + matchResult.value.toLowerCase() } return if (lowercase == "index") "--index--" else lowercase diff --git a/core/src/main/kotlin/Locations/SingleFolderLocationService.kt b/core/src/main/kotlin/Locations/SingleFolderLocationService.kt index e313ac28..1b4fdc28 100644 --- a/core/src/main/kotlin/Locations/SingleFolderLocationService.kt +++ b/core/src/main/kotlin/Locations/SingleFolderLocationService.kt @@ -4,8 +4,9 @@ import com.google.inject.Inject import com.google.inject.name.Named import java.io.File -public fun SingleFolderLocationService(root: String): SingleFolderLocationService = SingleFolderLocationService(File(root), "") -public class SingleFolderLocationService @Inject constructor(@Named("outputDir") val rootFile: File, val extension: String) : FileLocationService { +class SingleFolderLocationService @Inject constructor(@Named("outputDir") val rootFile: File, val extension: String) : FileLocationService { + constructor(root: String): this(File(root), "") + override fun withExtension(newExtension: String): FileLocationService = SingleFolderLocationService(rootFile, newExtension) |