org.jetbrains.kotlin.doc.templates.ClassTemplate.kt Maven / Gradle / Ivy
package org.jetbrains.kotlin.doc.templates
import org.jetbrains.kotlin.doc.model.KClass
import org.jetbrains.kotlin.doc.model.KModel
import org.jetbrains.kotlin.doc.model.KPackage
open class ClassTemplate(open val model: KModel, pkg: KPackage, open val klass: KClass) : PackageTemplateSupport(pkg) {
open fun pageTitle(): String = "${klass.name} (${model.title})"
override fun render() {
println("""
$generatedComment
${pageTitle()}
${stylesheets()}
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
${searchBox()}
""")
printPrevNextClass()
println("""
FRAMES
NO FRAMES
SUMMARY: NESTED | PROPERTY | CONSTR | FUNCTION
DETAIL: PROPERTY | CONSTR | FUNCTION
""")
printBody()
println("""
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
""")
printPrevNextClass()
println("""
FRAMES
NO FRAMES
SUMMARY: NESTED | PROPERTY | CONSTR | FUNCTION
DETAIL: PROPERTY | CONSTR | FUNCTION
Copyright © 2010-2012. All Rights Reserved.
""")
}
open fun printBody(): Unit {
println("""
${pkg.name}
Class ${klass.simpleName}
""")
for (bc in klass.baseClasses) {
println(link(bc, true))
}
println(""" ${klass.name}
""")
printAnnotations(klass.annotations)
print("""${klass.visibility} ${klass.kindCode} ${klass.simpleName}
- """)
if (!klass.baseClasses.isEmpty()) {
print("""extends """)
for (bc in klass.baseClasses) {
println(link(bc))
}
}
println("""
""") println(klass.detailedDescription(this)) if (klass.since.size > 0 || klass.authors.size > 0) { println("""
- """)
if (klass.since.size > 0) {
println("""
- Since:
- ${klass.since} """) } for (author in klass.authors) { println("""
- Author:
- ${author} """) } println("""
""") val nestedClasses = klass.nestedClasses if (!nestedClasses.isEmpty()) { println("""
Nested Class Summary | |
---|---|
static class |
${klass.simpleName}.${nc.simpleName}
${nc.description(this)} | """)
}
println("""
""") } open fun printPrevNextClass(): Unit { println("""