diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-12-02 05:21:10 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-12-02 05:21:10 +0300 |
commit | ff8948350406b085ca7feeb5d8aabd74b9eadf83 (patch) | |
tree | acf56d3fdd4a5cd455aeb8358bc15aa9d73de66f /core | |
parent | 1eab9404b8ecbd51e5270af0cc0c9545e68f35f2 (diff) | |
download | dokka-ff8948350406b085ca7feeb5d8aabd74b9eadf83.tar.gz dokka-ff8948350406b085ca7feeb5d8aabd74b9eadf83.tar.bz2 dokka-ff8948350406b085ca7feeb5d8aabd74b9eadf83.zip |
Fix outline file names, fix incorrect placement of support files
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/Generation/FileGenerator.kt | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/src/main/kotlin/Generation/FileGenerator.kt b/core/src/main/kotlin/Generation/FileGenerator.kt index 9c7c65e6..ea34a269 100644 --- a/core/src/main/kotlin/Generation/FileGenerator.kt +++ b/core/src/main/kotlin/Generation/FileGenerator.kt @@ -17,11 +17,14 @@ class FileGenerator @Inject constructor(@Named("outputDir") val rootFile: File) override val root: File = rootFile override fun location(node: DocumentationNode): FileLocation { - return FileLocation(File(rootFile, relativePathToNode(node.path.map { it.name }, node.members.any())).appendExtension(formatService.extension)) + return locationWithoutExtension(node).let { it.copy(file = it.file.appendExtension(formatService.linkExtension)) } + } + + fun locationWithoutExtension(node: DocumentationNode): FileLocation { + return FileLocation(File(rootFile, relativePathToNode(node.path.map { it.name }, node.members.any()))) } override fun buildPages(nodes: Iterable<DocumentationNode>) { - //val specificLocationService = locationService.withExtension(formatService.extension) for ((location, items) in nodes.groupBy { location(it) }) { val file = location.file @@ -41,7 +44,7 @@ class FileGenerator @Inject constructor(@Named("outputDir") val rootFile: File) override fun buildOutlines(nodes: Iterable<DocumentationNode>) { val outlineService = this.outlineService ?: return - for ((location, items) in nodes.groupBy { location(it) }) { + for ((location, items) in nodes.groupBy { locationWithoutExtension(it) }) { val file = outlineService.getOutlineFileName(location) file.parentFile?.mkdirsOrFail() FileOutputStream(file).use { @@ -54,7 +57,7 @@ class FileGenerator @Inject constructor(@Named("outputDir") val rootFile: File) override fun buildSupportFiles() { formatService.enumerateSupportFiles { resource, targetPath -> - FileOutputStream(relativePathToNode(listOf(targetPath), false)).use { + FileOutputStream(File(root, relativePathToNode(listOf(targetPath), false))).use { javaClass.getResourceAsStream(resource).copyTo(it) } } |