aboutsummaryrefslogtreecommitdiff
path: root/src/Generation/FileGenerator.kt
blob: b174368fe5e8ea6aa0314fc6d039a3a3e0e616a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package org.jetbrains.dokka

import java.io.File

public class FileGenerator(val signatureGenerator: SignatureGenerator,
                           val locationService: LocationService,
                           val formatService: FormatService) {
    public fun generate(node: DocumentationNode) {
        val location = locationService.location(node)
        val file = location.file.appendExtension(formatService.extension)
        file.getParentFile()?.mkdirs()
        file.writeText(formatService.format(node), defaultCharset)
        val items = node.members.sortBy { it.name }
        for (child in items)
            generate(child)
    }
}