From 82de2309e53df4206e99beb36ef51326dbae48a2 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 16 Jan 2015 16:55:22 +0100 Subject: refactor outline generation; generate HTML outline --- src/Formats/YamlOutlineService.kt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/Formats/YamlOutlineService.kt (limited to 'src/Formats/YamlOutlineService.kt') diff --git a/src/Formats/YamlOutlineService.kt b/src/Formats/YamlOutlineService.kt new file mode 100644 index 00000000..cdab4eeb --- /dev/null +++ b/src/Formats/YamlOutlineService.kt @@ -0,0 +1,23 @@ +package org.jetbrains.dokka + +import java.io.File + +class YamlOutlineService(val locationService: LocationService, + val languageService: LanguageService) : OutlineFormatService { + override fun getOutlineFileName(location: Location): File = File("${location.path}.yml") + + var outlineLevel = 0 + override fun appendOutlineHeader(location: Location, node: DocumentationNode, to: StringBuilder) { + val indent = " ".repeat(outlineLevel) + to.appendln("$indent- title: ${languageService.renderName(node)}") + to.appendln("$indent url: ${locationService.location(node).path}") + } + + override fun appendOutlineLevel(to: StringBuilder, body: () -> Unit) { + val indent = " ".repeat(outlineLevel) + to.appendln("$indent content:") + outlineLevel++ + body() + outlineLevel-- + } +} -- cgit