aboutsummaryrefslogtreecommitdiff
path: root/src/Formats/HtmlFormatService.kt
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-07-15 20:05:55 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-07-15 20:05:55 +0400
commitaa59acbaf96e961d28e614a2932f100bea766b4f (patch)
treece889f7b51112c65ddff362003a82000b21ed644 /src/Formats/HtmlFormatService.kt
parent7c204a38f374c4ac403810fa11a2d4310f4ec1f4 (diff)
downloaddokka-aa59acbaf96e961d28e614a2932f100bea766b4f.tar.gz
dokka-aa59acbaf96e961d28e614a2932f100bea766b4f.tar.bz2
dokka-aa59acbaf96e961d28e614a2932f100bea766b4f.zip
Support tables in formatters and add proper escaping of html
Diffstat (limited to 'src/Formats/HtmlFormatService.kt')
-rw-r--r--src/Formats/HtmlFormatService.kt46
1 files changed, 38 insertions, 8 deletions
diff --git a/src/Formats/HtmlFormatService.kt b/src/Formats/HtmlFormatService.kt
index 406065d6..e6d09991 100644
--- a/src/Formats/HtmlFormatService.kt
+++ b/src/Formats/HtmlFormatService.kt
@@ -10,42 +10,72 @@ public open class HtmlFormatService(locationService: LocationService, signatureG
override fun appendBlockCode(to: StringBuilder, line: String) {
to.appendln("<code>")
- to.appendln(formatText(line))
+ to.appendln(line)
to.appendln("</code>")
}
override fun appendBlockCode(to: StringBuilder, lines: Iterable<String>) {
to.appendln("<code>")
- to.appendln(lines.map { formatText(it) }.join("\n"))
+ to.appendln(lines.map { it }.join("\n"))
to.appendln("</code>")
}
override fun appendHeader(to: StringBuilder, text: String, level: Int) {
- to.appendln("<h$level>${formatText(text)}</h$level>")
+ to.appendln("<h$level>${text}</h$level>")
}
override fun appendText(to: StringBuilder, text: String) {
- to.appendln("<p>${formatText(text)}</p>")
+ to.appendln("<p>${text}</p>")
}
override fun appendLine(to: StringBuilder, text: String) {
- to.appendln("${formatText(text)}<br/>")
+ to.appendln("${text}<br/>")
}
override fun appendLine(to: StringBuilder) {
to.appendln("<br/>")
}
+ override fun appendTable(to: StringBuilder, body: () -> Unit) {
+ to.appendln("<table>")
+ body()
+ to.appendln("</table>")
+ }
+
+ override fun appendTableHeader(to: StringBuilder, body: () -> Unit) {
+ to.appendln("<thead>")
+ body()
+ to.appendln("</thead>")
+ }
+
+ override fun appendTableBody(to: StringBuilder, body: () -> Unit) {
+ to.appendln("<tbody>")
+ body()
+ to.appendln("</tbody>")
+ }
+
+ override fun appendTableRow(to: StringBuilder, body: () -> Unit) {
+ to.appendln("<tr>")
+ body()
+ to.appendln("</tr>")
+ }
+
+ override fun appendTableCell(to: StringBuilder, body: () -> Unit) {
+ to.appendln("<td>")
+ body()
+ to.appendln("</td>")
+ }
+
override fun formatLink(text: String, location: Location): String {
- return "<a href=\"${location.path}\">${formatText(text)}</a>"
+ return "<a href=\"${location.path}\">${text}</a>"
}
override fun formatBold(text: String): String {
- return "<b>${formatText(text)}</b>"
+ return "<b>${text}</b>"
}
override fun formatCode(code: String): String {
- return "<code>${formatText(code)}</code>"
+ return "<code>${code}</code>"
}
override fun formatBreadcrumbs(items: Iterable<FormatLink>): String {