org.jetbrains.kotlin.doc.templates.ClassExtensionsTemplate.kt Maven / Gradle / Ivy
package org.jetbrains.kotlin.doc.templates
import java.util.*
import org.jetbrains.kotlin.doc.model.KClass
import org.jetbrains.kotlin.doc.model.KFunction
import org.jetbrains.kotlin.doc.model.KModel
import org.jetbrains.kotlin.doc.model.KPackage
import org.jetbrains.kotlin.doc.model.KProperty
class ClassExtensionsTemplate(m: KModel, p: KPackage, k: KClass,
val functions: Collection, val properties: Collection) : ClassTemplate(m, p, k) {
protected override fun relativePrefix(): String = "${pkg.nameAsRelativePath}${klass.pkg.nameAsRelativePath}"
override fun pageTitle(): String = "${klass.name} Extensions fom ${pkg.name} (${model.title})"
override fun printBody(): Unit {
println("""
${pkg.name}
Extensions on ${klass.name}
-
extension functions on class ${klass.name}
-
from package ${link(pkg)}
""") printPropertySummary(properties) printFunctionSummary(functions) printFunctionDetail(functions) println("""
""") } override fun href(f: KFunction): String { return if (f.extensionClass != null) "#${f.link}" else super.href(f) } override fun href(f: KProperty): String { return if (f.extensionClass != null) "#${f.link}" else super.href(f) } }