From 87705bf24f6f7e541dbdb14c44e00d0b90a81f37 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 28 Dec 2017 21:23:27 +0300 Subject: [backport] Add package list support for JLH Original: 4256adf --- .../JavaLayoutHtmlPackageListService.kt | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlPackageListService.kt (limited to 'core/src') diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlPackageListService.kt b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlPackageListService.kt new file mode 100644 index 00000000..398758f2 --- /dev/null +++ b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlPackageListService.kt @@ -0,0 +1,28 @@ +package org.jetbrains.dokka.Formats + +import org.jetbrains.dokka.DocumentationModule +import org.jetbrains.dokka.ExternalDocumentationLinkResolver.Companion.DOKKA_PARAM_PREFIX +import org.jetbrains.dokka.NodeKind +import org.jetbrains.dokka.PackageListService + +class JavaLayoutHtmlPackageListService: PackageListService { + + private fun StringBuilder.appendParam(name: String, value: String) { + append(DOKKA_PARAM_PREFIX) + append(name) + append(":") + appendln(value) + } + + override fun formatPackageList(module: DocumentationModule): String { + val packages = module.members(NodeKind.Package).map { it.name } + + return buildString { + appendParam("format", "java-layout-html") + for (p in packages) { + appendln(p) + } + } + } + +} \ No newline at end of file -- cgit