From 3fe73a9430c1b782c5891fb61dd5565ab7ee9178 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 6 Feb 2015 17:39:41 +0100 Subject: handle parenthesis tokens in markdown --- src/Kotlin/ContentBuilder.kt | 4 +++- test/data/format/parenthesis.html | 13 +++++++++++++ test/data/format/parenthesis.kt | 4 ++++ test/src/format/HtmlFormatTest.kt | 6 ++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 test/data/format/parenthesis.html create mode 100644 test/data/format/parenthesis.kt diff --git a/src/Kotlin/ContentBuilder.kt b/src/Kotlin/ContentBuilder.kt index 80d49a85..42a2d994 100644 --- a/src/Kotlin/ContentBuilder.kt +++ b/src/Kotlin/ContentBuilder.kt @@ -105,7 +105,9 @@ public fun DocumentationBuilder.buildContentTo(tree: MarkdownNode, target: Conte } MarkdownTokenTypes.DOUBLE_QUOTE, MarkdownTokenTypes.LT, - MarkdownTokenTypes.GT -> { + MarkdownTokenTypes.GT, + MarkdownTokenTypes.LPAREN, + MarkdownTokenTypes.RPAREN -> { parent.append(ContentText(node.text)) } else -> { diff --git a/test/data/format/parenthesis.html b/test/data/format/parenthesis.html new file mode 100644 index 00000000..9e739443 --- /dev/null +++ b/test/data/format/parenthesis.html @@ -0,0 +1,13 @@ + + +test / foo + + +test /  / foo
+
+

foo

+
fun foo(): Unit

foo (bar)

+
+
+ + diff --git a/test/data/format/parenthesis.kt b/test/data/format/parenthesis.kt new file mode 100644 index 00000000..b906f64a --- /dev/null +++ b/test/data/format/parenthesis.kt @@ -0,0 +1,4 @@ +/** + * foo (bar) + */ +fun foo() {} diff --git a/test/src/format/HtmlFormatTest.kt b/test/src/format/HtmlFormatTest.kt index 0170d148..251c7074 100644 --- a/test/src/format/HtmlFormatTest.kt +++ b/test/src/format/HtmlFormatTest.kt @@ -45,4 +45,10 @@ public class HtmlFormatTest { htmlService.appendNodes(tempLocation, output, model.members.single().members) } } + + Test fun parenthesis() { + verifyOutput("test/data/format/parenthesis.kt", ".html") { model, output -> + htmlService.appendNodes(tempLocation, output, model.members.single().members) + } + } } -- cgit