diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-12-03 17:08:23 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-12-03 17:08:23 +0100 |
commit | c14cfa23bc65aeaf1e74ae982459fa0321d7e615 (patch) | |
tree | 73efeaeea0d1702b9b482a25088c0a890ba3ada7 /core/src/main/kotlin | |
parent | 334f25c392aa72ee76e4c4aaf0676b7f57c4a20c (diff) | |
download | dokka-c14cfa23bc65aeaf1e74ae982459fa0321d7e615.tar.gz dokka-c14cfa23bc65aeaf1e74ae982459fa0321d7e615.tar.bz2 dokka-c14cfa23bc65aeaf1e74ae982459fa0321d7e615.zip |
allow each format service to provide its own support files
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r-- | core/src/main/kotlin/Formats/FormatService.kt | 4 | ||||
-rw-r--r-- | core/src/main/kotlin/Formats/HtmlFormatService.kt | 4 | ||||
-rw-r--r-- | core/src/main/kotlin/Generation/FileGenerator.kt | 6 |
3 files changed, 11 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Formats/FormatService.kt b/core/src/main/kotlin/Formats/FormatService.kt index 7e66a6b7..73e54956 100644 --- a/core/src/main/kotlin/Formats/FormatService.kt +++ b/core/src/main/kotlin/Formats/FormatService.kt @@ -6,7 +6,6 @@ package org.jetbrains.dokka * Bundled Formatters: * * [HtmlFormatService] – outputs documentation to HTML format * * [MarkdownFormatService] – outputs documentation in Markdown format - * * [TextFormatService] – outputs documentation in Text format */ public interface FormatService { /** Returns extension for output files */ @@ -14,6 +13,9 @@ public interface FormatService { /** Appends formatted content to [StringBuilder](to) using specified [location] */ fun appendNodes(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) + + fun enumerateSupportFiles(callback: (resource: String, targetPath: String) -> Unit) { + } } /** Format content to [String] using specified [location] */ diff --git a/core/src/main/kotlin/Formats/HtmlFormatService.kt b/core/src/main/kotlin/Formats/HtmlFormatService.kt index 4d45e6cb..a58319bc 100644 --- a/core/src/main/kotlin/Formats/HtmlFormatService.kt +++ b/core/src/main/kotlin/Formats/HtmlFormatService.kt @@ -149,6 +149,10 @@ public open class HtmlFormatService @Inject constructor(@Named("folders") locati } override fun formatNonBreakingSpace(): String = " " + + override fun enumerateSupportFiles(callback: (String, String) -> Unit) { + callback("/dokka/styles/style.css", "style.css") + } } fun getPageTitle(nodes: Iterable<DocumentationNode>): String? { diff --git a/core/src/main/kotlin/Generation/FileGenerator.kt b/core/src/main/kotlin/Generation/FileGenerator.kt index a762bae3..e3d1d1fe 100644 --- a/core/src/main/kotlin/Generation/FileGenerator.kt +++ b/core/src/main/kotlin/Generation/FileGenerator.kt @@ -44,8 +44,10 @@ public class FileGenerator @Inject constructor(val locationService: FileLocation } override fun buildSupportFiles() { - FileOutputStream(locationService.location(listOf("style.css"), false).file).use { - javaClass.getResourceAsStream("/dokka/styles/style.css").copyTo(it) + formatService.enumerateSupportFiles { resource, targetPath -> + FileOutputStream(locationService.location(listOf(targetPath), false).file).use { + javaClass.getResourceAsStream(resource).copyTo(it) + } } } } |