package org.jetbrains.dokka.renderers import org.jetbrains.dokka.pages.ContentLink import org.jetbrains.dokka.pages.ContentNode import org.jetbrains.dokka.pages.PageNode import org.jetbrains.dokka.resolvers.LocationProvider open class HtmlRenderer(fileWriter: FileWriter, locationProvider: LocationProvider): DefaultRenderer(fileWriter, locationProvider) { override fun buildComment(parts: List, pageContext: PageNode): String = "

${super.buildComment(parts, pageContext)}

" override fun buildSymbol(parts: List, pageContext: PageNode): String = "${super.buildSymbol(parts, pageContext)}" override fun buildHeader(level: Int, text: String): String = "$text\n" override fun buildNewLine(): String = "
" override fun buildLink(text: String, address: String): String = "$text" override fun buildCode(code: String): String = "$code" override fun buildNavigation(): String = "" // TODO implement override fun buildGroup(children: List, pageContext: PageNode): String = children.find { it is ContentLink }?.build(pageContext) + "\n" + "" + children.filterNot { it is ContentLink }.joinToString("\n") { it.build(pageContext) } override fun buildBlock(name: String, content: List, pageContext: PageNode): String = buildHeader(3, name) + "\n\n\n\n\n\n
\n" + content.joinToString("
") { it.build(pageContext) } + "
" override fun renderPage(page: PageNode) { val pageText = buildStartHtml(page) + buildPageContent(page) + buildEndHtml() fileWriter.write(locationProvider.resolve(page), pageText, "") } protected open fun buildStartHtml(page: PageNode) = """ | | |${page.name} | | |""".trimMargin() protected open fun buildEndHtml() = """ | | | """.trimMargin() }