All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetbrains.kotlin.doc.templates.PackageSummaryTemplate.kt Maven / Gradle / Ivy

There is a newer version: 0.12.1230
Show newest version
package org.jetbrains.kotlin.doc.templates

import org.jetbrains.kotlin.doc.model.KModel
import org.jetbrains.kotlin.doc.model.KPackage
import org.jetbrains.kotlin.doc.model.filterDuplicateNames
import org.jetbrains.kotlin.doc.model.inheritedExtensionFunctions

class PackageSummaryTemplate(val model: KModel, pkg: KPackage) : PackageTemplateSupport(pkg) {
    override fun render() {
        println("""



$generatedComment


${pkg.name} (${model.title})




${stylesheets()}








""") printNextPrevPackages() println("""

""") for (a in pkg.annotations) { val url = a.url if (url != null) { println("""@${a.simpleName}""") } } println("""

Package ${pkg.name}

${pkg.description(this)}

See:
          Description

""") printClasses("trait", "Traits") printClasses("class", "Classes") printClasses("enum", "Enums") printClasses("annotation", "Annotations") printClasses("exception", "Exceptions") printPropertySummary(pkg.packageProperties()) printFunctionSummary(pkg.packageFunctions()) printExtensionFunctions() println("""

Package ${pkg.name} Description

${pkg.detailedDescription(this)}

Contents

""") val groupMap = pkg.groupClassMap() for (e in groupMap) { val group = e.key ?: "Other" val list = e.value if (list != null) { println("""

$group

""") } } println("""

""") printFunctionDetail(pkg.packageFunctions()) println("""


""") printNextPrevPackages() println("""

Copyright © 2010-2012. All Rights Reserved. """) } protected fun printClasses(kind: String, description: String): Unit { val classes = pkg.classes.filter{ it.kind == kind } if (! classes.isEmpty()) { print("""""") for (c in classes) { println("""""") } println("""
$description Summary
${c.simpleName} ${c.description(this)}
 

""") } } // TODO delete protected fun printFunctions(): Unit { val functions = pkg.functions.filter{ it.extensionClass == null } if (! functions.isEmpty()) { print("""

""") for (f in functions) { println("""""") } println("""
Functions Summary
${f.name} ${f.description(this)}
 

""") } } protected fun printExtensionFunctions(): Unit { val map = inheritedExtensionFunctions(pkg.functions) if (! map.isEmpty()) { print("""

""") for (e in map) { val c = e.key if (c != null) { println("""""") } } println("""
Extensions Summary
${c.name} """) val list = e.value if (list != null) { val functions = filterDuplicateNames(list) for (f in functions) { println("""${f.name} """) } } println("""
 

""") } } protected fun printNextPrevPackages(): Unit { println("""""") val prev = model.previous(pkg) if (prev != null) { println(""" PREV PACKAGE """) } else { println(""" PREV PACKAGE """ ) } val next = model.next(pkg) if (next != null) { println(""" NEXT PACKAGE""") } else { println(""" NEXT PACKAGE""" ) } println("""""") } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy