aboutsummaryrefslogtreecommitdiff
path: root/plugins/javadoc
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2020-06-18 12:00:46 +0200
committerBłażej Kardyś <bkardys@virtuslab.com>2020-06-23 02:57:40 +0200
commit0206be47827e5b072dac3deb9ccc1792ba95b13c (patch)
treee00704bbb2a872e64b575c5f11ade21551a86535 /plugins/javadoc
parentef2db3b74d2653c2f84eda4d7058ffcb546dae1d (diff)
downloaddokka-0206be47827e5b072dac3deb9ccc1792ba95b13c.tar.gz
dokka-0206be47827e5b072dac3deb9ccc1792ba95b13c.tar.bz2
dokka-0206be47827e5b072dac3deb9ccc1792ba95b13c.zip
Javadoc classlikes and function pages
All implemented interfaces, first attempt at inherited methods
Diffstat (limited to 'plugins/javadoc')
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/JavadocLocationProvider.kt2
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt81
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt114
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt23
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocPageNodes.kt112
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/pages/OverviewSummary.kt161
-rw-r--r--plugins/javadoc/src/main/resources/static_res/script.js139
-rw-r--r--plugins/javadoc/src/main/resources/views/class.korte274
8 files changed, 712 insertions, 194 deletions
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/JavadocLocationProvider.kt b/plugins/javadoc/src/main/kotlin/javadoc/JavadocLocationProvider.kt
index 520486f6..a92320dd 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/JavadocLocationProvider.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/JavadocLocationProvider.kt
@@ -91,7 +91,7 @@ class JavadocLocationProvider(pageRoot: RootPageNode, private val context: Dokka
}
}?.joinToString("/")?.let {if (skipExtension) "$it.html" else it}?.let {
Paths.get(dir).relativize(Paths.get(it)).toString()
- } ?: run {throw IllegalStateException("Page for ${link.name} not found")}
+ } ?: run {""} //TODO just a glue to compile it on HMPP
override fun resolveRoot(node: PageNode): String {
TODO("Not yet implemented")
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt b/plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt
index 64fc539f..a3bef099 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt
@@ -3,14 +3,21 @@ package javadoc
import javadoc.pages.*
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.base.signatures.SignatureProvider
+import org.jetbrains.dokka.base.signatures.function
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
import org.jetbrains.dokka.base.transformers.pages.comments.DocTagToContentConverter
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.doc.Description
+import org.jetbrains.dokka.model.doc.Param
+import org.jetbrains.dokka.model.doc.TagWrapper
+import org.jetbrains.dokka.model.doc.Text
+import org.jetbrains.dokka.model.properties.PropertyContainer
+import org.jetbrains.dokka.model.properties.WithExtraProperties
import org.jetbrains.dokka.pages.ContentKind
import org.jetbrains.dokka.pages.DCI
import org.jetbrains.dokka.utilities.DokkaLogger
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
+import org.jetbrains.kotlin.utils.addToStdlib.safeAs
open class JavadocPageCreator(
commentsToContentConverter: CommentsToContentConverter,
@@ -28,21 +35,28 @@ open class JavadocPageCreator(
fun pageForPackage(p: DPackage) =
JavadocPackagePageNode(p.name, contentForPackage(p), setOf(p.dri), p,
- p.classlikes.map { pageForClasslike(it) } // TODO: nested classlikes
- ).also {
- it
- }
+ p.classlikes.mapNotNull { pageForClasslike(it) } // TODO: nested classlikes
+ )
- fun pageForClasslike(c: DClasslike): JavadocClasslikePageNode {
- val constructors = when (c) {
- is DClass -> c.constructors
- is DEnum -> c.constructors
- else -> emptyList()
+ fun pageForClasslike(c: DClasslike): JavadocClasslikePageNode? =
+ c.sourceSets.firstOrNull { it.platform == Platform.jvm }?.let {jvm ->
+ JavadocClasslikePageNode(
+ name = c.name.orEmpty(),
+ content = contentForClasslike(c),
+ dri = setOf(c.dri),
+ modifiers = listOfNotNull(c.visibility[jvm]?.name),
+ signature = signatureProvider.signature(c),
+ description = c.description(jvm),
+ constructors = c.safeAs<WithConstructors>()?.constructors?.map { it.toJavadocFunction(jvm) }.orEmpty(),
+ methods = c.functions.map { it.toJavadocFunction(jvm) },
+ entries = c.safeAs<DEnum>()?.entries?.map { JavadocEntryNode(signatureProvider.signature(it), it.description(jvm)) }.orEmpty(),
+ classlikes = c.classlikes.mapNotNull { pageForClasslike(it) },
+ properties = c.properties.map { JavadocPropertyNode(signatureProvider.signature(it), TextNode(it.description(jvm), setOf(jvm))) },
+ documentable = c,
+ extras = c.safeAs<WithExtraProperties<Documentable>>()?.extra ?: PropertyContainer.empty()
+ )
}
- return JavadocClasslikePageNode(c.name.orEmpty(), contentForClasslike(c), setOf(c.dri), c, emptyList())
- }
-
fun contentForModule(m: DModule): JavadocContentNode =
JavadocContentGroup(
setOf(m.dri),
@@ -96,5 +110,48 @@ open class JavadocPageCreator(
kind = JavadocContentKind.Class
)
}
+
+ private fun signatureForProjection(p: Projection): String =
+ when (p) {
+ is OtherParameter -> p.name
+ is TypeConstructor -> if (p.function)
+ "TODO"
+ else {
+ val other = if(p.projections.isNotEmpty()){
+ p.projections.joinToString(prefix = "<", postfix = ">") { signatureForProjection(it) }
+ } else {
+ ""
+ }
+ "${p.dri.classNames.orEmpty()} $other"
+ }
+
+ is Variance -> "${p.kind} ${signatureForProjection(p.inner)}"
+ is Star -> "*"
+ is Nullable -> "${signatureForProjection(p.inner)}?"
+ is JavaObject -> "Object"
+ is Void -> "Void"
+ is PrimitiveJavaType -> p.name
+ is Dynamic -> "dynamic"
+ is UnresolvedBound -> p.name
+ }
+
+ private fun DFunction.toJavadocFunction(sourceSetData: SourceSetData) = JavadocFunctionNode(
+ name = name,
+ signature = signatureProvider.signature(this),
+ brief = TextNode(description(sourceSetData), setOf(sourceSetData)),
+ parameters = parameters.map {
+ JavadocParameterNode(
+ name = it.name.orEmpty(),
+ type = signatureForProjection(it.type),
+ description = TextNode(it.findNodeInDocumentation<Param>(sourceSetData), setOf(sourceSetData))
+ )
+ },
+ extras = extra
+ )
+
+ private fun Documentable.description(sourceSetData: SourceSetData): String = findNodeInDocumentation<Description>(sourceSetData)
+
+ private inline fun <reified T: TagWrapper> Documentable.findNodeInDocumentation(sourceSetData: SourceSetData): String =
+ documentation[sourceSetData]?.children?.firstIsInstanceOrNull<T>()?.root?.children?.firstIsInstanceOrNull<Text>()?.body.orEmpty()
}
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt b/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt
index aa7c2dfe..1026ea5c 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt
@@ -8,13 +8,19 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import org.jetbrains.dokka.base.renderers.OutputWriter
import org.jetbrains.dokka.links.DRI
+import org.jetbrains.dokka.links.sureClassNames
+import org.jetbrains.dokka.model.ImplementedInterfaces
+import org.jetbrains.dokka.model.InheritedFunction
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.renderers.Renderer
+import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import java.nio.file.Path
import java.nio.file.Paths
import java.time.LocalDate
+typealias PageContent = Map<String, Any?>
+
class KorteJavadocRenderer(val outputWriter: OutputWriter, val context: DokkaContext, val resourceDir: String) :
Renderer {
private lateinit var locationProvider: JavadocLocationProvider
@@ -67,8 +73,7 @@ class KorteJavadocRenderer(val outputWriter: OutputWriter, val context: DokkaCon
"docName" to "docName", // todo docname
"pathToRoot" to pathToRoot,
"dir" to dir
- ) + node.contentMap
-// DokkaConsoleLogger.info("${node::class.java.canonicalName}::${node.name} - $link")
+ ) + renderContentNodes(node)
writeFromTemplate(outputWriter, link, templateForNode(node), contentMap.toList())
node.children.forEach { renderNode(it, link.toNormalized()) }
}
@@ -120,11 +125,11 @@ class KorteJavadocRenderer(val outputWriter: OutputWriter, val context: DokkaCon
)
}
- private fun renderContentNode(content: ContentNode) = when(content) {
- is ContentText -> content.text
- is ContentComposite -> renderContent(content.children)
- else -> ""
- }
+// private fun renderContentNode(content: ContentNode) = when(content) {
+// is ContentText -> content.text
+// is ContentComposite -> renderContent(content.children)
+// else -> ""
+// }
private fun renderContent(content: List<ContentNode>): String =
content.joinToString("") { renderContentNode(it) }
@@ -179,7 +184,10 @@ class KorteJavadocRenderer(val outputWriter: OutputWriter, val context: DokkaCon
}
rootNodes.joinToString{ drawRec(it) }
},
- Filter("length") { subject.dynamicLength() }
+ Filter("length") { subject.dynamicLength() },
+ TeFunction("hasAnyDescription"){ args ->
+ args.first().safeAs<List<HashMap<String, String>>>()?.any { it["description"]?.trim()?.isNotEmpty() ?: false }
+ }
).forEach {
when (it) {
is TeFunction -> config.register(it)
@@ -197,4 +205,94 @@ class KorteJavadocRenderer(val outputWriter: OutputWriter, val context: DokkaCon
javaClass.classLoader.getResourceAsStream("$basePath/$template")?.bufferedReader()?.lines()?.toArray()
?.joinToString("\n") ?: throw IllegalStateException("Template not found: $basePath/$template")
}
+
+ private fun renderContentNodes(node: JavadocPageNode): PageContent =
+ when(node){
+ is JavadocClasslikePageNode -> renderClasslikeNode(node)
+ is JavadocFunctionNode -> renderFunctionNode(node)
+ else -> node.contentMap
+ }
+
+ private fun renderFunctionNode(node: JavadocFunctionNode): PageContent {
+ val (modifiers, signature) = node.modifiersAndSignature
+ return mapOf(
+ "signature" to renderContentNode(node.signature),
+ "brief" to renderContentNode(node.brief),
+ "parameters" to node.parameters.map { renderParameterNode(it) },
+ "inlineParameters" to node.parameters.joinToString { "${it.type} ${it.name}" },
+ "modifiers" to renderContentNode(modifiers),
+ "signatureWithoutModifiers" to renderContentNode(signature)) + node.contentMap
+ }
+
+ private fun renderParameterNode(node: JavadocParameterNode): PageContent =
+ mapOf(
+ "description" to renderContentNode(node.description),
+ ) + node.contentMap
+
+ private fun renderClasslikeNode(node: JavadocClasslikePageNode): PageContent =
+ mapOf(
+ "constructors" to node.constructors.map { renderContentNodes(it) },
+ "signature" to renderContentNode(node.signature),
+ "methods" to renderClasslikeMethods(node.methods),
+ "entries" to node.entries.map { renderEntryNode(it) },
+ "properties" to node.properties.map { renderPropertyNode(it)},
+ "classlikes" to node.classlikes.map { renderNestedClasslikeNode(it) },
+ "implementedInterfaces" to renderImplementedInterfaces(node)
+ ) + node.contentMap
+
+ private fun renderImplementedInterfaces(node: JavadocClasslikePageNode) =
+ node.extras[ImplementedInterfaces]?.interfaces?.map { it.displayable() }.orEmpty()
+
+ private fun renderClasslikeMethods(nodes: List<JavadocFunctionNode>): PageContent {
+ val (inherited, own) = nodes.partition { it.extras[InheritedFunction]?.isInherited ?: false }
+ return mapOf(
+ "own" to own.map { renderContentNodes(it) },
+ "inherited" to inherited.map { renderInheritedMethod(it) }.groupBy { it["inheritedFrom"] as String }.entries.map {
+ mapOf("inheritedFrom" to it.key, "names" to it.value.map{ it["name"] as String }.sorted().joinToString() )
+ }
+ )
+ }
+
+ private fun renderInheritedMethod(node: JavadocFunctionNode): PageContent {
+ val inheritedFrom = node.extras[InheritedFunction]?.inheritedFrom
+ return mapOf(
+ "inheritedFrom" to inheritedFrom?.displayable().orEmpty(),
+ "name" to node.name
+ )
+ }
+
+ private fun renderNestedClasslikeNode(node: JavadocClasslikePageNode): PageContent {
+ return mapOf(
+ "modifiers" to (node.modifiers + "static" + node.contentMap["kind"]).joinToString(separator = " "),
+ "signature" to node.name,
+ "description" to node.description
+ )
+ }
+
+ private fun renderPropertyNode(node: JavadocPropertyNode): PageContent {
+ val (modifiers, signature) = node.modifiersAndSignature
+ return mapOf(
+ "modifiers" to renderContentNode(modifiers),
+ "signature" to renderContentNode(signature),
+ "description" to renderContentNode(node.brief)
+ )
+ }
+
+ private fun renderEntryNode(node: JavadocEntryNode): PageContent =
+ mapOf(
+ "signature" to renderContentNode(node.signature),
+ ) + node.contentMap
+
+
+ //TODO is it possible to use html renderer?
+ private fun renderContentNode(node: ContentNode): String =
+ when(node){
+ is ContentGroup -> node.children.joinToString(separator = "") { renderContentNode(it) }
+ is ContentText -> node.text
+ is TextNode -> node.text
+ is ContentLink -> """<a href="TODO">${node.children.joinToString { renderContentNode(it) }} </a>"""
+ else -> ""
+ }
+
+ private fun DRI.displayable(): String = "${packageName}.${sureClassNames}"
} \ No newline at end of file
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt b/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt
index 031ce970..1c42adb3 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt
@@ -37,6 +37,8 @@ class EmptyNode(
override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentNode =
EmptyNode(dci.dri.first(), dci.kind, sourceSets, newExtras)
+
+ override fun hasAnyContent(): Boolean = false
}
class JavadocContentGroup(
@@ -56,6 +58,8 @@ class JavadocContentGroup(
): JavadocContentGroup =
JavadocContentGroup(dri, kind, sourceSets, JavaContentGroupBuilder(sourceSets).apply(block).list)
}
+
+ override fun hasAnyContent(): Boolean = children.isNotEmpty()
}
class JavaContentGroupBuilder(val sourceSets: Set<SourceSetData>) {
@@ -71,6 +75,8 @@ class TitleNode(
sourceSets: Set<SourceSetData>
) : JavadocContentNode(dri, kind, sourceSets) {
+ override fun hasAnyContent(): Boolean = !title.isBlank() || !version.isBlank()
+
override val contentMap: Map<String, Any?> by lazy {
mapOf(
"title" to title,
@@ -78,8 +84,6 @@ class TitleNode(
"packageName" to parent
)
}
-
-// override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentNode = TODO()
}
fun JavaContentGroupBuilder.title(
@@ -92,6 +96,18 @@ fun JavaContentGroupBuilder.title(
list.add(TitleNode(title, version, parent, dri, kind, sourceSets))
}
+data class TextNode(
+ val text: String,
+ override val sourceSets: Set<SourceSetData>
+) : JavadocContentNode(emptySet(), ContentKind.Main, sourceSets) {
+
+ override fun hasAnyContent(): Boolean = !text.isBlank()
+
+ override val contentMap: Map<String, Any?> = mapOf(
+ "text" to text,
+ )
+}
+
class ListNode(
val tabTitle: String,
val colTitle: String,
@@ -100,6 +116,9 @@ class ListNode(
val kind: Kind,
sourceSets: Set<SourceSetData>
) : JavadocContentNode(dri, kind, sourceSets) {
+
+ override fun hasAnyContent(): Boolean = children.isNotEmpty()
+
override val contentMap: Map<String, Any?> by lazy {
mapOf(
"tabTitle" to tabTitle,
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocPageNodes.kt b/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocPageNodes.kt
index 118bc4d3..7f6abb15 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocPageNodes.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocPageNodes.kt
@@ -6,10 +6,12 @@ import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.base.renderers.platforms
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.*
+import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.*
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.resolve.DescriptorUtils.getClassDescriptorForType
+import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
interface JavadocPageNode : ContentPage {
val contentMap: Map<String, Any?>
@@ -79,20 +81,98 @@ class JavadocPackagePageNode(
)
}
+data class JavadocEntryNode(
+ val signature: ContentNode,
+ val brief: String
+) {
+ val contentMap: Map<String, Any?> = mapOf(
+ "brief" to brief
+ )
+}
+
+data class JavadocParameterNode(
+ val name: String,
+ val type: String,
+ val description: ContentNode
+) {
+ val contentMap: Map<String, Any?> = mapOf(
+ "name" to name,
+ "type" to type
+ )
+}
+
+data class JavadocPropertyNode(
+ val signature: ContentNode,
+ val brief: ContentNode
+){
+ val modifiersAndSignature: Pair<ContentNode, ContentNode>
+ get() = (signature as ContentGroup).splitSignatureIntoModifiersAndName()
+}
+
+data class JavadocFunctionNode(
+ val signature: ContentNode,
+ val brief: ContentNode,
+ val parameters: List<JavadocParameterNode>,
+ override val name: String,
+ override val dri: Set<DRI> = emptySet(),
+ override val content: ContentNode = EmptyNode(DRI.topLevel, ContentKind.Classlikes, emptySet()),
+ override val children: List<PageNode> = emptyList(),
+ override val documentable: Documentable? = null,
+ override val embeddedResources: List<String> = emptyList(),
+ val extras: PropertyContainer<DFunction> = PropertyContainer.empty()
+): JavadocPageNode {
+ override val contentMap: Map<String, Any?> = mapOf(
+ "name" to name
+ )
+
+ override fun modified(
+ name: String,
+ children: List<PageNode>
+ ): PageNode = TODO()
+
+ override fun modified(
+ name: String,
+ content: ContentNode,
+ dri: Set<DRI>,
+ embeddedResources: List<String>,
+ children: List<PageNode>
+ ): ContentPage = TODO()
+
+ val modifiersAndSignature: Pair<ContentNode, ContentNode>
+ get() = (signature as ContentGroup).splitSignatureIntoModifiersAndName()
+
+}
+
class JavadocClasslikePageNode(
override val name: String,
override val content: JavadocContentNode,
override val dri: Set<DRI>,
-
+ val modifiers: List<String>,
+ val signature: ContentNode,
+ val description: String,
+ val constructors: List<JavadocFunctionNode>,
+ val methods: List<JavadocFunctionNode>,
+ val entries: List<JavadocEntryNode>,
+ val classlikes: List<JavadocClasslikePageNode>,
+ val properties: List<JavadocPropertyNode>,
override val documentable: Documentable? = null,
override val children: List<PageNode> = emptyList(),
- override val embeddedResources: List<String> = listOf()
+ override val embeddedResources: List<String> = listOf(),
+ val extras: PropertyContainer<Documentable>,
) : JavadocPageNode {
- override val contentMap: Map<String, Any?> by lazy { mapOf("kind" to "class") + content.contentMap }
+ override val contentMap: Map<String, Any?> by lazy {
+ mapOf(
+ "kind" to documentable?.kind(),
+ "name" to name,
+ "package" to dri.first().packageName,
+ "classlikeDocumentation" to description
+ ) + content.contentMap
+ }
+
override fun modified(
name: String,
children: List<PageNode>
- ): PageNode = JavadocClasslikePageNode(name, content, dri, documentable, children, embeddedResources)
+ ): PageNode = JavadocClasslikePageNode(name, content, dri, modifiers, signature, description, constructors, methods, entries, classlikes, properties, documentable, children, embeddedResources, extras)
override fun modified(
name: String,
@@ -101,7 +181,7 @@ class JavadocClasslikePageNode(
embeddedResources: List<String>,
children: List<PageNode>
): ContentPage =
- JavadocClasslikePageNode(name, content as JavadocContentNode, dri, documentable, children, embeddedResources)
+ JavadocClasslikePageNode(name, content as JavadocContentNode, dri, modifiers, signature, description, constructors, methods, entries, classlikes, properties, documentable, children, embeddedResources, extras)
}
class AllClassesPage(val classes: List<JavadocClasslikePageNode>) : JavadocPageNode {
@@ -295,10 +375,8 @@ class TreeViewPage(
descriptorInheritanceTree.forEach { addToMap(it, mergeMap) }
psiInheritanceTree.forEach { addToMap(it, mergeMap) }
- val g = mergeMap.entries.find { it.key.classNames == "Any" || it.key.classNames == "Object" }?.value?.dri?.let(::collect)
- val rootClasses = listOf("Any", "Object")
val rootNodes = mergeMap.entries.filter {
- it.key.classNames in rootClasses //TODO: Probably should be matched by DRI, not just className
+ it.key.classNames in setOf("Any", "Object") //TODO: Probably should be matched by DRI, not just className
}.map {
collect(it.value.dri)
}
@@ -350,4 +428,20 @@ class TreeViewPage(
interface ContentValue
data class StringValue(val text: String) : ContentValue
-data class ListValue(val list: List<String>) : ContentValue \ No newline at end of file
+data class ListValue(val list: List<String>) : ContentValue
+
+private fun ContentGroup.splitSignatureIntoModifiersAndName(): Pair<ContentNode, ContentNode> {
+ val signature = children.firstIsInstance<ContentGroup>()
+ val modifiers = signature.children.takeWhile { it !is ContentLink }
+ return Pair(signature.copy(children = modifiers), signature.copy(children = signature.children.drop(modifiers.size)))
+}
+
+private fun Documentable.kind(): String? =
+ when(this){
+ is DClass -> "class"
+ is DEnum -> "enum"
+ is DAnnotation -> "annotation"
+ is DObject -> "object"
+ is DInterface -> "interface"
+ else -> null
+ } \ No newline at end of file
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/pages/OverviewSummary.kt b/plugins/javadoc/src/main/kotlin/javadoc/pages/OverviewSummary.kt
deleted file mode 100644
index ae573007..00000000
--- a/plugins/javadoc/src/main/kotlin/javadoc/pages/OverviewSummary.kt
+++ /dev/null
@@ -1,161 +0,0 @@
-package javadoc.pages
-
-import java.time.LocalDate
-
-internal fun overviewSummary(title: String, version: String) = """
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<!-- NewPage -->
-<html lang="en">
-<head>
-<title>Overview ($title $version API)</title>
-<meta name="date" content="${LocalDate.now()}">
-<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
-<script type="text/javascript" src="script.js"></script>
-</head>
-<body>
-<script type="text/javascript"><!--
- try {
- if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Overview ($title $version API)";
- }
- }
- catch(err) {
- }
-//-->
-</script>
-<noscript>
-<div>JavaScript is disabled on your browser.</div>
-</noscript>
-<!-- ========= START OF TOP NAVBAR ======= -->
-<div class="topNav"><a name="navbar.top">
-<!-- -->
-</a>
-<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
-<a name="navbar.top.firstrow">
-<!-- -->
-</a>
-<ul class="navList" title="Navigation">
-<li class="navBarCell1Rev">Overview</li>
-<li>Package</li>
-<li>Class</li>
-<li><a href="overview-tree.html">Tree</a></li>
-<li><a href="deprecated-list.html">Deprecated</a></li>
-<li><a href="index-all.html">Index</a></li>
-<li><a href="help-doc.html">Help</a></li>
-</ul>
-</div>
-<div class="subNav">
-<ul class="navList">
-<li>Prev</li>
-<li>Next</li>
-</ul>
-<ul class="navList">
-<li><a href="index.html?overview-summary.html" target="_top">Frames</a></li>
-<li><a href="overview-summary.html" target="_top">No&nbsp;Frames</a></li>
-</ul>
-<ul class="navList" id="allclasses_navbar_top">
-<li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li>
-</ul>
-<div>
-<script type="text/javascript"><!--
- allClassesLink = document.getElementById("allclasses_navbar_top");
- if(window==top) {
- allClassesLink.style.display = "block";
- }
- else {
- allClassesLink.style.display = "none";
- }
- //-->
-</script>
-</div>
-<a name="skip.navbar.top">
-<!-- -->
-</a></div>
-<!-- ========= END OF TOP NAVBAR ========= -->
-<div class="header">
-<h1 class="title">terrain-generator 0.0.1 API</h1>
-</div>
-<div class="contentContainer">
-<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Packages table, listing packages, and an explanation">
-<caption><span>Packages</span><span class="tabEnd">&nbsp;</span></caption>
-<tr>
-<th class="colFirst" scope="col">Package</th>
-<th class="colLast" scope="col">Description</th>
-</tr>
-<tbody>
-<tr class="altColor">
-<td class="colFirst"><a href="adaptation/package-summary.html">adaptation</a></td>
-<td class="colLast">&nbsp;</td>
-</tr>
-<tr class="rowColor">
-<td class="colFirst"><a href="app/package-summary.html">app</a></td>
-<td class="colLast">&nbsp;</td>
-</tr>
-<tr class="altColor">
-<td class="colFirst"><a href="common/package-summary.html">common</a></td>
-<td class="colLast">&nbsp;</td>
-</tr>
-<tr class="rowColor">
-<td class="colFirst"><a href="model/package-summary.html">model</a></td>
-<td class="colLast">&nbsp;</td>
-</tr>
-<tr class="altColor">
-<td class="colFirst"><a href="processor/package-summary.html">processor</a></td>
-<td class="colLast">&nbsp;</td>
-</tr>
-<tr class="rowColor">
-<td class="colFirst"><a href="transformation/package-summary.html">transformation</a></td>
-<td class="colLast">&nbsp;</td>
-</tr>
-</tbody>
-</table>
-</div>
-<!-- ======= START OF BOTTOM NAVBAR ====== -->
-<div class="bottomNav"><a name="navbar.bottom">
-<!-- -->
-</a>
-<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
-<a name="navbar.bottom.firstrow">
-<!-- -->
-</a>
-<ul class="navList" title="Navigation">
-<li class="navBarCell1Rev">Overview</li>
-<li>Package</li>
-<li>Class</li>
-<li><a href="overview-tree.html">Tree</a></li>
-<li><a href="deprecated-list.html">Deprecated</a></li>
-<li><a href="index-all.html">Index</a></li>
-<li><a href="help-doc.html">Help</a></li>
-</ul>
-</div>
-<div class="subNav">
-<ul class="navList">
-<li>Prev</li>
-<li>Next</li>
-</ul>
-<ul class="navList">
-<li><a href="index.html?overview-summary.html" target="_top">Frames</a></li>
-<li><a href="overview-summary.html" target="_top">No&nbsp;Frames</a></li>
-</ul>
-<ul class="navList" id="allclasses_navbar_bottom">
-<li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li>
-</ul>
-<div>
-<script type="text/javascript"><!--
- allClassesLink = document.getElementById("allclasses_navbar_bottom");
- if(window==top) {
- allClassesLink.style.display = "block";
- }
- else {
- allClassesLink.style.display = "none";
- }
- //-->
-</script>
-</div>
-<a name="skip.navbar.bottom">
-<!-- -->
-</a></div>
-<!-- ======== END OF BOTTOM NAVBAR ======= -->
-</body>
-</html>
-""" \ No newline at end of file
diff --git a/plugins/javadoc/src/main/resources/static_res/script.js b/plugins/javadoc/src/main/resources/static_res/script.js
new file mode 100644
index 00000000..15fe6ac1
--- /dev/null
+++ b/plugins/javadoc/src/main/resources/static_res/script.js
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+var moduleSearchIndex;
+var packageSearchIndex;
+var typeSearchIndex;
+var memberSearchIndex;
+var tagSearchIndex;
+function loadScripts(doc, tag) {
+ createElem(doc, tag, 'jquery/jszip/dist/jszip.js');
+ createElem(doc, tag, 'jquery/jszip-utils/dist/jszip-utils.js');
+ if (window.navigator.userAgent.indexOf('MSIE ') > 0 || window.navigator.userAgent.indexOf('Trident/') > 0 ||
+ window.navigator.userAgent.indexOf('Edge/') > 0) {
+ createElem(doc, tag, 'jquery/jszip-utils/dist/jszip-utils-ie.js');
+ }
+ createElem(doc, tag, 'search.js');
+
+ $.get(pathtoroot + "module-search-index.zip")
+ .done(function() {
+ JSZipUtils.getBinaryContent(pathtoroot + "module-search-index.zip", function(e, data) {
+ var zip = new JSZip(data);
+ zip.load(data);
+ moduleSearchIndex = JSON.parse(zip.file("module-search-index.json").asText());
+ });
+ });
+ $.get(pathtoroot + "package-search-index.zip")
+ .done(function() {
+ JSZipUtils.getBinaryContent(pathtoroot + "package-search-index.zip", function(e, data) {
+ var zip = new JSZip(data);
+ zip.load(data);
+ packageSearchIndex = JSON.parse(zip.file("package-search-index.json").asText());
+ });
+ });
+ $.get(pathtoroot + "type-search-index.zip")
+ .done(function() {
+ JSZipUtils.getBinaryContent(pathtoroot + "type-search-index.zip", function(e, data) {
+ var zip = new JSZip(data);
+ zip.load(data);
+ typeSearchIndex = JSON.parse(zip.file("type-search-index.json").asText());
+ });
+ });
+ $.get(pathtoroot + "member-search-index.zip")
+ .done(function() {
+ JSZipUtils.getBinaryContent(pathtoroot + "member-search-index.zip", function(e, data) {
+ var zip = new JSZip(data);
+ zip.load(data);
+ memberSearchIndex = JSON.parse(zip.file("member-search-index.json").asText());
+ });
+ });
+ $.get(pathtoroot + "tag-search-index.zip")
+ .done(function() {
+ JSZipUtils.getBinaryContent(pathtoroot + "tag-search-index.zip", function(e, data) {
+ var zip = new JSZip(data);
+ zip.load(data);
+ tagSearchIndex = JSON.parse(zip.file("tag-search-index.json").asText());
+ });
+ });
+ if (!moduleSearchIndex) {
+ createElem(doc, tag, 'module-search-index.js');
+ }
+ if (!packageSearchIndex) {
+ createElem(doc, tag, 'package-search-index.js');
+ }
+ if (!typeSearchIndex) {
+ createElem(doc, tag, 'type-search-index.js');
+ }
+ if (!memberSearchIndex) {
+ createElem(doc, tag, 'member-search-index.js');
+ }
+ if (!tagSearchIndex) {
+ createElem(doc, tag, 'tag-search-index.js');
+ }
+ $(window).resize(function() {
+ $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
+ });
+}
+
+function createElem(doc, tag, path) {
+ var script = doc.createElement(tag);
+ var scriptElement = doc.getElementsByTagName(tag)[0];
+ script.src = pathtoroot + path;
+ scriptElement.parentNode.insertBefore(script, scriptElement);
+}
+
+function show(type) {
+ count = 0;
+ for (var key in data) {
+ var row = document.getElementById(key);
+ if ((data[key] & type) !== 0) {
+ row.style.display = '';
+ row.className = (count++ % 2) ? rowColor : altColor;
+ }
+ else
+ row.style.display = 'none';
+ }
+ updateTabs(type);
+}
+
+function updateTabs(type) {
+ for (var value in tabs) {
+ var sNode = document.getElementById(tabs[value][0]);
+ var spanNode = sNode.firstChild;
+ if (value == type) {
+ sNode.className = activeTableTab;
+ spanNode.innerHTML = tabs[value][1];
+ }
+ else {
+ sNode.className = tableTab;
+ spanNode.innerHTML = "<a href=\"javascript:show("+ value + ");\">" + tabs[value][1] + "</a>";
+ }
+ }
+}
+
+function updateModuleFrame(pFrame, cFrame) {
+ top.packageFrame.location = pFrame;
+ top.classFrame.location = cFrame;
+}
diff --git a/plugins/javadoc/src/main/resources/views/class.korte b/plugins/javadoc/src/main/resources/views/class.korte
index 9b19df08..a9120fb2 100644
--- a/plugins/javadoc/src/main/resources/views/class.korte
+++ b/plugins/javadoc/src/main/resources/views/class.korte
@@ -1,2 +1,274 @@
{% extends "components/base.korte" %}
-{% block content %} default {% end %} \ No newline at end of file
+{% block content %}
+
+<main role="main">
+ <div class="header">
+ <div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">{{ package }}</a></div>
+ <h2 title="{{ kind|capitalize }} {{ name }}" class="title">{{ kind|capitalize }} {{ name }}</h2>
+ </div>
+ <div class="contentContainer">
+ <!-- <ul class="inheritance">
+ <li>java.lang.Object</li>
+ <li>
+ <ul class="inheritance">
+ <li>adaptation.Adaptation</li>
+ </ul>
+ </li>
+ </ul> TODO inheritance tree -->
+ <div class="description">
+ <ul class="blockList">
+ <li class="blockList">
+ {% if implementedInterfaces.size != 0 %}
+ <dl>
+ <dt>All Implemented Interfaces:</dt>
+ <dd>
+ {% for name in implementedInterfaces %}
+ <code>{{ name }}</code>
+ {% if !loop.last %}
+ ,
+ {% endif %}
+ {% endfor %}
+ </dd>
+ </dl>
+ {% endif %}
+ <hr>
+ <pre>{{ signature|raw }}</pre>
+ <div class="block">{{ classlikeDocumentation }}</div>
+ </li>
+ </ul>
+ </div>
+ <div class="summary">
+ <ul class="blockList">
+ <li class="blockList">
+ <!-- ======== NESTED CLASS SUMMARY ======== -->
+ {% if classlikes.size != 0 %}
+ <section role="region">
+ <ul class="blockList">
+ <li class="blockList"><a id="nested.class.summary">
+ <!-- -->
+ </a>
+ <h3>Nested Class Summary</h3>
+ <table class="memberSummary">
+ <caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
+ <tr>
+ <th class="colFirst" scope="col">Modifier and Type</th>
+ <th class="colSecond" scope="col">Class</th>
+ <th class="colLast" scope="col">Description</th>
+ </tr>
+ {% for classlike in classlikes %}
+ <tr class="{{ rowColor(loop.index0) }}">
+ <td class="colFirst"><code>{{ classlike.modifiers }}</code></td>
+ <th class="colSecond" scope="row"><code>{{ classlike.signature }}</span></code>
+ </th>
+ <td class="colLast">{{ classlike.description }}</td>
+ </tr>
+ {% endfor %}
+ </table>
+ </li>
+ </ul>
+ </section>
+ {% endif %}
+ <!-- =========== FIELD SUMMARY =========== -->
+ {% if properties.size != 0 %}
+ <section role="region">
+ <ul class="blockList">
+ <li class="blockList"><a id="field.summary">
+ <!-- -->
+ </a>
+ <h3>Field Summary</h3>
+ <table class="memberSummary">
+ <caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
+ <tr>
+ <th class="colFirst" scope="col">Modifier and Type</th>
+ <th class="colSecond" scope="col">Field</th>
+ <th class="colLast" scope="col">Description</th>
+ </tr>
+ {% for property in properties %}
+ <tr class="{{ rowColor(loop.index0) }}">
+ <td class="colFirst"><code>{{ property.modifiers|raw }}</code></td>
+ <th class="colSecond" scope="row"><code>{{ property.signature|raw }}</code></th>
+ <td class="colLast">{{ description|raw }}</td>
+ </tr>
+ {% endfor %}
+ </table>
+ </li>
+ </ul>
+ </section>
+ {% endif %}
+ <!-- ======== CONSTRUCTOR SUMMARY ======== -->
+ {% if constructors.size != 0 %}
+ <section role="region">
+ <ul class="blockList">
+ <li class="blockList"><a id="constructor.summary">
+ <!-- -->
+ </a>
+ <h3>Constructor Summary</h3>
+ <table class="memberSummary">
+ <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
+ <tbody>
+ <tr>
+ <th class="colFirst" scope="col">Constructor</th>
+ <th class="colLast" scope="col">Description</th>
+ </tr>
+
+ {% for constructor in constructors %}
+ <tr class="{{ rowColor(loop.index0) }}">
+ <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a
+ href="#%3Cinit%3E({{ constructor.inlineParameters }})">{{ constructor.name }}</a></span>({{ constructor.inlineParameters }})</code></th>
+ <td class="colLast">{{ constructor.brief }}</td>
+ </tr>
+ {% endfor %}
+
+ </tbody>
+ </table>
+ </li>
+ </ul>
+ </section>
+ {% endif %}
+ <!-- =========== ENUM CONSTANT SUMMARY =========== -->
+ {% if entries.size != 0 %}
+ <section role="region">
+ <ul class="blockList">
+ <li class="blockList"><a id="enum.constant.summary">
+ <!-- -->
+ </a>
+ <h3>Enum Constant Summary</h3>
+ <table class="memberSummary">
+ <caption><span>Enum Constants</span><span class="tabEnd">&nbsp;</span></caption>
+ <tr>
+ <th class="colFirst" scope="col">Enum Constant</th>
+ <th class="colLast" scope="col">Description</th>
+ </tr>
+ {% for entry in entries %}
+ <tr class="{{ rowColor(loop.index0) }}">
+ <th class="colFirst" scope="row"><code><span class="memberNameLink"><a
+ href="TODO">{{ entry.signature|raw }}</a></span></code></th>
+ <td class="colLast">{{ entry.brief }}</td>
+ </tr>
+ {% endfor %}
+ </table>
+ </li>
+ </ul>
+ </section>
+ {% endif %}
+ <!-- ========== METHOD SUMMARY =========== -->
+ {% if methods.own.size !=0 || methods.inherited.size != 0 %}
+ <section role="region">
+ <ul class="blockList">
+ <li class="blockList"><a id="method.summary">
+ <!-- -->
+ </a>
+ <h3>Method Summary</h3>
+ <table class="memberSummary">
+ <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span
+ class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a
+ href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span
+ id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span
+ class="tabEnd">&nbsp;</span></span></caption>
+ <tbody>
+ <tr>
+ <th class="colFirst" scope="col">Modifier and Type</th>
+ <th class="colSecond" scope="col">Method</th>
+ <th class="colLast" scope="col">Description</th>
+ </tr>
+ {% for method in methods.own %}
+ <tr id="i{{ loop.index0 }}" class="{{ rowColor(loop.index0) }}">
+ <td class="colFirst"><code>{{ method.modifiers|raw }}</code>
+ </td>
+ <th class="colSecond" scope="row"><code>{{ method.signatureWithoutModifiers|raw }} </code>
+ </th>
+ <td class="colLast">{{ method.brief|raw }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ <ul class="blockList">
+ {% for method in methods.inherited %}
+ <li class="blockList"><a id="methods.inherited.from.class.{{ method.inheritedFrom}}">
+ <!-- -->
+ </a>
+ <h3>Methods inherited from class&nbsp;{{ method.inheritedFrom}}</h3>
+ <code>{{ method.names }}</code></li>
+ {% endfor %}
+ <li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
+ <!-- -->
+ </a>
+ <h3>Methods inherited from class&nbsp;java.lang.Object</h3>
+ <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString,
+ wait, wait, wait</code></li>
+ </ul>
+ </li>
+ </ul>
+ </section>
+ {% endif %}
+ </li>
+ </ul>
+ </div>
+ <div class="details">
+ <ul class="blockList">
+ <li class="blockList">
+ <!-- ========= CONSTRUCTOR DETAIL ======== -->
+ {% if constructors.size != 0 %}
+ <section role="region">
+ <ul class="blockList">
+ <li class="blockList"><a id="constructor.detail">
+ <!-- -->
+ </a>
+ <h3>Constructor Detail</h3>
+ {% for constructor in constructors %}
+ <a id="&lt;{{ constructor.name }}&gt;({{ constructor.inlineParameters }})">
+ <!-- -->
+ </a>
+ <ul class="blockList">
+ <li class="blockList">
+ <h4>{{ constructor.name }}</h4>
+ <pre>{{ constructor.name }}({{ constructor.inlineParameters }})</pre>
+ <div class="block">{{ constructor.brief }}</div>
+ {% if constructor.parameters.size != 0 && hasAnyDescription(constructor.parameters) %}
+ <dl>
+ <dt><span class="paramLabel">Parameters:</span></dt>
+ {% for parameter in constructor.parameters %}
+ {% if parameter.description != "" %}
+ <dd><code>{{ parameter.name }}</code> - {{ parameter.description }}</dd>
+ {% endif %}
+ {% endfor %}
+ </dl>
+ {% endif %}
+ </li>
+ </ul>
+ {% endfor %}
+ </li>
+ </ul>
+ </section>
+ {% endif %}
+ <!-- ============ METHOD DETAIL ========== -->
+ {% if methods.own.size != 0 %}
+ <section role="region">
+ <ul class="blockList">
+ <li class="blockList"><a id="method.detail">
+ <!-- -->
+ </a>
+ <h3>Method Detail</h3>
+ {% for method in methods.own %}
+ <a id="transform(model.ModelGraph,transformation.Transformation)">
+ <!-- TODO -->
+ </a>
+ <ul class="blockListLast">
+ <li class="blockList">
+ <h4>{{ method.name }}</h4>
+ <pre class="methodSignature">{{ method.signature|raw }}</pre>
+ <div class="block">{{ method.brief|raw }}</div>
+ <!-- TODO missing return annotation -->
+ </li>
+ </ul>
+ {% endfor %}
+ </li>
+ </ul>
+ </section>
+ {% endif %}
+ </li>
+ </ul>
+ </div>
+ </div>
+</main>
+{% end %} \ No newline at end of file