• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.jetbrains.dokka
2 
3 import java.io.File
4 
5 /**
6  * Service for building the outline of the package contents.
7  */
8 interface OutlineFormatService {
getOutlineFileNamenull9     fun getOutlineFileName(location: Location): File
10 
11     fun appendOutlineHeader(location: Location, node: DocumentationNode, to: StringBuilder)
12     fun appendOutlineLevel(to: StringBuilder, body: () -> Unit)
13 
14     /** Appends formatted outline to [StringBuilder](to) using specified [location] */
15     fun appendOutline(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
16         for (node in nodes) {
17             appendOutlineHeader(location, node, to)
18             if (node.members.any()) {
19                 val sortedMembers = node.members.sortedBy { it.name.toLowerCase() }
20                 appendOutlineLevel(to) {
21                     appendOutline(location, to, sortedMembers)
22                 }
23             }
24         }
25     }
26 
formatOutlinenull27     fun formatOutline(location: Location, nodes: Iterable<DocumentationNode>): String =
28             StringBuilder().apply { appendOutline(location, this, nodes) }.toString()
29 }
30