aboutsummaryrefslogtreecommitdiff
path: root/src/Generation/FileGenerator.kt
blob: 105c14e6bdd42555e04dae3ae010e482ba5de099 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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 members = node.members.sortBy { it.name }
        for (member in members)
            generate(member)
    }
}