aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-09-08 16:46:19 +0200
committerDmitry Jemerov <yole@jetbrains.com>2015-09-08 16:46:19 +0200
commit4575396e10b604a7c013fc47d05e1b808ab4f4f2 (patch)
treece5f99baa3fd2923994e9664fdda7977e13a5c26 /src
parent43eb8f4eefb845d61f184f82a02dcfde3c7e1107 (diff)
downloaddokka-4575396e10b604a7c013fc47d05e1b808ab4f4f2.tar.gz
dokka-4575396e10b604a7c013fc47d05e1b808ab4f4f2.tar.bz2
dokka-4575396e10b604a7c013fc47d05e1b808ab4f4f2.zip
fix HTML entity handling after changes in markdown parser; remove detail count assertions from tests
Diffstat (limited to 'src')
-rw-r--r--src/Kotlin/ContentBuilder.kt20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/Kotlin/ContentBuilder.kt b/src/Kotlin/ContentBuilder.kt
index 4d9b0c06..f4e81400 100644
--- a/src/Kotlin/ContentBuilder.kt
+++ b/src/Kotlin/ContentBuilder.kt
@@ -2,6 +2,7 @@ package org.jetbrains.dokka
import org.intellij.markdown.MarkdownElementTypes
import org.intellij.markdown.MarkdownTokenTypes
+import org.intellij.markdown.html.entities.EntityConverter
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.idea.kdoc.getResolutionScope
@@ -88,7 +89,24 @@ public fun buildContentTo(tree: MarkdownNode, target: ContentBlock, linkResolver
parent.append(block)
}
- MarkdownTokenTypes.TEXT,
+ MarkdownTokenTypes.TEXT -> {
+ fun createEntityOrText(text: String): ContentNode {
+ if (text == "&amp;" || text == "&quot;" || text == "&lt;" || text == "&gt;") {
+ return ContentEntity(text)
+ }
+ if (text == "&") {
+ return ContentEntity("&amp;")
+ }
+ val decodedText = EntityConverter.replaceEntities(text, true, true)
+ if (decodedText != text) {
+ return ContentEntity(text)
+ }
+ return ContentText(text)
+ }
+
+ parent.append(createEntityOrText(node.text))
+ }
+
MarkdownTokenTypes.COLON,
MarkdownTokenTypes.DOUBLE_QUOTE,
MarkdownTokenTypes.LT,