aboutsummaryrefslogtreecommitdiff
path: root/src/Formats/HtmlFormatService.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/Formats/HtmlFormatService.kt')
-rw-r--r--src/Formats/HtmlFormatService.kt19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/Formats/HtmlFormatService.kt b/src/Formats/HtmlFormatService.kt
index f76693dc..a50f2c8b 100644
--- a/src/Formats/HtmlFormatService.kt
+++ b/src/Formats/HtmlFormatService.kt
@@ -115,7 +115,7 @@ public open class HtmlFormatService(locationService: LocationService,
override fun appendNodes(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
- templateService.appendHeader(to)
+ templateService.appendHeader(to, getPageTitle(nodes))
super<StructuredFormatService>.appendNodes(location, to, nodes)
templateService.appendFooter(to)
}
@@ -124,4 +124,21 @@ public open class HtmlFormatService(locationService: LocationService,
}
override fun appendOutlineHeader(to: StringBuilder, node: DocumentationNode) {
}
+
+ fun getPageTitle(nodes: Iterable<DocumentationNode>): String? {
+ val breakdownByLocation = nodes.groupBy { node -> formatPageTitle(node) }
+ return breakdownByLocation.keySet().singleOrNull()
+ }
+
+ fun formatPageTitle(node: DocumentationNode): String {
+ val path = node.path
+ if (path.size() == 1) {
+ return path.first().name
+ }
+ val qualifiedName = path.drop(1).map { it.name }.filter { it.length() > 0 }.join(".")
+ if (qualifiedName.length() == 0 && path.size() == 2) {
+ return path.first().name + " / root package"
+ }
+ return path.first().name + " / " + qualifiedName
+ }
} \ No newline at end of file