aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-02-27 16:58:27 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-02-27 16:58:27 +0100
commit8a65a7ab62e4567bbb20cececcad88eb9ac396d9 (patch)
tree25c75ef3988f4d757cd76a2bc1e48cf38499d430 /src
parenta9538f2f49e15b04340215d8d670557ced6f132d (diff)
downloaddokka-8a65a7ab62e4567bbb20cececcad88eb9ac396d9.tar.gz
dokka-8a65a7ab62e4567bbb20cececcad88eb9ac396d9.tar.bz2
dokka-8a65a7ab62e4567bbb20cececcad88eb9ac396d9.zip
handle @code and @literal tags in javadoc
Diffstat (limited to 'src')
-rw-r--r--src/Java/JavaDocumentationBuilder.kt6
-rw-r--r--src/Utilities/Html.kt1
2 files changed, 6 insertions, 1 deletions
diff --git a/src/Java/JavaDocumentationBuilder.kt b/src/Java/JavaDocumentationBuilder.kt
index 8a5d8fb9..055d64d3 100644
--- a/src/Java/JavaDocumentationBuilder.kt
+++ b/src/Java/JavaDocumentationBuilder.kt
@@ -128,6 +128,12 @@ public class JavaDocumentationBuilder(private val options: DocumentationOptions,
valueElement!!.getText()
}
}
+ "code", "literal" -> {
+ val text = StringBuilder()
+ tag.getDataElements().forEach { text.append(it.getText()) }
+ val escaped = text.toString().trimLeading().htmlEscape()
+ if (tag.getName() == "code") "<code>$escaped</code>" else escaped
+ }
else -> tag.getText()
}
diff --git a/src/Utilities/Html.kt b/src/Utilities/Html.kt
index 9630c8cb..ce3a1982 100644
--- a/src/Utilities/Html.kt
+++ b/src/Utilities/Html.kt
@@ -6,4 +6,3 @@ package org.jetbrains.dokka
* Replaces & with &amp;, < with &lt; and > with &gt;
*/
public fun String.htmlEscape(): String = replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
-