aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-10-03 19:09:31 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-10-03 19:09:31 +0400
commit7c6da4babd01da31c57c5c6c827eb2957c989b1c (patch)
tree1cc063c24326044b9ee968b2278e0864e8ee7051
parenta52e1d543d22fdacf87ec00988b753d2d1107c1d (diff)
downloaddokka-7c6da4babd01da31c57c5c6c827eb2957c989b1c.tar.gz
dokka-7c6da4babd01da31c57c5c6c827eb2957c989b1c.tar.bz2
dokka-7c6da4babd01da31c57c5c6c827eb2957c989b1c.zip
Language Service now formats to ContentNode instead of String.
-rw-r--r--src/Formats/HtmlFormatService.kt13
-rw-r--r--src/Formats/MarkdownFormatService.kt11
-rw-r--r--src/Formats/StructuredFormatService.kt18
-rw-r--r--src/Kotlin/CrossReferences.kt14
-rw-r--r--src/Kotlin/DocumentationNodeBuilder.kt13
-rw-r--r--src/Languages/JavaLanguageService.kt26
-rw-r--r--src/Languages/KotlinLanguageService.kt276
-rw-r--r--src/Languages/LanguageService.kt14
-rw-r--r--src/Model/Content.kt25
-rw-r--r--src/Model/DocumentationNode.kt3
-rw-r--r--src/Model/DocumentationReference.kt1
-rw-r--r--styles/style.css11
12 files changed, 266 insertions, 159 deletions
diff --git a/src/Formats/HtmlFormatService.kt b/src/Formats/HtmlFormatService.kt
index 550899ff..c3720956 100644
--- a/src/Formats/HtmlFormatService.kt
+++ b/src/Formats/HtmlFormatService.kt
@@ -10,16 +10,25 @@ public open class HtmlFormatService(locationService: LocationService,
override public fun formatText(text: String): String {
return text.htmlEscape()
}
+ override fun formatSymbol(text: String): String {
+ return "<span class=\"symbol\">${formatText(text)}</span>"
+ }
+ override fun formatKeyword(text: String): String {
+ return "<span class=\"keyword\">${formatText(text)}</span>"
+ }
+ override fun formatIdentifier(text: String): String {
+ return "<span class=\"identifier\">${formatText(text)}</span>"
+ }
override fun appendBlockCode(to: StringBuilder, line: String) {
to.appendln("<code>")
- to.appendln(line.htmlEscape())
+ to.appendln(line)
to.appendln("</code>")
}
override fun appendBlockCode(to: StringBuilder, lines: Iterable<String>) {
to.appendln("<code>")
- to.appendln(lines.map { it.htmlEscape() }.join("\n"))
+ to.appendln(lines.join("\n"))
to.appendln("</code>")
}
diff --git a/src/Formats/MarkdownFormatService.kt b/src/Formats/MarkdownFormatService.kt
index 3b87835f..7b71f638 100644
--- a/src/Formats/MarkdownFormatService.kt
+++ b/src/Formats/MarkdownFormatService.kt
@@ -16,6 +16,17 @@ public open class MarkdownFormatService(locationService: LocationService,
return text.htmlEscape()
}
+ override fun formatSymbol(text: String): String {
+ return text.htmlEscape()
+ }
+
+ override fun formatKeyword(text: String): String {
+ return text.htmlEscape()
+ }
+ override fun formatIdentifier(text: String): String {
+ return text.htmlEscape()
+ }
+
override public fun formatCode(code: String): String {
return "`$code`"
}
diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt
index f2fb9b41..ea8ed36e 100644
--- a/src/Formats/StructuredFormatService.kt
+++ b/src/Formats/StructuredFormatService.kt
@@ -22,6 +22,9 @@ public abstract class StructuredFormatService(val locationService: LocationServi
public abstract fun appendTableCell(to: StringBuilder, body: () -> Unit)
public abstract fun formatText(text: String): String
+ public abstract fun formatSymbol(text: String): String
+ public abstract fun formatKeyword(text: String): String
+ public abstract fun formatIdentifier(text: String): String
public abstract fun formatLink(text: String, location: Location): String
public open fun formatLink(link: FormatLink): String = formatLink(formatText(link.text), link.location)
public abstract fun formatBold(text: String): String
@@ -36,6 +39,9 @@ public abstract class StructuredFormatService(val locationService: LocationServi
return StringBuilder {
when (node) {
is ContentText -> append(node.text)
+ is ContentSymbol -> append(formatSymbol(node.text))
+ is ContentKeyword -> append(formatKeyword(node.text))
+ is ContentIdentifier -> append(formatIdentifier(node.text))
is ContentEmphasis -> append(formatBold(formatText(node.children)))
else -> append(formatText(node.children))
}
@@ -55,7 +61,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi
appendHeader(to, "Description", 3)
for (node in described) {
if (!single) {
- appendBlockCode(to, languageService.render(node))
+ appendBlockCode(to, formatText(languageService.render(node)))
}
appendLine(to, formatText(node.doc.description))
appendLine(to)
@@ -76,7 +82,9 @@ public abstract class StructuredFormatService(val locationService: LocationServi
}
for ((summary, items) in breakdownBySummary) {
- appendBlockCode(to, items.map { languageService.render(it) })
+ items.forEach {
+ appendBlockCode(to, formatText(languageService.render(it)))
+ }
appendLine(to, formatText(summary))
appendLine(to)
}
@@ -105,6 +113,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi
for (node in nodes) {
appendSection("Members", node.members, node, to)
appendSection("Extensions", node.extensions, node, to)
+ appendSection("Inheritors", node.inheritors, node, to)
appendSection("Links", node.links, node, to)
}
}
@@ -126,9 +135,8 @@ public abstract class StructuredFormatService(val locationService: LocationServi
appendTableCell(to) {
val breakdownBySummary = members.groupBy { it.doc.summary }
for ((summary, items) in breakdownBySummary) {
- val signatures = items.map { formatCode("${languageService.render(it)}") }
- for (signature in signatures) {
- appendText(to, signature)
+ for (signature in items) {
+ appendBlockCode(to, formatText(languageService.render(signature)))
}
if (!summary.isEmpty()) {
diff --git a/src/Kotlin/CrossReferences.kt b/src/Kotlin/CrossReferences.kt
index 7504cebc..bfab8309 100644
--- a/src/Kotlin/CrossReferences.kt
+++ b/src/Kotlin/CrossReferences.kt
@@ -19,19 +19,19 @@ public fun DocumentationContext.buildCrossReferences(node: DocumentationNode) {
typeNode?.addReferenceTo(node, DocumentationReference.Kind.Extension)
}
}
- node.details(DocumentationNode.Kind.Type).forEach { detail ->
+ node.details(DocumentationNode.Kind.Supertype).forEach { detail ->
val descriptor = relations[detail]
if (descriptor != null) {
val typeNode = descriptorToNode[descriptor]
- if (typeNode != null) {
- // if typeNode is null, type is external to module
- detail.addReferenceTo(typeNode, DocumentationReference.Kind.Link)
- }
+ typeNode?.addReferenceTo(node, DocumentationReference.Kind.Inheritor)
}
}
- for (member in node.members) {
- buildCrossReferences(member)
+ for (child in node.members) {
+ buildCrossReferences(child)
+ }
+ for (child in node.details) {
+ buildCrossReferences(child)
}
}
diff --git a/src/Kotlin/DocumentationNodeBuilder.kt b/src/Kotlin/DocumentationNodeBuilder.kt
index 66f71bf6..f29a17d5 100644
--- a/src/Kotlin/DocumentationNodeBuilder.kt
+++ b/src/Kotlin/DocumentationNodeBuilder.kt
@@ -40,6 +40,18 @@ class DocumentationNodeBuilder(val context: DocumentationContext) : DeclarationD
reference(data, node, DocumentationReference.Kind.Detail)
}
+ fun addSupertypes(descriptor: ClassDescriptor, data: DocumentationNode) {
+ val superTypes = descriptor.getTypeConstructor().getSupertypes()
+ for (superType in superTypes) {
+ val superDescriptor = superType.getConstructor().getDeclarationDescriptor()
+ if (superDescriptor != null && superType.toString() != "Any") {
+ val node = DocumentationNode(superType.toString(), Content.Empty, DocumentationNode.Kind.Supertype)
+ context.attach(node, superDescriptor)
+ reference(data, node, DocumentationReference.Kind.Detail)
+ }
+ }
+ }
+
fun addType(descriptor: DeclarationDescriptor, t: JetType?, data: DocumentationNode) {
if (t == null)
return
@@ -101,6 +113,7 @@ class DocumentationNodeBuilder(val context: DocumentationContext) : DeclarationD
reference(data!!, node, DocumentationReference.Kind.Member)
addModality(descriptor, node)
addVisibility(descriptor, node)
+ addSupertypes(descriptor, node)
context.register(descriptor, node)
return node
}
diff --git a/src/Languages/JavaLanguageService.kt b/src/Languages/JavaLanguageService.kt
index f5976ea9..5d2b48f1 100644
--- a/src/Languages/JavaLanguageService.kt
+++ b/src/Languages/JavaLanguageService.kt
@@ -3,8 +3,8 @@ package org.jetbrains.dokka
import org.jetbrains.dokka.DocumentationNode.*
class JavaLanguageService : LanguageService {
- override fun render(node: DocumentationNode): String {
- return when (node.kind) {
+ override fun render(node: DocumentationNode): ContentNode {
+ return ContentText(when (node.kind) {
Kind.Package -> renderPackage(node)
Kind.Class,
Kind.Interface,
@@ -20,7 +20,7 @@ class JavaLanguageService : LanguageService {
Kind.Function -> renderFunction(node)
Kind.Property -> renderProperty(node)
else -> "${node.kind}: ${node.name}"
- }
+ })
}
override fun renderName(node: DocumentationNode): String {
@@ -30,11 +30,11 @@ class JavaLanguageService : LanguageService {
}
}
- override fun renderPackage(node: DocumentationNode): String {
+ fun renderPackage(node: DocumentationNode): String {
return "package ${node.name}"
}
- override fun renderModifier(node: DocumentationNode): String {
+ fun renderModifier(node: DocumentationNode): String {
return when (node.name) {
"open" -> ""
"internal" -> ""
@@ -42,7 +42,7 @@ class JavaLanguageService : LanguageService {
}
}
- override fun renderType(node: DocumentationNode): String {
+ fun renderType(node: DocumentationNode): String {
return when (node.name) {
"Unit" -> "void"
"Int" -> "int"
@@ -56,7 +56,7 @@ class JavaLanguageService : LanguageService {
}
}
- override fun renderTypeParameter(node: DocumentationNode): String {
+ fun renderTypeParameter(node: DocumentationNode): String {
val constraints = node.details(Kind.UpperBound)
return if (constraints.none())
node.name
@@ -65,11 +65,11 @@ class JavaLanguageService : LanguageService {
}
}
- override fun renderParameter(node: DocumentationNode): String {
+ fun renderParameter(node: DocumentationNode): String {
return "${renderType(node.detail(Kind.Type))} ${node.name}"
}
- override fun renderTypeParametersForNode(node: DocumentationNode): String {
+ fun renderTypeParametersForNode(node: DocumentationNode): String {
return StringBuilder {
val typeParameters = node.details(Kind.TypeParameter)
if (typeParameters.any()) {
@@ -80,14 +80,14 @@ class JavaLanguageService : LanguageService {
}.toString()
}
- override fun renderModifiersForNode(node: DocumentationNode): String {
+ fun renderModifiersForNode(node: DocumentationNode): String {
val modifiers = node.details(Kind.Modifier).map { renderModifier(it) }.filter { it != "" }
if (modifiers.none())
return ""
return modifiers.join(" ", postfix = " ")
}
- override fun renderClass(node: DocumentationNode): String {
+ fun renderClass(node: DocumentationNode): String {
return StringBuilder {
when (node.kind) {
Kind.Class -> append("class ")
@@ -103,7 +103,7 @@ class JavaLanguageService : LanguageService {
}.toString()
}
- override fun renderFunction(node: DocumentationNode): String {
+ fun renderFunction(node: DocumentationNode): String {
return StringBuilder {
when (node.kind) {
Kind.Constructor -> append(node.owner?.name)
@@ -127,7 +127,7 @@ class JavaLanguageService : LanguageService {
}.toString()
}
- override fun renderProperty(node: DocumentationNode): String {
+ fun renderProperty(node: DocumentationNode): String {
return StringBuilder {
when (node.kind) {
Kind.Property -> append("val ")
diff --git a/src/Languages/KotlinLanguageService.kt b/src/Languages/KotlinLanguageService.kt
index 7307cffb..851e7fe8 100644
--- a/src/Languages/KotlinLanguageService.kt
+++ b/src/Languages/KotlinLanguageService.kt
@@ -3,24 +3,26 @@ package org.jetbrains.dokka
import org.jetbrains.dokka.DocumentationNode.*
class KotlinLanguageService : LanguageService {
- override fun render(node: DocumentationNode): String {
- return when (node.kind) {
- Kind.Package -> renderPackage(node)
- Kind.Class,
- Kind.Interface,
- Kind.Enum,
- Kind.EnumItem,
- Kind.Object -> renderClass(node)
-
- Kind.TypeParameter -> renderTypeParameter(node)
- Kind.Type,
- Kind.UpperBound -> renderType(node)
-
- Kind.Modifier -> renderModifier(node)
- Kind.Constructor,
- Kind.Function -> renderFunction(node)
- Kind.Property -> renderProperty(node)
- else -> "${node.kind}: ${node.name}"
+ override fun render(node: DocumentationNode): ContentNode {
+ return content {
+ when (node.kind) {
+ Kind.Package -> renderPackage(node)
+ Kind.Class,
+ Kind.Interface,
+ Kind.Enum,
+ Kind.EnumItem,
+ Kind.Object -> renderClass(node)
+
+ Kind.TypeParameter -> renderTypeParameter(node)
+ Kind.Type,
+ Kind.UpperBound -> renderType(node)
+
+ Kind.Modifier -> renderModifier(node)
+ Kind.Constructor,
+ Kind.Function -> renderFunction(node)
+ Kind.Property -> renderProperty(node)
+ else -> ContentText("${node.kind}: ${node.name}")
+ }
}
}
@@ -31,137 +33,177 @@ class KotlinLanguageService : LanguageService {
}
}
- override fun renderPackage(node: DocumentationNode): String {
- return "package ${node.name}"
+ fun ContentNode.renderPackage(node: DocumentationNode) {
+ keyword("package")
+ text(" ")
+ identifier(node.name)
}
- override fun renderType(node: DocumentationNode): String {
- val typeArguments = node.details(Kind.Type)
- val renders = typeArguments.map { renderType(it) }
+ fun ContentNode.renderList(nodes: List<DocumentationNode>, separator: String = ", ", renderItem: (DocumentationNode) -> Unit) {
+ if (nodes.none())
+ return
+ renderItem(nodes.first())
+ nodes.drop(1).forEach {
+ symbol(separator)
+ renderItem(it)
+ }
+ }
+ fun ContentNode.renderType(node: DocumentationNode) {
+ val typeArguments = node.details(Kind.Type)
if (node.name == "Function${typeArguments.count() - 1}") {
// lambda
- return "(${renders.take(renders.size - 1).join()}) -> ${renders.last()}"
+ symbol("(")
+ renderList(typeArguments.take(typeArguments.size - 1)) {
+ renderType(it)
+ }
+ symbol(")")
+ text(" ")
+ symbol("->")
+ text(" ")
+ renderType(typeArguments.last())
+ return
}
if (node.name == "ExtensionFunction${typeArguments.count() - 2}") {
// extension lambda
- return "${renders.first()}.(${renders.drop(1).take(renders.size - 2).join()}) -> ${renders.last()}"
+ renderType(typeArguments.first())
+ symbol(".")
+ symbol("(")
+ renderList(typeArguments.drop(1).take(typeArguments.size - 2)) {
+ renderType(it)
+ }
+ symbol(")")
+ text(" ")
+ symbol("->")
+ text(" ")
+ renderType(typeArguments.last())
+ return
+ }
+ identifier(node.name)
+ if (typeArguments.any()) {
+ symbol("<")
+ renderList(typeArguments) {
+ renderType(it)
+ }
+ symbol(">")
}
- if (typeArguments.none())
- return node.name
- return "${node.name}<${renders.join()}>"
}
- override fun renderModifier(node: DocumentationNode): String {
- return when (node.name) {
- "final" -> ""
- "internal" -> ""
- else -> node.name
+ fun ContentNode.renderModifier(node: DocumentationNode) {
+ when (node.name) {
+ "final", "internal" -> {
+ }
+ else -> keyword(node.name)
}
}
- override fun renderTypeParameter(node: DocumentationNode): String {
+ fun ContentNode.renderTypeParameter(node: DocumentationNode) {
val constraints = node.details(Kind.UpperBound)
- return if (constraints.none())
- node.name
- else {
- node.name + " : " + constraints.map { renderType(node) }.join()
+ identifier(node.name)
+ if (constraints.any()) {
+ symbol(" : ")
+ renderList(constraints) {
+ renderType(it)
+ }
}
}
- override fun renderParameter(node: DocumentationNode): String {
- return node.name + ": " + renderType(node.detail(Kind.Type))
+ fun ContentNode.renderParameter(node: DocumentationNode) {
+ identifier(node.name)
+ symbol(": ")
+ renderType(node.detail(Kind.Type))
}
- override fun renderTypeParametersForNode(node: DocumentationNode): String {
- return StringBuilder {
- val typeParameters = node.details(Kind.TypeParameter)
- if (typeParameters.any()) {
- append("<")
- append(typeParameters.map { renderTypeParameter(it) }.join())
- append("> ")
+ fun ContentNode.renderTypeParametersForNode(node: DocumentationNode) {
+ val typeParameters = node.details(Kind.TypeParameter)
+ if (typeParameters.any()) {
+ symbol("<")
+ renderList(typeParameters) {
+ renderTypeParameter(it)
}
- }.toString()
+ symbol("> ")
+ }
}
- override fun renderModifiersForNode(node: DocumentationNode): String {
- val modifiers = node.details(Kind.Modifier).map { renderModifier(it) }.filter { it != "" }
- if (modifiers.none())
- return ""
- return modifiers.join(" ", postfix = " ")
+ fun ContentNode.renderSupertypesForNode(node: DocumentationNode) {
+ val supertypes = node.details(Kind.Supertype)
+ if (supertypes.any()) {
+ symbol(" : ")
+ renderList(supertypes) {
+ renderTypeParameter(it)
+ }
+ }
}
- override fun renderClass(node: DocumentationNode): String {
- return StringBuilder {
- append(renderModifiersForNode(node))
- when (node.kind) {
- Kind.Class -> append("class ")
- Kind.Interface -> append("trait ")
- Kind.Enum -> append("enum class ")
- Kind.EnumItem -> append("enum val ")
- Kind.Object -> append("object ")
- else -> throw IllegalArgumentException("Node $node is not a class-like object")
- }
+ fun ContentNode.renderModifiersForNode(node: DocumentationNode) {
+ val modifiers = node.details(Kind.Modifier)
+ for (it in modifiers) {
+ if (node.kind == Kind.Interface && it.name == "abstract")
+ continue
+ renderModifier(it)
+ text(" ")
+ }
+ }
+
+ fun ContentNode.renderClass(node: DocumentationNode) {
+ renderModifiersForNode(node)
+ when (node.kind) {
+ Kind.Class -> keyword("class ")
+ Kind.Interface -> keyword("trait ")
+ Kind.Enum -> keyword("enum class ")
+ Kind.EnumItem -> keyword("enum val ")
+ Kind.Object -> keyword("object ")
+ else -> throw IllegalArgumentException("Node $node is not a class-like object")
+ }
- append(node.name)
- append(renderTypeParametersForNode(node))
-
- /*
- val constructors = node.members(Kind.Constructor)
- if (constructors.count() == 1) {
- append("(")
- append(constructors[0].details(Kind.Parameter).map { renderParameter(it) }.join())
- append(")")
- }
- */
- }.toString()
+ identifier(node.name)
+ renderTypeParametersForNode(node)
+ renderSupertypesForNode(node)
}
- override fun renderFunction(node: DocumentationNode): String {
- return StringBuilder {
- append(renderModifiersForNode(node))
- when (node.kind) {
- Kind.Constructor -> append(node.owner!!.name)
- Kind.Function -> append("fun ")
- else -> throw IllegalArgumentException("Node $node is not a function-like object")
- }
- append(renderTypeParametersForNode(node))
- val receiver = node.details(Kind.Receiver).singleOrNull()
- if (receiver != null) {
- append(renderType(receiver.detail(Kind.Type)))
- append(".")
- }
+ fun ContentNode.renderFunction(node: DocumentationNode) {
+ renderModifiersForNode(node)
+ when (node.kind) {
+ Kind.Constructor -> identifier(node.owner!!.name)
+ Kind.Function -> keyword("fun ")
+ else -> throw IllegalArgumentException("Node $node is not a function-like object")
+ }
+ renderTypeParametersForNode(node)
+ val receiver = node.details(Kind.Receiver).singleOrNull()
+ if (receiver != null) {
+ renderType(receiver.detail(Kind.Type))
+ symbol(".")
+ }
- if (node.kind != Kind.Constructor)
- append(node.name)
+ if (node.kind != Kind.Constructor)
+ identifier(node.name)
- append("(")
- append(node.details(Kind.Parameter).map { renderParameter(it) }.join())
- append(")")
- if (node.kind != Kind.Constructor) {
- append(": ")
- append(renderType(node.detail(Kind.Type)))
- }
- }.toString()
+ symbol("(")
+ renderList(node.details(Kind.Parameter)) {
+ renderParameter(it)
+ }
+ symbol(")")
+ if (node.kind != Kind.Constructor) {
+ symbol(": ")
+ renderType(node.detail(Kind.Type))
+ }
}
- override fun renderProperty(node: DocumentationNode): String {
- return StringBuilder {
- append(renderModifiersForNode(node))
- when (node.kind) {
- Kind.Property -> append("val ")
- else -> throw IllegalArgumentException("Node $node is not a property")
- }
- append(renderTypeParametersForNode(node))
- val receiver = node.details(Kind.Receiver).singleOrNull()
- if (receiver != null) {
- append(renderType(receiver.detail(Kind.Type)))
- append(".")
- }
+ fun ContentNode.renderProperty(node: DocumentationNode) {
+ renderModifiersForNode(node)
+ when (node.kind) {
+ Kind.Property -> keyword("val ")
+ else -> throw IllegalArgumentException("Node $node is not a property")
+ }
+ renderTypeParametersForNode(node)
+ val receiver = node.details(Kind.Receiver).singleOrNull()
+ if (receiver != null) {
+ renderType(receiver.detail(Kind.Type))
+ symbol(".")
+ }
- append(node.name)
- append(": ")
- append(renderType(node.detail(Kind.Type)))
- }.toString()
+ identifier(node.name)
+ symbol(": ")
+ renderType(node.detail(Kind.Type))
}
} \ No newline at end of file
diff --git a/src/Languages/LanguageService.kt b/src/Languages/LanguageService.kt
index 728503b0..26217d41 100644
--- a/src/Languages/LanguageService.kt
+++ b/src/Languages/LanguageService.kt
@@ -1,17 +1,7 @@
package org.jetbrains.dokka
trait LanguageService {
- fun render(node: DocumentationNode): String
- fun renderName(node: DocumentationNode): String
- fun renderFunction(node: DocumentationNode): String
- fun renderClass(node: DocumentationNode): String
- fun renderTypeParametersForNode(node: DocumentationNode): String
- fun renderTypeParameter(node: DocumentationNode): String
- fun renderParameter(node: DocumentationNode): String
- fun renderType(node: DocumentationNode): String
- fun renderPackage(node: DocumentationNode): String
- fun renderProperty(node: DocumentationNode): String
- fun renderModifier(node: DocumentationNode): String
- fun renderModifiersForNode(node: DocumentationNode): String
+ fun render(node: DocumentationNode): ContentNode
+ fun renderName(node: DocumentationNode) : String
}
diff --git a/src/Model/Content.kt b/src/Model/Content.kt
index eb092cb2..1b00bd34 100644
--- a/src/Model/Content.kt
+++ b/src/Model/Content.kt
@@ -9,18 +9,37 @@ public abstract class ContentNode {
val empty = ContentEmpty
}
+ fun append(node : ContentNode) : ContentNode {
+ children.add(node)
+ return this
+ }
+
fun isEmpty() = children.isEmpty()
}
-public object ContentEmpty : ContentNode( )
+public object ContentEmpty : ContentNode()
-public class ContentText(val text : String) : ContentNode( )
-public class ContentBlock() : ContentNode( )
+public class ContentText(val text: String) : ContentNode()
+public class ContentKeyword(val text: String) : ContentNode()
+public class ContentIdentifier(val text: String) : ContentNode()
+public class ContentSymbol(val text: String) : ContentNode()
+public class ContentBlock() : ContentNode()
public class ContentEmphasis() : ContentNode()
public class ContentStrong() : ContentNode()
public class ContentList() : ContentNode()
public class ContentSection(public val label: String) : ContentNode()
+fun content(body: ContentNode.() -> Unit): ContentNode {
+ val block = ContentBlock()
+ block.body()
+ return block
+}
+
+fun ContentNode.text(value: String) = append(ContentText(value))
+fun ContentNode.keyword(value: String) = append(ContentKeyword(value))
+fun ContentNode.symbol(value: String) = append(ContentSymbol(value))
+fun ContentNode.identifier(value: String) = append(ContentIdentifier(value))
+
public class Content() : ContentNode() {
public val sections: Map<String, ContentSection> by Delegates.lazy {
val map = hashMapOf<String, ContentSection>()
diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt
index cb6a13db..18efaa9b 100644
--- a/src/Model/DocumentationNode.kt
+++ b/src/Model/DocumentationNode.kt
@@ -16,6 +16,8 @@ public open class DocumentationNode(val name: String,
get() = references(DocumentationReference.Kind.Member).map { it.to }
public val extensions: List<DocumentationNode>
get() = references(DocumentationReference.Kind.Extension).map { it.to }
+ public val inheritors: List<DocumentationNode>
+ get() = references(DocumentationReference.Kind.Inheritor).map { it.to }
public val links: List<DocumentationNode>
get() = references(DocumentationReference.Kind.Link).map { it.to }
@@ -61,6 +63,7 @@ public open class DocumentationNode(val name: String,
Receiver
TypeParameter
Type
+ Supertype
UpperBound
LowerBound
Exception
diff --git a/src/Model/DocumentationReference.kt b/src/Model/DocumentationReference.kt
index fdc29b9e..1849fe08 100644
--- a/src/Model/DocumentationReference.kt
+++ b/src/Model/DocumentationReference.kt
@@ -7,6 +7,7 @@ public data class DocumentationReference(val from: DocumentationNode, val to: Do
Detail
Link
Extension
+ Inheritor
Override
}
}
diff --git a/styles/style.css b/styles/style.css
index 012587a6..bf6f7000 100644
--- a/styles/style.css
+++ b/styles/style.css
@@ -7,6 +7,17 @@ body, table {
font-weight:300;
}
+.keyword {
+ color:black;
+}
+
+.symbol {
+}
+
+.identifier {
+ color: darkblue;
+}
+
h1, h2, h3, h4, h5, h6 {
color:#222;
margin:0 0 20px;