aboutsummaryrefslogtreecommitdiff
path: root/src/Generation
diff options
context:
space:
mode:
Diffstat (limited to 'src/Generation')
-rw-r--r--src/Generation/ConsoleGenerator.kt2
-rw-r--r--src/Generation/FileGenerator.kt21
2 files changed, 18 insertions, 5 deletions
diff --git a/src/Generation/ConsoleGenerator.kt b/src/Generation/ConsoleGenerator.kt
index 17e6957b..78164bb9 100644
--- a/src/Generation/ConsoleGenerator.kt
+++ b/src/Generation/ConsoleGenerator.kt
@@ -1,6 +1,6 @@
package org.jetbrains.dokka
-public class ConsoleGenerator(val signatureGenerator: SignatureGenerator, val locationService: LocationService) {
+public class ConsoleGenerator(val signatureGenerator: LanguageService, val locationService: LocationService) {
val IndentStep = " "
public fun generate(node: DocumentationNode, indent: String = "") {
diff --git a/src/Generation/FileGenerator.kt b/src/Generation/FileGenerator.kt
index 6d2c0a3d..dbd631cb 100644
--- a/src/Generation/FileGenerator.kt
+++ b/src/Generation/FileGenerator.kt
@@ -4,13 +4,14 @@ import java.io.FileOutputStream
import java.io.OutputStreamWriter
import java.util.LinkedHashMap
-public class FileGenerator(val signatureGenerator: SignatureGenerator,
+public class FileGenerator(val signatureGenerator: LanguageService,
val locationService: LocationService,
val formatService: FormatService) {
- public fun generate(node: DocumentationNode): Unit = generate(listOf(node))
+ public fun buildPage(node: DocumentationNode): Unit = buildPages(listOf(node))
+ public fun buildOutline(node: DocumentationNode): Unit = buildOutlines(listOf(node))
- public fun generate(nodes: Iterable<DocumentationNode>) {
+ public fun buildPages(nodes: Iterable<DocumentationNode>) {
for ((location, items) in nodes.groupByTo(LinkedHashMap()) { locationService.location(it) }) {
val file = location.file.appendExtension(formatService.extension)
file.getParentFile()?.mkdirs()
@@ -19,7 +20,19 @@ public class FileGenerator(val signatureGenerator: SignatureGenerator,
it.write(formatService.format(items))
}
}
- generate(items.flatMap { it.members })
+ buildPages(items.flatMap { it.members })
+ }
+ }
+
+ public fun buildOutlines(nodes: Iterable<DocumentationNode>) {
+ for ((location, items) in nodes.groupByTo(LinkedHashMap()) { locationService.location(it) }) {
+ val file = location.file.appendExtension("yml")
+ file.getParentFile()?.mkdirs()
+ FileOutputStream(file).use {
+ OutputStreamWriter(it, defaultCharset).use {
+ it.write(formatService.formatOutline(items))
+ }
+ }
}
}
} \ No newline at end of file