aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorIngo Kegel <ingo.kegel@ej-technologies.com>2016-01-04 13:36:54 +0100
committerIngo Kegel <ingo.kegel@ej-technologies.com>2016-01-04 13:36:54 +0100
commit89a36e0eed4a31856cca0cedb9b67ce79cee5100 (patch)
treefd0d71cc5924564036775b320ee6e25afc899605 /core
parente0c6c1a58ff09e657d41f2bca6943486cb877f25 (diff)
downloaddokka-89a36e0eed4a31856cca0cedb9b67ce79cee5100.tar.gz
dokka-89a36e0eed4a31856cca0cedb9b67ce79cee5100.tar.bz2
dokka-89a36e0eed4a31856cca0cedb9b67ce79cee5100.zip
Embedded underscores in words like word_with_underscores or single embedded stars like embedded*star were removed in the output.
Diffstat (limited to 'core')
-rw-r--r--core/src/main/kotlin/Kotlin/ContentBuilder.kt6
-rw-r--r--core/src/test/kotlin/format/HtmlFormatTest.kt6
-rw-r--r--core/src/test/kotlin/markdown/ParserTest.kt12
-rw-r--r--core/testdata/format/uninterpretedEmphasisCharacters.html15
-rw-r--r--core/testdata/format/uninterpretedEmphasisCharacters.kt5
5 files changed, 44 insertions, 0 deletions
diff --git a/core/src/main/kotlin/Kotlin/ContentBuilder.kt b/core/src/main/kotlin/Kotlin/ContentBuilder.kt
index c4bb18de..1a6ffb98 100644
--- a/core/src/main/kotlin/Kotlin/ContentBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/ContentBuilder.kt
@@ -103,6 +103,12 @@ public fun buildContentTo(tree: MarkdownNode, target: ContentBlock, linkResolver
parent.append(createEntityOrText(node.text))
}
+ MarkdownTokenTypes.EMPH -> {
+ if (node.parent?.type != MarkdownElementTypes.EMPH) {
+ parent.append(ContentText(node.text))
+ }
+ }
+
MarkdownTokenTypes.COLON,
MarkdownTokenTypes.DOUBLE_QUOTE,
MarkdownTokenTypes.LT,
diff --git a/core/src/test/kotlin/format/HtmlFormatTest.kt b/core/src/test/kotlin/format/HtmlFormatTest.kt
index 593dbfe6..8045d38c 100644
--- a/core/src/test/kotlin/format/HtmlFormatTest.kt
+++ b/core/src/test/kotlin/format/HtmlFormatTest.kt
@@ -153,5 +153,11 @@ public class HtmlFormatTest {
htmlService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Bar" })
}
}
+
+ @Test fun uninterpretedEmphasisCharacters() {
+ verifyOutput("testdata/format/uninterpretedEmphasisCharacters.kt", ".html") { model, output ->
+ htmlService.appendNodes(tempLocation, output, model.members.single().members)
+ }
+ }
}
diff --git a/core/src/test/kotlin/markdown/ParserTest.kt b/core/src/test/kotlin/markdown/ParserTest.kt
index 5a7adf05..b0ec68ff 100644
--- a/core/src/test/kotlin/markdown/ParserTest.kt
+++ b/core/src/test/kotlin/markdown/ParserTest.kt
@@ -86,6 +86,18 @@ number two
runTestFor("*text*")
}
+ @Test fun underscoresNoEmph() {
+ runTestFor("text_with_underscores")
+ }
+
+ @Test fun emphUnderscores() {
+ runTestFor("_text_")
+ }
+
+ @Test fun singleStar() {
+ runTestFor("Embedded*Star")
+ }
+
@Test fun directive() {
runTestFor("A text \${code with.another.value} with directive")
}
diff --git a/core/testdata/format/uninterpretedEmphasisCharacters.html b/core/testdata/format/uninterpretedEmphasisCharacters.html
new file mode 100644
index 00000000..9afd88d9
--- /dev/null
+++ b/core/testdata/format/uninterpretedEmphasisCharacters.html
@@ -0,0 +1,15 @@
+<HTML>
+<HEAD>
+<title>test / foo</title>
+</HEAD>
+<BODY>
+<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/foo">foo</a><br/>
+<br/>
+<h1>foo</h1>
+<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
+<p>This is <emph>emphasized text</emph> but text_with_underscores has to preserve the underscores.
+Single stars embedded in a word like Embedded*Star have to be preserved as well.</p>
+<br/>
+<br/>
+</BODY>
+</HTML>
diff --git a/core/testdata/format/uninterpretedEmphasisCharacters.kt b/core/testdata/format/uninterpretedEmphasisCharacters.kt
new file mode 100644
index 00000000..711bb567
--- /dev/null
+++ b/core/testdata/format/uninterpretedEmphasisCharacters.kt
@@ -0,0 +1,5 @@
+/**
+ * This is _emphasized text_ but text_with_underscores has to preserve the underscores.
+ * Single stars embedded in a word like Embedded*Star have to be preserved as well.
+ */
+fun foo() {} \ No newline at end of file