diff options
author | Sergey Mashkov <sergey.mashkov@jetbrains.com> | 2015-08-06 12:51:46 +0300 |
---|---|---|
committer | Sergey Mashkov <sergey.mashkov@jetbrains.com> | 2015-08-06 12:51:46 +0300 |
commit | 998677fc63dcb359ae9ff27c5fec1dad3d78381b (patch) | |
tree | 06158b4d786ec1a2d3272e4e7c7ac110ac791007 | |
parent | f530a332810e952a0f0515717ce50d8c3bf87797 (diff) | |
download | dokka-998677fc63dcb359ae9ff27c5fec1dad3d78381b.tar.gz dokka-998677fc63dcb359ae9ff27c5fec1dad3d78381b.tar.bz2 dokka-998677fc63dcb359ae9ff27c5fec1dad3d78381b.zip |
~ make surroundWith functions local
-rw-r--r-- | javadoc/src/main/kotlin/tags.kt | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/javadoc/src/main/kotlin/tags.kt b/javadoc/src/main/kotlin/tags.kt index 120154f9..96ac179a 100644 --- a/javadoc/src/main/kotlin/tags.kt +++ b/javadoc/src/main/kotlin/tags.kt @@ -103,6 +103,39 @@ class ThrowsTagAdapter(val holder: Doc, val type: ClassDocumentationNodeAdapter) fun buildInlineTags(module: ModuleNodeAdapter, holder: Doc, root: ContentNode): List<Tag> = ArrayList<Tag>().let { buildInlineTags(module, holder, root, it); it } private fun buildInlineTags(module: ModuleNodeAdapter, holder: Doc, node: ContentNode, result: MutableList<Tag>) { + fun surroundWith(module: ModuleNodeAdapter, holder: Doc, prefix: String, postfix: String, node: ContentBlock, result: MutableList<Tag>) { + if (node.children.isNotEmpty()) { + val open = TextTag(holder, ContentText(prefix)) + val close = TextTag(holder, ContentText(postfix)) + + result.add(open) + node.children.forEach { + buildInlineTags(module, holder, it, result) + } + + if (result.last() === open) { + result.remove(result.lastIndex) + } else { + result.add(close) + } + } + } + + fun surroundWith(module: ModuleNodeAdapter, holder: Doc, prefix: String, postfix: String, node: ContentNode, result: MutableList<Tag>) { + if (node !is ContentEmpty) { + val open = TextTag(holder, ContentText(prefix)) + val close = TextTag(holder, ContentText(postfix)) + + result.add(open) + buildInlineTags(module, holder, node, result) + if (result.last() === open) { + result.remove(result.lastIndex) + } else { + result.add(close) + } + } + } + when (node) { is ContentText -> result.add(TextTag(holder, node)) is ContentNodeLink -> { @@ -144,37 +177,4 @@ private fun buildInlineTags(module: ModuleNodeAdapter, holder: Doc, node: Conten else -> result.add(TextTag(holder, ContentText("$node"))) } -} - -fun surroundWith(module: ModuleNodeAdapter, holder: Doc, prefix: String, postfix: String, node: ContentBlock, result: MutableList<Tag>) { - if (node.children.isNotEmpty()) { - val open = TextTag(holder, ContentText(prefix)) - val close = TextTag(holder, ContentText(postfix)) - - result.add(open) - node.children.forEach { - buildInlineTags(module, holder, it, result) - } - - if (result.last() === open) { - result.remove(result.lastIndex) - } else { - result.add(close) - } - } -} - -fun surroundWith(module: ModuleNodeAdapter, holder: Doc, prefix: String, postfix: String, node: ContentNode, result: MutableList<Tag>) { - if (node !is ContentEmpty) { - val open = TextTag(holder, ContentText(prefix)) - val close = TextTag(holder, ContentText(postfix)) - - result.add(open) - buildInlineTags(module, holder, node, result) - if (result.last() === open) { - result.remove(result.lastIndex) - } else { - result.add(close) - } - } }
\ No newline at end of file |