package org.jetbrains.dokka
public open class HtmlFormatService(locationService: LocationService,
resolutionService: ResolutionService,
signatureGenerator: LanguageService,
val templateService: HtmlTemplateService = HtmlTemplateService.default())
: StructuredFormatService(locationService, resolutionService, 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("")
to.appendln(line.htmlEscape())
to.appendln("
")
}
override fun appendBlockCode(to: StringBuilder, lines: Iterable) {
to.appendln("")
to.appendln(lines.map { it.htmlEscape() }.join("\n"))
to.appendln("
")
}
override fun appendHeader(to: StringBuilder, text: String, level: Int) {
to.appendln("${text}")
}
override fun appendText(to: StringBuilder, text: String) {
to.appendln("${text}
")
}
override fun appendLine(to: StringBuilder, text: String) {
to.appendln("${text}
")
}
override fun appendLine(to: StringBuilder) {
to.appendln("
")
}
override fun appendTable(to: StringBuilder, body: () -> Unit) {
to.appendln("")
}
override fun appendTableHeader(to: StringBuilder, body: () -> Unit) {
to.appendln("")
body()
to.appendln("")
}
override fun appendTableBody(to: StringBuilder, body: () -> Unit) {
to.appendln("")
body()
to.appendln("")
}
override fun appendTableRow(to: StringBuilder, body: () -> Unit) {
to.appendln("")
body()
to.appendln("
")
}
override fun appendTableCell(to: StringBuilder, body: () -> Unit) {
to.appendln("")
body()
to.appendln(" | ")
}
override fun formatLink(text: String, location: Location): String {
return "${text}"
}
override fun formatBold(text: String): String {
return "${text}"
}
override fun formatCode(code: String): String {
return "${code.htmlEscape()}
"
}
override fun formatBreadcrumbs(items: Iterable): String {
return items.map { formatLink(it) }.joinToString(" / ")
}
override fun appendNodes(to: StringBuilder, nodes: Iterable) {
templateService.appendHeader(to)
super.appendNodes(to, nodes)
templateService.appendFooter(to)
}
override fun appendOutlineChildren(to: StringBuilder, nodes: Iterable) {
}
override fun appendOutlineHeader(to: StringBuilder, node: DocumentationNode) {
}
}