aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Formats/FormatService.kt8
-rw-r--r--src/Formats/HtmlFormatService.kt7
-rw-r--r--src/Formats/JekyllFormatService.kt7
-rw-r--r--src/Formats/MarkdownFormatService.kt3
-rw-r--r--src/Formats/StructuredFormatService.kt97
-rw-r--r--src/Formats/TextFormatService.kt7
-rw-r--r--src/Generation/FileGenerator.kt4
-rw-r--r--src/Kotlin/CrossReferences.kt11
-rw-r--r--src/Languages/KotlinLanguageService.kt39
-rw-r--r--src/Locations/LocationService.kt6
-rw-r--r--src/Model/Content.kt18
-rw-r--r--src/Resolution/ResolutionService.kt5
-rw-r--r--src/RichContent/RichString.kt84
-rw-r--r--src/main.kt9
-rw-r--r--styles/style.css2
-rw-r--r--test/src/model/CommentTest.kt1
16 files changed, 123 insertions, 185 deletions
diff --git a/src/Formats/FormatService.kt b/src/Formats/FormatService.kt
index f890c34a..9af74590 100644
--- a/src/Formats/FormatService.kt
+++ b/src/Formats/FormatService.kt
@@ -2,9 +2,9 @@ package org.jetbrains.dokka
public trait FormatService {
val extension: String
- fun appendNodes(to: StringBuilder, nodes: Iterable<DocumentationNode>)
- fun appendOutline(to: StringBuilder, nodes: Iterable<DocumentationNode>)
+ fun appendNodes(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>)
+ fun appendOutline(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>)
}
-fun FormatService.format(nodes: Iterable<DocumentationNode>): String = StringBuilder { appendNodes(this, nodes) }.toString()
-fun FormatService.formatOutline(nodes: Iterable<DocumentationNode>): String = StringBuilder { appendOutline(this, nodes) }.toString() \ No newline at end of file
+fun FormatService.format(location: Location, nodes: Iterable<DocumentationNode>): String = StringBuilder { appendNodes(location, this, nodes) }.toString()
+fun FormatService.formatOutline(location: Location, nodes: Iterable<DocumentationNode>): String = StringBuilder { appendOutline(location, this, nodes) }.toString() \ No newline at end of file
diff --git a/src/Formats/HtmlFormatService.kt b/src/Formats/HtmlFormatService.kt
index c3720956..06b41518 100644
--- a/src/Formats/HtmlFormatService.kt
+++ b/src/Formats/HtmlFormatService.kt
@@ -1,10 +1,9 @@
package org.jetbrains.dokka
public open class HtmlFormatService(locationService: LocationService,
- resolutionService: ResolutionService,
signatureGenerator: LanguageService,
val templateService: HtmlTemplateService = HtmlTemplateService.default())
-: StructuredFormatService(locationService, resolutionService, signatureGenerator) {
+: StructuredFormatService(locationService, signatureGenerator) {
override val extension: String = "html"
override public fun formatText(text: String): String {
@@ -95,9 +94,9 @@ public open class HtmlFormatService(locationService: LocationService,
}
- override fun appendNodes(to: StringBuilder, nodes: Iterable<DocumentationNode>) {
+ override fun appendNodes(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
templateService.appendHeader(to)
- super<StructuredFormatService>.appendNodes(to, nodes)
+ super<StructuredFormatService>.appendNodes(location, to, nodes)
templateService.appendFooter(to)
}
diff --git a/src/Formats/JekyllFormatService.kt b/src/Formats/JekyllFormatService.kt
index 459b5113..9870c8ee 100644
--- a/src/Formats/JekyllFormatService.kt
+++ b/src/Formats/JekyllFormatService.kt
@@ -1,17 +1,16 @@
package org.jetbrains.dokka
public class JekyllFormatService(locationService: LocationService,
- resolutionService: ResolutionService,
signatureGenerator: LanguageService)
-: MarkdownFormatService(locationService, resolutionService, signatureGenerator) {
+: MarkdownFormatService(locationService, signatureGenerator) {
override fun link(from: DocumentationNode, to: DocumentationNode): FormatLink = link(from, to, "html")
- override fun appendNodes(to: StringBuilder, nodes: Iterable<DocumentationNode>) {
+ override fun appendNodes(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
to.appendln("---")
to.appendln("layout: api")
to.appendln("title: ${nodes.first().name}")
to.appendln("---")
- super<MarkdownFormatService>.appendNodes(to, nodes)
+ super<MarkdownFormatService>.appendNodes(location, to, nodes)
}
} \ No newline at end of file
diff --git a/src/Formats/MarkdownFormatService.kt b/src/Formats/MarkdownFormatService.kt
index 7b71f638..cb1d713c 100644
--- a/src/Formats/MarkdownFormatService.kt
+++ b/src/Formats/MarkdownFormatService.kt
@@ -2,9 +2,8 @@ package org.jetbrains.dokka
public open class MarkdownFormatService(locationService: LocationService,
- resolutionService: ResolutionService,
signatureGenerator: LanguageService)
-: StructuredFormatService(locationService, resolutionService, signatureGenerator) {
+: StructuredFormatService(locationService, signatureGenerator) {
override val extension: String = "md"
diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt
index ea8ed36e..b974dcf8 100644
--- a/src/Formats/StructuredFormatService.kt
+++ b/src/Formats/StructuredFormatService.kt
@@ -5,7 +5,6 @@ import java.util.LinkedHashMap
public data class FormatLink(val text: String, val location: Location)
public abstract class StructuredFormatService(val locationService: LocationService,
- val resolutionService: ResolutionService,
val languageService: LanguageService) : FormatService {
abstract public fun appendBlockCode(to: StringBuilder, line: String)
@@ -31,19 +30,24 @@ public abstract class StructuredFormatService(val locationService: LocationServi
public abstract fun formatCode(code: String): String
public abstract fun formatBreadcrumbs(items: Iterable<FormatLink>): String
- open fun formatText(nodes: Iterable<ContentNode>): String {
- return nodes.map { formatText(it) }.join("")
+ open fun formatText(location: Location, nodes: Iterable<ContentNode>): String {
+ return nodes.map { formatText(location, it) }.join("")
}
- open fun formatText(node: ContentNode): String {
+ open fun formatText(location: Location, content: ContentNode): String {
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))
+ when (content) {
+ is ContentText -> append(content.text)
+ is ContentSymbol -> append(formatSymbol(content.text))
+ is ContentKeyword -> append(formatKeyword(content.text))
+ is ContentIdentifier -> append(formatIdentifier(content.text))
+ is ContentEmphasis -> append(formatBold(formatText(location, content.children)))
+ is ContentNodeLink -> {
+ val linkTo = locationService.relativeLocation(location, content.node, extension)
+ val linkText = formatText(location, content.children)
+ append(formatLink(linkText, linkTo))
+ }
+ else -> append(formatText(location, content.children))
}
}.toString()
}
@@ -54,71 +58,52 @@ public abstract class StructuredFormatService(val locationService: LocationServi
return FormatLink(to.name, locationService.relativeLocation(from, to, extension))
}
- open public fun appendDescription(to: StringBuilder, nodes: Iterable<DocumentationNode>) {
+ fun appendDescription(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
val described = nodes.filter { !it.doc.isEmpty }
if (described.any()) {
val single = described.size == 1
appendHeader(to, "Description", 3)
for (node in described) {
if (!single) {
- appendBlockCode(to, formatText(languageService.render(node)))
+ appendBlockCode(to, formatText(location, languageService.render(node)))
}
- appendLine(to, formatText(node.doc.description))
+ appendLine(to, formatText(location,node.doc.description))
appendLine(to)
for ((label, section) in node.doc.sections) {
if (label.startsWith("$"))
continue
appendLine(to, formatBold(formatText(label)))
- appendLine(to, formatText(section))
+ appendLine(to, formatText(location, section))
appendLine(to)
}
}
}
}
- open public fun appendSummary(to: StringBuilder, nodes: Iterable<DocumentationNode>) {
+ fun appendSummary(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
val breakdownBySummary = nodes.groupByTo(LinkedHashMap()) { node ->
node.doc.summary
}
for ((summary, items) in breakdownBySummary) {
items.forEach {
- appendBlockCode(to, formatText(languageService.render(it)))
+ appendBlockCode(to, formatText(location, languageService.render(it)))
}
- appendLine(to, formatText(summary))
+ appendLine(to, formatText(location, summary))
appendLine(to)
}
}
- open public fun appendLocation(to: StringBuilder, nodes: Iterable<DocumentationNode>) {
+ fun appendLocation(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
val breakdownByName = nodes.groupBy { node -> node.name }
for ((name, items) in breakdownByName) {
appendHeader(to, formatText(name))
- appendSummary(to, items)
- appendDescription(to, items)
- }
- }
-
- override fun appendNodes(to: StringBuilder, nodes: Iterable<DocumentationNode>) {
- val breakdownByLocation = nodes.groupBy { node ->
- formatBreadcrumbs(node.path.map { link(node, it) })
- }
-
- for ((breadcrumbs, items) in breakdownByLocation) {
- appendLine(to, breadcrumbs)
- appendLine(to)
- appendLocation(to, items)
- }
-
- 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)
+ appendSummary(location, to, items)
+ appendDescription(location, to, items)
}
}
- private fun StructuredFormatService.appendSection(caption: String, nodes: List<DocumentationNode>, node: DocumentationNode, to: StringBuilder) {
+ private fun StructuredFormatService.appendSection(location : Location, caption: String, nodes: List<DocumentationNode>, node: DocumentationNode, to: StringBuilder) {
if (nodes.any()) {
appendHeader(to, caption, 3)
@@ -127,20 +112,20 @@ public abstract class StructuredFormatService(val locationService: LocationServi
appendTable(to) {
appendTableBody(to) {
- for ((location, members) in membersMap) {
+ for ((memberLocation, members) in membersMap) {
appendTableRow(to) {
appendTableCell(to) {
- appendText(to, formatLink(location))
+ appendText(to, formatLink(memberLocation))
}
appendTableCell(to) {
val breakdownBySummary = members.groupBy { it.doc.summary }
for ((summary, items) in breakdownBySummary) {
for (signature in items) {
- appendBlockCode(to, formatText(languageService.render(signature)))
+ appendBlockCode(to, formatText(location, languageService.render(signature)))
}
if (!summary.isEmpty()) {
- appendText(to, formatText(summary))
+ appendText(to, formatText(location, summary))
}
}
}
@@ -151,10 +136,30 @@ public abstract class StructuredFormatService(val locationService: LocationServi
}
}
+ override fun appendNodes(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
+ val breakdownByLocation = nodes.groupBy { node ->
+ formatBreadcrumbs(node.path.map { link(node, it) })
+ }
+
+ for ((breadcrumbs, items) in breakdownByLocation) {
+ appendLine(to, breadcrumbs)
+ appendLine(to)
+ appendLocation(location, to, items)
+ }
+
+ for (node in nodes) {
+ appendSection(location, "Members", node.members, node, to)
+ appendSection(location, "Extensions", node.extensions, node, to)
+ appendSection(location, "Inheritors", node.inheritors, node, to)
+ appendSection(location, "Links", node.links, node, to)
+
+ }
+ }
+
abstract public fun appendOutlineHeader(to: StringBuilder, node: DocumentationNode)
abstract public fun appendOutlineChildren(to: StringBuilder, nodes: Iterable<DocumentationNode>)
- override public fun appendOutline(to: StringBuilder, nodes: Iterable<DocumentationNode>) {
+ public override fun appendOutline(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
for (node in nodes) {
appendOutlineHeader(to, node)
if (node.members.any()) {
diff --git a/src/Formats/TextFormatService.kt b/src/Formats/TextFormatService.kt
index 8fea5a6a..63d2ce42 100644
--- a/src/Formats/TextFormatService.kt
+++ b/src/Formats/TextFormatService.kt
@@ -2,21 +2,20 @@ package org.jetbrains.dokka
public class TextFormatService(val signatureGenerator: LanguageService) : FormatService {
override val extension: String = "txt"
- override fun appendNodes(to: StringBuilder,
- nodes: Iterable<DocumentationNode>) {
+ override fun appendNodes(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
for (node in nodes) {
with (to) {
appendln(signatureGenerator.render(node))
appendln()
appendln(node.doc.summary)
- for ((label,section) in node.doc.sections) {
+ for ((label, section) in node.doc.sections) {
appendln(label)
}
}
}
}
- override fun appendOutline(to: StringBuilder, nodes: Iterable<DocumentationNode>) {
+ override fun appendOutline(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
}
} \ No newline at end of file
diff --git a/src/Generation/FileGenerator.kt b/src/Generation/FileGenerator.kt
index 6419d06d..ac146503 100644
--- a/src/Generation/FileGenerator.kt
+++ b/src/Generation/FileGenerator.kt
@@ -16,7 +16,7 @@ public class FileGenerator(val signatureGenerator: LanguageService,
file.getParentFile()?.mkdirs()
FileOutputStream(file).use {
OutputStreamWriter(it, Charsets.UTF_8).use {
- it.write(formatService.format(items))
+ it.write(formatService.format(location, items))
}
}
buildPages(items.flatMap { it.members })
@@ -29,7 +29,7 @@ public class FileGenerator(val signatureGenerator: LanguageService,
file.getParentFile()?.mkdirs()
FileOutputStream(file).use {
OutputStreamWriter(it, Charsets.UTF_8).use {
- it.write(formatService.formatOutline(items))
+ it.write(formatService.formatOutline(location, items))
}
}
}
diff --git a/src/Kotlin/CrossReferences.kt b/src/Kotlin/CrossReferences.kt
index bfab8309..c06b81d4 100644
--- a/src/Kotlin/CrossReferences.kt
+++ b/src/Kotlin/CrossReferences.kt
@@ -1,7 +1,5 @@
package org.jetbrains.dokka
-import org.jetbrains.jet.lang.descriptors.ClassKind
-
/**
* Generates cross-references for documentation such as extensions for a type
*
@@ -26,6 +24,15 @@ public fun DocumentationContext.buildCrossReferences(node: DocumentationNode) {
typeNode?.addReferenceTo(node, DocumentationReference.Kind.Inheritor)
}
}
+ node.details.forEach { detail ->
+ val descriptor = relations[detail]
+ if (descriptor != null) {
+ val typeNode = descriptorToNode[descriptor]
+ if (typeNode != null) {
+ detail.addReferenceTo(typeNode, DocumentationReference.Kind.Link)
+ }
+ }
+ }
for (child in node.members) {
buildCrossReferences(child)
diff --git a/src/Languages/KotlinLanguageService.kt b/src/Languages/KotlinLanguageService.kt
index 851e7fe8..65ec6a57 100644
--- a/src/Languages/KotlinLanguageService.kt
+++ b/src/Languages/KotlinLanguageService.kt
@@ -49,41 +49,51 @@ class KotlinLanguageService : LanguageService {
}
}
+ fun ContentNode.renderLinked(node: DocumentationNode, body: ContentNode.(DocumentationNode)->Unit) {
+ val to = node.links.firstOrNull()
+ if (to == null)
+ body(node)
+ else
+ link(to) {
+ body(node)
+ }
+ }
+
fun ContentNode.renderType(node: DocumentationNode) {
val typeArguments = node.details(Kind.Type)
if (node.name == "Function${typeArguments.count() - 1}") {
// lambda
symbol("(")
renderList(typeArguments.take(typeArguments.size - 1)) {
- renderType(it)
+ renderLinked(it) { renderType(it) }
}
symbol(")")
text(" ")
symbol("->")
text(" ")
- renderType(typeArguments.last())
+ renderLinked(typeArguments.last()) { renderType(it) }
return
}
if (node.name == "ExtensionFunction${typeArguments.count() - 2}") {
// extension lambda
- renderType(typeArguments.first())
+ renderLinked(typeArguments.first()) { renderType(it) }
symbol(".")
symbol("(")
renderList(typeArguments.drop(1).take(typeArguments.size - 2)) {
- renderType(it)
+ renderLinked(it) { renderType(it) }
}
symbol(")")
text(" ")
symbol("->")
text(" ")
- renderType(typeArguments.last())
+ renderLinked(typeArguments.last()) { renderType(it) }
return
}
identifier(node.name)
if (typeArguments.any()) {
symbol("<")
renderList(typeArguments) {
- renderType(it)
+ renderLinked(it) { renderType(it) }
}
symbol(">")
}
@@ -103,7 +113,7 @@ class KotlinLanguageService : LanguageService {
if (constraints.any()) {
symbol(" : ")
renderList(constraints) {
- renderType(it)
+ renderLinked(it) { renderType(it) }
}
}
}
@@ -111,7 +121,8 @@ class KotlinLanguageService : LanguageService {
fun ContentNode.renderParameter(node: DocumentationNode) {
identifier(node.name)
symbol(": ")
- renderType(node.detail(Kind.Type))
+ val parameterType = node.detail(Kind.Type)
+ renderLinked(parameterType) { renderType(it) }
}
fun ContentNode.renderTypeParametersForNode(node: DocumentationNode) {
@@ -119,7 +130,7 @@ class KotlinLanguageService : LanguageService {
if (typeParameters.any()) {
symbol("<")
renderList(typeParameters) {
- renderTypeParameter(it)
+ renderLinked(it) { renderType(it) }
}
symbol("> ")
}
@@ -130,7 +141,7 @@ class KotlinLanguageService : LanguageService {
if (supertypes.any()) {
symbol(" : ")
renderList(supertypes) {
- renderTypeParameter(it)
+ renderLinked(it) { renderType(it) }
}
}
}
@@ -171,7 +182,7 @@ class KotlinLanguageService : LanguageService {
renderTypeParametersForNode(node)
val receiver = node.details(Kind.Receiver).singleOrNull()
if (receiver != null) {
- renderType(receiver.detail(Kind.Type))
+ renderLinked(receiver.detail(Kind.Type)) { renderType(it) }
symbol(".")
}
@@ -185,7 +196,7 @@ class KotlinLanguageService : LanguageService {
symbol(")")
if (node.kind != Kind.Constructor) {
symbol(": ")
- renderType(node.detail(Kind.Type))
+ renderLinked(node.detail(Kind.Type)) { renderType(it) }
}
}
@@ -198,12 +209,12 @@ class KotlinLanguageService : LanguageService {
renderTypeParametersForNode(node)
val receiver = node.details(Kind.Receiver).singleOrNull()
if (receiver != null) {
- renderType(receiver.detail(Kind.Type))
+ renderLinked(receiver.detail(Kind.Type)) { renderType(it) }
symbol(".")
}
identifier(node.name)
symbol(": ")
- renderType(node.detail(Kind.Type))
+ renderLinked(node.detail(Kind.Type)) { renderType(it) }
}
} \ No newline at end of file
diff --git a/src/Locations/LocationService.kt b/src/Locations/LocationService.kt
index 6472e906..277169fd 100644
--- a/src/Locations/LocationService.kt
+++ b/src/Locations/LocationService.kt
@@ -19,3 +19,9 @@ fun LocationService.relativeLocation(node: DocumentationNode, link: Documentatio
val memberPath = location(link).file.appendExtension(extension)
return Location(ownerFolder.getRelativePath(memberPath))
}
+
+fun LocationService.relativeLocation(location: Location, link: DocumentationNode, extension: String): Location {
+ val ownerFolder = location.file.getParentFile()!!
+ val memberPath = location(link).file.appendExtension(extension)
+ return Location(ownerFolder.getRelativePath(memberPath))
+}
diff --git a/src/Model/Content.kt b/src/Model/Content.kt
index 1b00bd34..4b92a958 100644
--- a/src/Model/Content.kt
+++ b/src/Model/Content.kt
@@ -18,16 +18,18 @@ public abstract class ContentNode {
}
public object ContentEmpty : ContentNode()
+public open 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()
+public class ContentEmphasis() : ContentBlock()
+public class ContentNodeLink(val node : DocumentationNode) : ContentBlock()
+public class ContentExternalLink(val href : String) : ContentBlock()
+public class ContentStrong() : ContentBlock()
+public class ContentList() : ContentBlock()
+public class ContentSection(public val label: String) : ContentBlock()
fun content(body: ContentNode.() -> Unit): ContentNode {
val block = ContentBlock()
@@ -40,6 +42,12 @@ fun ContentNode.keyword(value: String) = append(ContentKeyword(value))
fun ContentNode.symbol(value: String) = append(ContentSymbol(value))
fun ContentNode.identifier(value: String) = append(ContentIdentifier(value))
+fun ContentNode.link(to: DocumentationNode, body: ContentNode.() -> Unit) {
+ val block = ContentNodeLink(to)
+ block.body()
+ append(block)
+}
+
public class Content() : ContentNode() {
public val sections: Map<String, ContentSection> by Delegates.lazy {
val map = hashMapOf<String, ContentSection>()
diff --git a/src/Resolution/ResolutionService.kt b/src/Resolution/ResolutionService.kt
deleted file mode 100644
index f13d1ee0..00000000
--- a/src/Resolution/ResolutionService.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.jetbrains.dokka
-
-public trait ResolutionService {
- fun resolve(text: String): DocumentationNode
-} \ No newline at end of file
diff --git a/src/RichContent/RichString.kt b/src/RichContent/RichString.kt
deleted file mode 100644
index 2110c47f..00000000
--- a/src/RichContent/RichString.kt
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.jetbrains.dokka
-
-public class RichString {
- private val sliceList = arrayListOf<RichStringSlice>()
- public val slices: List<RichStringSlice> get() = sliceList
-
- public fun addSlice(slice: RichStringSlice) {
- if (slice.text.length() > 0)
- sliceList.add(slice)
- }
-
- public fun addSlice(text: String, style: RichStringStyle) {
- // TODO: decide on semantics
- // empty slices makes it hard to compare rich strings
- if (text.length > 0)
- sliceList.add(RichStringSlice(text, style))
- }
-
- public fun isEmpty(): Boolean = sliceList.isEmpty()
-
- public fun length(): Int = sliceList.fold(0) {(acc, value) -> return acc + value.text.length }
-
- public override fun toString(): String {
- return sliceList.joinToString("", "&")
- }
-
- override fun equals(other: Any?): Boolean {
- if (other !is RichString)
- return false
- if (sliceList.size != other.sliceList.size)
- return false
- for (index in sliceList.indices)
- if (!sliceList[index].equals(other.sliceList[index]))
- return false
-
- return true
- }
-
- override fun hashCode(): Int {
- return sliceList.map { it.hashCode() }.sum()
- }
-
- class object {
- public val empty: RichString = RichString()
- }
-}
-
-public data class RichStringSlice(public val text: String, public val style: RichStringStyle) {
- public override fun toString(): String {
- return text
- }
-}
-
-public trait RichStringStyle
-public object NormalStyle : RichStringStyle
-public object BoldStyle : RichStringStyle
-public object CodeStyle : RichStringStyle
-public data class LinkStyle(val link: String) : RichStringStyle
-
-public fun RichString.splitBy(delimiter: String): Pair<RichString, RichString> {
- var index = 0
- while (index < slices.size && !slices[index].text.contains(delimiter)) index++
- if (index == slices.size)
- return Pair(this, RichString.empty)
-
- val first = RichString()
- val second = RichString()
-
- for (i in 0..index - 1) {
- first.addSlice(slices[i])
- }
-
- val splitSlice = slices[index]
- val firstText = splitSlice.text.substringBefore(delimiter)
- val secondText = splitSlice.text.substringAfter(delimiter)
- first.addSlice(firstText, splitSlice.style)
- second.addSlice(secondText, splitSlice.style)
-
- for (i in index + 1..slices.size - 1) {
- second.addSlice(slices[i])
- }
-
- return Pair(first, second)
-}
diff --git a/src/main.kt b/src/main.kt
index 409e030a..24407e6a 100644
--- a/src/main.kt
+++ b/src/main.kt
@@ -54,7 +54,7 @@ public fun main(args: Array<String>) {
context.getPackageFragment(file)!!.fqName
}.toSet()
- context.createDocumentationModule(arguments.moduleName, module, packageSet)
+ context.createDocumentationModule(arguments.moduleName, module, packageSet, DocumentationOptions(true))
}
val timeAnalyse = System.currentTimeMillis() - startAnalyse
println("done in ${timeAnalyse / 1000} secs")
@@ -63,13 +63,8 @@ public fun main(args: Array<String>) {
val signatureGenerator = KotlinLanguageService()
val locationService = FoldersLocationService(arguments.outputDir)
val templateService = HtmlTemplateService.default("/dokka/styles/style.css")
- val resolutionService = object : ResolutionService {
- override fun resolve(text: String): DocumentationNode {
- return documentation
- }
- }
- val formatter = HtmlFormatService(locationService, resolutionService, signatureGenerator, templateService)
+ val formatter = HtmlFormatService(locationService, signatureGenerator, templateService)
val generator = FileGenerator(signatureGenerator, locationService, formatter)
print("Building pages... ")
generator.buildPage(documentation)
diff --git a/styles/style.css b/styles/style.css
index bf6f7000..82798bf8 100644
--- a/styles/style.css
+++ b/styles/style.css
@@ -44,7 +44,7 @@ h3, h4, h5, h6 {
}
a {
- color:#39c;
+ color:#258aaf;
font-weight:400;
text-decoration:none;
}
diff --git a/test/src/model/CommentTest.kt b/test/src/model/CommentTest.kt
index 62f64a58..9206e386 100644
--- a/test/src/model/CommentTest.kt
+++ b/test/src/model/CommentTest.kt
@@ -75,7 +75,6 @@ public class CommentTest {
Test fun emptySection() {
verifyModel("test/data/comments/emptySection.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals(NormalStyle, NormalStyle)
assertEquals("Summary", doc.summary.toTestString())
assertEquals(2, doc.sections.count())
with (doc.sections["one"]!!) {