aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin
diff options
context:
space:
mode:
authorFred Sladkey <fsladkey@gmail.com>2021-08-30 11:09:49 -0400
committerGitHub <noreply@github.com>2021-08-30 17:09:49 +0200
commita74b3c1cabde1dad3e91f804a89a90398dba1932 (patch)
tree0419151226f481922d008978d6c653643ac77413 /plugins/base/src/main/kotlin
parent1f58b5b3d8dc83338561b2ca64d6434b0c3ee1a3 (diff)
downloaddokka-a74b3c1cabde1dad3e91f804a89a90398dba1932.tar.gz
dokka-a74b3c1cabde1dad3e91f804a89a90398dba1932.tar.bz2
dokka-a74b3c1cabde1dad3e91f804a89a90398dba1932.zip
Don't force @literal in javadoc to be surrounded by code tag (#2089)
* Don't force @literal in javadoc to be surrounded by code tag * Enclose in <literal> tag and add test for angle brackets
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt b/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt
index 8583edf7..8bc950b7 100644
--- a/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt
@@ -333,8 +333,8 @@ class JavadocParser(
when (tag.name) {
"link", "linkplain" -> tag.referenceElement()
?.toDocumentationLinkString(tag.dataElements.filterIsInstance<PsiDocToken>())
- "code", "literal" -> "<code data-inline>${tag.dataElements.joinToString("") { it.stringifyElementAsText(keepFormatting = true)
- .toString() }.htmlEscape()}</code>"
+ "code" -> "<code data-inline>${dataElementsAsText(tag)}</code>"
+ "literal" -> "<literal>${dataElementsAsText(tag)}</literal>"
"index" -> "<index>${tag.children.filterIsInstance<PsiDocTagValue>().joinToString { it.text }}</index>"
"inheritDoc" -> inheritDocResolver.resolveFromContext(context)
?.fold(ParsingResult(javadocTag)) { result, e ->
@@ -343,6 +343,11 @@ class JavadocParser(
else -> tag.text
}
+ private fun dataElementsAsText(tag: PsiInlineDocTag) =
+ tag.dataElements.joinToString("") {
+ it.stringifyElementAsText(keepFormatting = true).toString()
+ }.htmlEscape()
+
private fun createLink(element: Element, children: List<DocTag>): DocTag {
return when {
element.hasAttr("docref") ->