diff options
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 { |