added links to the extension functions from the summary page table and fixed up the detail extension function docs (also made nice use of the multi line treble quoted strings with templates, yay! :)
This commit is contained in:
+2
@@ -42,4 +42,6 @@ class ClassExtensionsTemplate(m: KModel, p: KPackage, k: KClass, var functions:
|
||||
""")
|
||||
}
|
||||
|
||||
override fun href(f: KFunction): String = "#${f.link}"
|
||||
|
||||
}
|
||||
|
||||
@@ -9,22 +9,22 @@ import java.util.Collection
|
||||
import org.jetbrains.kotlin.model.KProperty
|
||||
|
||||
abstract class KDocTemplate() : TextTemplate() {
|
||||
fun rootHref(pkg: KPackage): String {
|
||||
open fun rootHref(pkg: KPackage): String {
|
||||
return if (pkg.external) {
|
||||
// TODO deal with external classes
|
||||
""
|
||||
} else relativePrefix()
|
||||
}
|
||||
|
||||
fun href(p: KPackage): String
|
||||
open fun href(p: KPackage): String
|
||||
= "${rootHref(p)}${p.nameAsPath}/package-summary.html"
|
||||
|
||||
fun href(c: KClass): String {
|
||||
open fun href(c: KClass): String {
|
||||
val postfix = if (c.pkg.external) "?is-external=true" else ""
|
||||
return "${rootHref(c.pkg)}${c.nameAsPath}.html$postfix"
|
||||
}
|
||||
|
||||
fun href(f: KFunction): String {
|
||||
open fun href(f: KFunction): String {
|
||||
return if (f.owner is KClass) {
|
||||
"${href(f.owner)}#${f.link}"
|
||||
} else {
|
||||
@@ -32,7 +32,7 @@ abstract class KDocTemplate() : TextTemplate() {
|
||||
}
|
||||
}
|
||||
|
||||
fun href(f: KProperty): String {
|
||||
open fun href(f: KProperty): String {
|
||||
return if (f.owner is KClass) {
|
||||
"${href(f.owner)}#${f.link}"
|
||||
} else {
|
||||
@@ -40,12 +40,16 @@ abstract class KDocTemplate() : TextTemplate() {
|
||||
}
|
||||
}
|
||||
|
||||
fun extensionsHref(pkg: KPackage, c: KClass): String {
|
||||
open fun extensionsHref(pkg: KPackage, c: KClass): String {
|
||||
// is inside the pkg so no need to use it...
|
||||
return "${c.nameAsPath}-extensions.html"
|
||||
}
|
||||
|
||||
fun sourceHref(f: KFunction): String {
|
||||
open fun extensionsHref(pkg: KPackage, c: KClass, f: KFunction): String {
|
||||
return "${extensionsHref(pkg, c)}#${f.link}"
|
||||
}
|
||||
|
||||
open fun sourceHref(f: KFunction): String {
|
||||
return if (f.owner is KClass) {
|
||||
"${rootHref(f.owner.pkg)}src-html/${f.owner.simpleName}.html#line.${f.sourceLine}"
|
||||
} else {
|
||||
@@ -54,18 +58,18 @@ abstract class KDocTemplate() : TextTemplate() {
|
||||
}
|
||||
}
|
||||
|
||||
fun link(c: KClass, fullName: Boolean = false): String {
|
||||
open fun link(c: KClass, fullName: Boolean = false): String {
|
||||
// TODO if a class is a generic type parameter, just return the name...
|
||||
val prefix = if (c.isAnnotation()) "@" else ""
|
||||
val name = if (fullName) c.name else c.simpleName
|
||||
return "<A HREF=\"${href(c)}\" title=\"${c.kind} in ${c.packageName}\">$prefix$name</A>"
|
||||
}
|
||||
|
||||
fun link(p: KPackage): String {
|
||||
open fun link(p: KPackage): String {
|
||||
return "<A HREF=\"${href(p)}\" title=\"package ${p.name}}\">${p.name}</A>"
|
||||
}
|
||||
|
||||
fun link(a: KAnnotation): String {
|
||||
open fun link(a: KAnnotation): String {
|
||||
val c = a.klass
|
||||
return "<A HREF=\"${href(c)}\" title=\"annotation in ${c.packageName}\">@${c.simpleName}</A>"
|
||||
}
|
||||
|
||||
+8
-1
@@ -282,7 +282,14 @@ Copyright © 2010-2012. All Rights Reserved.
|
||||
if (c != null) {
|
||||
println("""<TR BGCOLOR="white" CLASS="TableRowColor">""")
|
||||
println("<TD WIDTH=\"15%\"><B><A HREF=\"${pkg.nameAsRelativePath}${c.name}.html\" title=\"extensions on ${pkg.name}\">${c.name}</A></B></TD>")
|
||||
println("<TD>${c.description}</TD>")
|
||||
print("<TD>")
|
||||
val list = e?.getValue()
|
||||
if (list != null) {
|
||||
for (f in list) {
|
||||
println("""<A HREF="${extensionsHref(pkg, c, f)}">${f.name}<A> """)
|
||||
}
|
||||
}
|
||||
println("</TD>")
|
||||
println("</TR>")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user