aboutsummaryrefslogtreecommitdiff
path: root/src/Formats/KotlinWebsiteFormatService.kt
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-12-03 16:22:11 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-12-03 16:22:49 +0100
commit39631054c58df5841ea268b7002b820ec55f6e0a (patch)
treecefedd8411c859243bd181568e16fcdd372a38c8 /src/Formats/KotlinWebsiteFormatService.kt
parent797cb4732c53bf1e3b2091add8cf731fc436607f (diff)
downloaddokka-39631054c58df5841ea268b7002b820ec55f6e0a.tar.gz
dokka-39631054c58df5841ea268b7002b820ec55f6e0a.tar.bz2
dokka-39631054c58df5841ea268b7002b820ec55f6e0a.zip
restructure Dokka build to use Gradle for everything except for the Maven plugin
Diffstat (limited to 'src/Formats/KotlinWebsiteFormatService.kt')
-rw-r--r--src/Formats/KotlinWebsiteFormatService.kt121
1 files changed, 0 insertions, 121 deletions
diff --git a/src/Formats/KotlinWebsiteFormatService.kt b/src/Formats/KotlinWebsiteFormatService.kt
deleted file mode 100644
index 4eda7910..00000000
--- a/src/Formats/KotlinWebsiteFormatService.kt
+++ /dev/null
@@ -1,121 +0,0 @@
-package org.jetbrains.dokka
-
-import com.google.inject.Inject
-
-public class KotlinWebsiteFormatService @Inject constructor(locationService: LocationService,
- signatureGenerator: LanguageService)
-: JekyllFormatService(locationService, signatureGenerator, "html") {
- private var needHardLineBreaks = false
-
- override fun appendFrontMatter(nodes: Iterable<DocumentationNode>, to: StringBuilder) {
- super.appendFrontMatter(nodes, to)
- to.appendln("layout: api")
- }
-
- override public fun formatBreadcrumbs(items: Iterable<FormatLink>): String {
- items.drop(1)
-
- if (items.count() > 1) {
- return "<div class='api-docs-breadcrumbs'>" +
- items.map { formatLink(it) }.joinToString(" / ") +
- "</div>"
- }
-
- return ""
- }
-
- override public fun formatCode(code: String): String = if (code.length > 0) "<code>$code</code>" else ""
-
- override fun formatStrikethrough(text: String): String = "<s>$text</s>"
-
- override fun appendAsSignature(to: StringBuilder, node: ContentNode, block: () -> Unit) {
- val contentLength = node.textLength
- if (contentLength == 0) return
- to.append("<div class=\"signature\">")
- needHardLineBreaks = contentLength >= 62
- try {
- block()
- } finally {
- needHardLineBreaks = false
- }
- to.append("</div>")
- }
-
- override fun appendAsOverloadGroup(to: StringBuilder, block: () -> Unit) {
- to.append("<div class=\"overload-group\">\n")
- block()
- to.append("</div>\n")
- }
-
- override fun formatLink(text: String, href: String): String {
- return "<a href=\"${href}\">${text}</a>"
- }
-
- override fun appendTable(to: StringBuilder, body: () -> Unit) {
- to.appendln("<table class=\"api-docs-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 markdown=\"1\">")
- body()
- to.appendln("\n</td>")
- }
-
- override public fun appendBlockCode(to: StringBuilder, line: String, language: String) {
- if (language.isNotEmpty()) {
- super.appendBlockCode(to, line, language)
- } else {
- to.append("<pre markdown=\"1\">")
- to.append(line.trimStart())
- to.append("</pre>")
- }
- }
-
- override fun formatSymbol(text: String): String {
- return "<span class=\"symbol\">${formatText(text)}</span>"
- }
-
- override fun formatKeyword(text: String): String {
- return "<span class=\"keyword\">${formatText(text)}</span>"
- }
-
- override fun formatIdentifier(text: String, kind: IdentifierKind): String {
- return "<span class=\"${identifierClassName(kind)}\">${formatText(text)}</span>"
- }
-
- override fun formatSoftLineBreak(): String = if (needHardLineBreaks)
- "<br/>"
- else
- ""
-
- override fun formatIndentedSoftLineBreak(): String = if (needHardLineBreaks)
- "<br/>&nbsp;&nbsp;&nbsp;&nbsp;"
- else
- ""
-
- private fun identifierClassName(kind: IdentifierKind) = when(kind) {
- IdentifierKind.ParameterName -> "parameterName"
- IdentifierKind.SummarizedTypeName -> "summarizedTypeName"
- else -> "identifier"
- }
-}