diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2019-10-31 11:47:41 +0100 |
---|---|---|
committer | Kamil Doległo <kamilok1965@interia.pl> | 2019-10-31 11:48:04 +0100 |
commit | 57830827b9bc13aad7af6ab899f25b278b248ef7 (patch) | |
tree | ff9647031cac2560b7593828c8370f4e73616521 /core/src/main/kotlin/renderers | |
parent | c33e8e16a0e446b78496cbcd878ba76ea51c0940 (diff) | |
download | dokka-57830827b9bc13aad7af6ab899f25b278b248ef7.tar.gz dokka-57830827b9bc13aad7af6ab899f25b278b248ef7.tar.bz2 dokka-57830827b9bc13aad7af6ab899f25b278b248ef7.zip |
[WIP] commit before rebase
Diffstat (limited to 'core/src/main/kotlin/renderers')
-rw-r--r-- | core/src/main/kotlin/renderers/DefaultRenderer.kt | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/core/src/main/kotlin/renderers/DefaultRenderer.kt b/core/src/main/kotlin/renderers/DefaultRenderer.kt index b2647d22..7dab7c5c 100644 --- a/core/src/main/kotlin/renderers/DefaultRenderer.kt +++ b/core/src/main/kotlin/renderers/DefaultRenderer.kt @@ -16,15 +16,17 @@ abstract class DefaultRenderer(val outputDir: String, val fileWriter: FileWriter protected open fun buildSymbol(parts: List<ContentNode>): String = parts.joinToString { it.build() } protected open fun buildBlock(name: String, content: List<ContentNode>) = buildHeader(2, name) + content.joinToString("\n") { it.build() } - protected open fun ContentNode.build(): String = - when(this) { - is ContentText -> buildText(this.text) - is ContentComment -> buildComment(this.parts) - is ContentSymbol -> buildSymbol(this.parts) - is ContentCode -> buildCode(this.code) - is ContentBlock -> buildBlock(this.name, this.children) - is ContentLink -> buildLink(this.text, locationProvider.resolve(this.address, this.platforms)) - is ContentGroup -> buildGroup(this.children) + protected open fun ContentNode.build(): String = buildContentNode(this) + + protected open fun buildContentNode(node: ContentNode) = + when(node) { + is ContentText -> buildText(node.text) + is ContentComment -> buildComment(node.parts) + is ContentSymbol -> buildSymbol(node.parts) + is ContentCode -> buildCode(node.code) + is ContentBlock -> buildBlock(node.name, node.children) + is ContentLink -> buildLink(node.text, locationProvider.resolve(node.address, node.platforms)) + is ContentGroup -> buildGroup(node.children) else -> "" } |