aboutsummaryrefslogtreecommitdiff
path: root/src/Formats/YamlOutlineService.kt
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-01-16 16:55:22 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-01-16 16:55:22 +0100
commit82de2309e53df4206e99beb36ef51326dbae48a2 (patch)
treeffca7f8610e5f9527d553a9b88f5fe347cbd8647 /src/Formats/YamlOutlineService.kt
parentd75cc63e9b1edc229fad225956ba44fa433e2d0e (diff)
downloaddokka-82de2309e53df4206e99beb36ef51326dbae48a2.tar.gz
dokka-82de2309e53df4206e99beb36ef51326dbae48a2.tar.bz2
dokka-82de2309e53df4206e99beb36ef51326dbae48a2.zip
refactor outline generation; generate HTML outline
Diffstat (limited to 'src/Formats/YamlOutlineService.kt')
-rw-r--r--src/Formats/YamlOutlineService.kt23
1 files changed, 23 insertions, 0 deletions
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--
+ }
+}