diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-15 18:23:15 +0400 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-15 18:23:15 +0400 |
commit | fb41c698ae26774e6bf71a0ed49b46c57c4023a9 (patch) | |
tree | a59f30756c79fad626770d9a32b97c49c14f9ef9 /src/Formats/HtmlFormatService.kt | |
parent | eebfdd41acc897ba9177f1c8daa428a079c8e99f (diff) | |
download | dokka-fb41c698ae26774e6bf71a0ed49b46c57c4023a9.tar.gz dokka-fb41c698ae26774e6bf71a0ed49b46c57c4023a9.tar.bz2 dokka-fb41c698ae26774e6bf71a0ed49b46c57c4023a9.zip |
Improve rendering of lambdas, escape html symbols.
Diffstat (limited to 'src/Formats/HtmlFormatService.kt')
-rw-r--r-- | src/Formats/HtmlFormatService.kt | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/Formats/HtmlFormatService.kt b/src/Formats/HtmlFormatService.kt index 6f81e8eb..406065d6 100644 --- a/src/Formats/HtmlFormatService.kt +++ b/src/Formats/HtmlFormatService.kt @@ -4,28 +4,32 @@ public open class HtmlFormatService(locationService: LocationService, signatureG : StructuredFormatService(locationService, signatureGenerator) { override val extension: String = "html" + override public fun formatText(text: String): String { + return text.htmlEscape() + } + override fun appendBlockCode(to: StringBuilder, line: String) { to.appendln("<code>") - to.appendln(line) + to.appendln(formatText(line)) to.appendln("</code>") } override fun appendBlockCode(to: StringBuilder, lines: Iterable<String>) { to.appendln("<code>") - to.appendln(lines.join("\n")) + to.appendln(lines.map { formatText(it) }.join("\n")) to.appendln("</code>") } override fun appendHeader(to: StringBuilder, text: String, level: Int) { - to.appendln("<h$level>$text</h$level>") + to.appendln("<h$level>${formatText(text)}</h$level>") } override fun appendText(to: StringBuilder, text: String) { - to.appendln("<p>$text</p>") + to.appendln("<p>${formatText(text)}</p>") } override fun appendLine(to: StringBuilder, text: String) { - to.appendln("$text<br/>") + to.appendln("${formatText(text)}<br/>") } override fun appendLine(to: StringBuilder) { @@ -33,15 +37,15 @@ public open class HtmlFormatService(locationService: LocationService, signatureG } override fun formatLink(text: String, location: Location): String { - return "<a href=\"${location.path}\">${text}</a>" + return "<a href=\"${location.path}\">${formatText(text)}</a>" } override fun formatBold(text: String): String { - return "<b>$text</b>" + return "<b>${formatText(text)}</b>" } override fun formatCode(code: String): String { - return "<code>$code</code>" + return "<code>${formatText(code)}</code>" } override fun formatBreadcrumbs(items: Iterable<FormatLink>): String { |