From 7bc3513935588467d4f848bbe40539664fdbdcf9 Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Sat, 12 Jul 2014 03:10:02 +0400 Subject: Do not generate empty sections in console output. --- src/Generation/ConsoleGenerator.kt | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/Generation/ConsoleGenerator.kt b/src/Generation/ConsoleGenerator.kt index 36db88cf..90bd53be 100644 --- a/src/Generation/ConsoleGenerator.kt +++ b/src/Generation/ConsoleGenerator.kt @@ -1,7 +1,7 @@ package org.jetbrains.dokka public class ConsoleGenerator() { - val IndentStep = " " + val IndentStep = " |" public fun generate(node: DocumentationNode, indent: String = "") { generateHeader(node, indent) @@ -16,18 +16,29 @@ public class ConsoleGenerator() { println() } - public fun generateDetails(node: DocumentationNode, indent: String = "") { - for (child in node.details) + public fun generateMembers(node: DocumentationNode, indent: String = "") { + val items = node.members + if (items.isEmpty()) + return + println("$indent Members") + for (child in items) generate(child, indent + IndentStep) } - public fun generateMembers(node: DocumentationNode, indent: String = "") { - for (child in node.members) - generate(child, indent + IndentStep) + public fun generateDetails(node: DocumentationNode, indent: String = "") { + val items = node.details + if (items.isEmpty()) + return + for (child in items) + generate(child, indent + " ") } public fun generateLinks(node: DocumentationNode, indent: String = "") { - for (child in node.links) - generate(child, indent + IndentStep) + val items = node.links + if (items.isEmpty()) + return + println("$indent Links") + for (child in items) + generate(child, indent + " ") } } \ No newline at end of file -- cgit