aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.idea/runConfigurations/Stdlib.xml2
-rw-r--r--src/Formats/KotlinWebsiteFormatService.kt4
-rw-r--r--src/Formats/MarkdownFormatService.kt4
-rw-r--r--src/Formats/StructuredFormatService.kt14
-rw-r--r--src/Formats/TextFormatService.kt4
-rw-r--r--src/Generation/ConsoleGenerator.kt2
-rw-r--r--src/Kotlin/DocumentationBuilder.kt2
-rw-r--r--src/Locations/LocationService.kt2
-rw-r--r--src/Model/Content.kt4
-rw-r--r--src/Model/DocumentationModule.kt2
-rw-r--r--src/Model/DocumentationNode.kt12
-rw-r--r--src/main.kt28
-rw-r--r--test/src/model/ClassTest.kt24
-rw-r--r--test/src/model/CommentTest.kt72
-rw-r--r--test/src/model/FunctionTest.kt24
-rw-r--r--test/src/model/JavaTest.kt2
-rw-r--r--test/src/model/PackageTest.kt12
-rw-r--r--test/src/model/PropertyTest.kt16
18 files changed, 129 insertions, 101 deletions
diff --git a/.idea/runConfigurations/Stdlib.xml b/.idea/runConfigurations/Stdlib.xml
index 2a040cac..4fb2b4ff 100644
--- a/.idea/runConfigurations/Stdlib.xml
+++ b/.idea/runConfigurations/Stdlib.xml
@@ -3,7 +3,7 @@
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="org.jetbrains.dokka.DokkaPackage" />
<option name="VM_PARAMETERS" value="-Xmx2048m -Xms256m" />
- <option name="PROGRAM_PARAMETERS" value="../kotlin/libraries/stdlib/src ../kotlin/core/builtins -samples ../kotlin/libraries/stdlib/test -output doc -module stdlib" />
+ <option name="PROGRAM_PARAMETERS" value="../kotlin/libraries/stdlib/src ../kotlin/core/builtins -samples ../kotlin/libraries/stdlib/test -output doc -module stdlib -include ../kotlin/libraries/stdlib/src/Module.md" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
diff --git a/src/Formats/KotlinWebsiteFormatService.kt b/src/Formats/KotlinWebsiteFormatService.kt
index 9fee14ff..ea54c97a 100644
--- a/src/Formats/KotlinWebsiteFormatService.kt
+++ b/src/Formats/KotlinWebsiteFormatService.kt
@@ -27,10 +27,6 @@ public class KotlinWebsiteFormatService(locationService: LocationService,
return "<a href=\"${href}\">${text}</a>"
}
- override fun appendText(to: StringBuilder, text: String) {
- to.appendln("<p markdown=\"1\">${text}</p>")
- }
-
override fun appendTable(to: StringBuilder, body: () -> Unit) {
to.appendln("<table class=\"api-docs-table\">")
body()
diff --git a/src/Formats/MarkdownFormatService.kt b/src/Formats/MarkdownFormatService.kt
index 54298e2a..8f9699c2 100644
--- a/src/Formats/MarkdownFormatService.kt
+++ b/src/Formats/MarkdownFormatService.kt
@@ -55,7 +55,9 @@ public open class MarkdownFormatService(locationService: LocationService,
}
override public fun appendText(to: StringBuilder, text: String) {
- to.append(text)
+ to.appendln()
+ to.appendln(text)
+ to.appendln()
}
override public fun appendHeader(to: StringBuilder, text: String, level: Int) {
diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt
index 5287e688..280aa6b5 100644
--- a/src/Formats/StructuredFormatService.kt
+++ b/src/Formats/StructuredFormatService.kt
@@ -73,7 +73,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi
}
fun appendDescription(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
- val described = nodes.filter { !it.doc.isEmpty }
+ val described = nodes.filter { !it.content.isEmpty }
if (described.any()) {
val single = described.size == 1
appendHeader(to, "Description", 3)
@@ -81,11 +81,13 @@ public abstract class StructuredFormatService(val locationService: LocationServi
if (!single) {
appendBlockCode(to, formatText(location, languageService.render(node)))
}
- appendLine(to, formatText(location,node.doc.description))
+ appendLine(to, formatText(location,node.content.description))
appendLine(to)
- for ((label, section) in node.doc.sections) {
+ for ((label, section) in node.content.sections) {
if (label.startsWith("$"))
continue
+ if (node.members.any { it.name == label })
+ continue
appendLine(to, formatStrong(formatText(label)))
appendLine(to, formatText(location, section))
}
@@ -95,14 +97,14 @@ public abstract class StructuredFormatService(val locationService: LocationServi
fun appendSummary(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
val breakdownBySummary = nodes.groupByTo(LinkedHashMap()) { node ->
- node.doc.summary
+ formatText(location, node.summary)
}
for ((summary, items) in breakdownBySummary) {
items.forEach {
appendBlockCode(to, formatText(location, languageService.render(it)))
}
- appendLine(to, formatText(location, summary))
+ appendLine(to, summary)
appendLine(to)
}
}
@@ -131,7 +133,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi
appendText(to, formatLink(memberLocation))
}
appendTableCell(to) {
- val breakdownBySummary = members.groupBy { formatText(location, it.doc.summary) }
+ val breakdownBySummary = members.groupBy { formatText(location, it.summary) }
for ((summary, items) in breakdownBySummary) {
for (signature in items) {
appendBlockCode(to, formatText(location, languageService.render(signature)))
diff --git a/src/Formats/TextFormatService.kt b/src/Formats/TextFormatService.kt
index 63d2ce42..4e43cbcc 100644
--- a/src/Formats/TextFormatService.kt
+++ b/src/Formats/TextFormatService.kt
@@ -7,9 +7,9 @@ public class TextFormatService(val signatureGenerator: LanguageService) : Format
with (to) {
appendln(signatureGenerator.render(node))
appendln()
- appendln(node.doc.summary)
+ appendln(node.content.summary)
- for ((label, section) in node.doc.sections) {
+ for ((label, section) in node.content.sections) {
appendln(label)
}
}
diff --git a/src/Generation/ConsoleGenerator.kt b/src/Generation/ConsoleGenerator.kt
index 78164bb9..f52c6f4b 100644
--- a/src/Generation/ConsoleGenerator.kt
+++ b/src/Generation/ConsoleGenerator.kt
@@ -13,7 +13,7 @@ public class ConsoleGenerator(val signatureGenerator: LanguageService, val locat
public fun generateHeader(node: DocumentationNode, indent: String = "") {
println(indent + signatureGenerator.render(node))
- val docString = node.doc.toString()
+ val docString = node.content.toString()
if (!docString.isEmpty())
println("$indent\"${docString.replace("\n", "\n$indent")}\"")
println()
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index cee374d9..f91c922c 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -284,7 +284,7 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
}
}
- resolveContentLinks(node, node.doc)
+ resolveContentLinks(node, node.content)
for (child in node.members) {
resolveReferences(child)
diff --git a/src/Locations/LocationService.kt b/src/Locations/LocationService.kt
index f89fedd0..3c3ed3e1 100644
--- a/src/Locations/LocationService.kt
+++ b/src/Locations/LocationService.kt
@@ -12,7 +12,7 @@ public trait LocationService {
}
-public fun escapeUri(path: String): String = path.replace('<', '_').replace('>', '_')
+public fun escapeUri(path: String): String = path.replace('<', '-').replace('>', '-')
fun LocationService.relativeLocation(owner: DocumentationNode, node: DocumentationNode, extension: String): Location {
return relativeLocation(location(owner), node, extension)
diff --git a/src/Model/Content.kt b/src/Model/Content.kt
index 3ec3d341..794faf50 100644
--- a/src/Model/Content.kt
+++ b/src/Model/Content.kt
@@ -84,7 +84,9 @@ public class Content() : ContentNode() {
map
}
- public val summary: ContentNode get() = sections["\$summary"] ?: ContentNode.empty
+ public val summary: ContentNode get() {
+ return sections["\$summary"] ?: ContentNode.empty
+ }
public val description: ContentNode get() = sections["\$description"] ?: ContentNode.empty
override fun equals(other: Any?): Boolean {
diff --git a/src/Model/DocumentationModule.kt b/src/Model/DocumentationModule.kt
index 6084ea5e..e74c544b 100644
--- a/src/Model/DocumentationModule.kt
+++ b/src/Model/DocumentationModule.kt
@@ -1,6 +1,6 @@
package org.jetbrains.dokka
-public class DocumentationModule(name: String) : DocumentationNode(name, Content.Empty, DocumentationNode.Kind.Module) {
+public class DocumentationModule(name: String, content: Content = Content.Empty) : DocumentationNode(name, content, DocumentationNode.Kind.Module) {
fun merge(other: DocumentationModule): DocumentationModule {
val model = DocumentationModule(name)
model.addAllReferencesFrom(other)
diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt
index 18efaa9b..2be5bf15 100644
--- a/src/Model/DocumentationNode.kt
+++ b/src/Model/DocumentationNode.kt
@@ -3,11 +3,21 @@ package org.jetbrains.dokka
import java.util.LinkedHashSet
public open class DocumentationNode(val name: String,
- val doc: Content,
+ val content: Content,
val kind: DocumentationNode.Kind) {
private val references = LinkedHashSet<DocumentationReference>()
+ public val summary: ContentNode get() {
+ val contentSection = content.sections["\$summary"]
+ if (contentSection != null)
+ return contentSection
+ val ownerSection = owner?.content?.sections?.get(name)
+ if (ownerSection != null)
+ return ownerSection
+ return ContentNode.empty
+ }
+
public val owner: DocumentationNode?
get() = references(DocumentationReference.Kind.Owner).singleOrNull()?.to
public val details: List<DocumentationNode>
diff --git a/src/main.kt b/src/main.kt
index 287664a3..6f5cf796 100644
--- a/src/main.kt
+++ b/src/main.kt
@@ -7,12 +7,18 @@ import org.jetbrains.jet.cli.common.arguments.*
import org.jetbrains.jet.utils.PathUtil
import java.io.File
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor
+import org.jetbrains.jet.lang.resolve.name.FqName
+import java.lang.reflect.Constructor
class DokkaArguments {
Argument(value = "src", description = "Source file or directory (allows many paths separated by the system path separator)")
ValueDescription("<path>")
public var src: String = ""
+ Argument(value = "include", description = "Markdown files to load (allows many paths separated by the system path separator)")
+ ValueDescription("<path>")
+ public var include: String = ""
+
Argument(value = "samples", description = "Source root for samples")
ValueDescription("<path>")
public var samples: String = ""
@@ -32,11 +38,11 @@ class DokkaArguments {
}
public fun main(args: Array<String>) {
-
val arguments = DokkaArguments()
val freeArgs: List<String> = Args.parse(arguments, args) ?: listOf()
val sources = if (arguments.src.isNotEmpty()) arguments.src.split(File.pathSeparatorChar).toList() + freeArgs else freeArgs
val samples = if (arguments.samples.isNotEmpty()) arguments.samples.split(File.pathSeparatorChar).toList() else listOf()
+ val includes = if (arguments.include.isNotEmpty()) arguments.include.split(File.pathSeparatorChar).toList() else listOf()
val environment = AnalysisEnvironment(MessageCollectorPlainTextToStream.PLAIN_TEXT_TO_SYSTEM_ERR) {
addClasspath(PathUtil.getJdkClassesRoots())
@@ -59,6 +65,7 @@ public fun main(args: Array<String>) {
println("Analysing sources and libraries... ")
val startAnalyse = System.currentTimeMillis()
+
val documentation = environment.withContext { environment, session ->
val fragmentFiles = environment.getSourceFiles().filter {
val sourceFile = File(it.getVirtualFile()!!.getPath())
@@ -69,11 +76,21 @@ public fun main(args: Array<String>) {
}
}
val fragments = fragmentFiles.map { session.getPackageFragment(it.getPackageFqName()) }.filterNotNull().distinct()
- val documentationModule = DocumentationModule(arguments.moduleName)
val options = DocumentationOptions()
val documentationBuilder = DocumentationBuilder(session, options)
with(documentationBuilder) {
+
+ val moduleContent = Content()
+ for (include in includes) {
+ val text = File(include).readText()
+ val tree = MarkdownProcessor.parse(text)
+ val content = buildContent(tree, session.getPackageFragment(FqName.ROOT))
+ moduleContent.children.addAll(content.children)
+ }
+
+ val documentationModule = DocumentationModule(arguments.moduleName, moduleContent)
+
val descriptors = hashMapOf<String, List<DeclarationDescriptor>>()
for ((name, parts) in fragments.groupBy { it.fqName }) {
descriptors.put(name.asString(), parts.flatMap { it.getMemberScope().getAllDescriptors() })
@@ -84,10 +101,9 @@ public fun main(args: Array<String>) {
packageNode.appendChildren(declarations, DocumentationReference.Kind.Member)
documentationModule.append(packageNode, DocumentationReference.Kind.Member)
}
+ documentationBuilder.resolveReferences(documentationModule)
+ documentationModule
}
-
- documentationBuilder.resolveReferences(documentationModule)
- documentationModule
}
val timeAnalyse = System.currentTimeMillis() - startAnalyse
@@ -98,7 +114,7 @@ public fun main(args: Array<String>) {
val locationService = FoldersLocationService(arguments.outputDir)
val templateService = HtmlTemplateService.default("/dokka/styles/style.css")
- //val formatter = HtmlFormatService(locationService, signatureGenerator, templateService)
+// val formatter = HtmlFormatService(locationService, signatureGenerator, templateService)
val formatter = KotlinWebsiteFormatService(locationService, signatureGenerator)
val generator = FileGenerator(signatureGenerator, locationService, formatter)
print("Generating pages... ")
diff --git a/test/src/model/ClassTest.kt b/test/src/model/ClassTest.kt
index 7068038f..65363c92 100644
--- a/test/src/model/ClassTest.kt
+++ b/test/src/model/ClassTest.kt
@@ -10,7 +10,7 @@ public class ClassTest {
with(model.members.single().members.single()) {
assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals(2, details.count())
assertEquals("<init>", members.single().name)
assertTrue(links.none())
@@ -23,7 +23,7 @@ public class ClassTest {
with(model.members.single().members.single()) {
assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals(2, details.count())
assertEquals("<init>", members.single().name)
assertTrue(links.none())
@@ -36,7 +36,7 @@ public class ClassTest {
with(model.members.single().members.single()) {
assertEquals(DocumentationNode.Kind.Object, kind)
assertEquals("Obj", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals(2, details.count())
assertTrue(members.none())
assertTrue(links.none())
@@ -49,21 +49,21 @@ public class ClassTest {
with (model.members.single().members.single()) {
assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals(2, details.count())
assertTrue(links.none())
assertEquals(1, members.count())
with(members.elementAt(0)) {
assertEquals("<init>", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals(DocumentationNode.Kind.Constructor, kind)
assertEquals(2, details.count())
assertEquals("public", details.elementAt(0).name)
with(details.elementAt(1)) {
assertEquals("name", name)
assertEquals(DocumentationNode.Kind.Parameter, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals("String", details.single().name)
assertTrue(links.none())
assertTrue(members.none())
@@ -80,14 +80,14 @@ public class ClassTest {
with(model.members.single().members.single()) {
assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals(2, details.count())
assertTrue(links.none())
assertEquals(2, members.count())
with(members.elementAt(0)) {
assertEquals("<init>", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals(DocumentationNode.Kind.Constructor, kind)
assertEquals(1, details.count())
assertEquals("public", details.elementAt(0).name)
@@ -96,7 +96,7 @@ public class ClassTest {
}
with(members.elementAt(1)) {
assertEquals("fn", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals("Unit", detail(DocumentationNode.Kind.Type).name)
assertTrue(links.none())
@@ -111,14 +111,14 @@ public class ClassTest {
with(model.members.single().members.single()) {
assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals(2, details.count())
assertTrue(links.none())
assertEquals(2, members.count())
with(members.elementAt(0)) {
assertEquals("<init>", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals(DocumentationNode.Kind.Constructor, kind)
assertEquals(1, details.count())
assertEquals("public", details.elementAt(0).name)
@@ -127,7 +127,7 @@ public class ClassTest {
}
with(members.elementAt(1)) {
assertEquals("name", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals(DocumentationNode.Kind.Property, kind)
assertEquals("String", detail(DocumentationNode.Kind.Type).name)
assertTrue(members.none())
diff --git a/test/src/model/CommentTest.kt b/test/src/model/CommentTest.kt
index 9206e386..b2ad0ac0 100644
--- a/test/src/model/CommentTest.kt
+++ b/test/src/model/CommentTest.kt
@@ -8,7 +8,7 @@ public class CommentTest {
Test fun emptyDoc() {
verifyModel("test/data/comments/emptyDoc.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
}
}
}
@@ -16,7 +16,7 @@ public class CommentTest {
Test fun emptyDocButComment() {
verifyModel("test/data/comments/emptyDocButComment.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
}
}
}
@@ -24,8 +24,8 @@ public class CommentTest {
Test fun multilineDoc() {
verifyModel("test/data/comments/multilineDoc.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("doc1", doc.summary.toTestString())
- assertEquals("doc2\ndoc3\n", doc.description.toTestString())
+ assertEquals("doc1", content.summary.toTestString())
+ assertEquals("doc2\ndoc3\n", content.description.toTestString())
}
}
}
@@ -33,8 +33,8 @@ public class CommentTest {
Test fun multipleDocs() {
verifyModel("test/data/comments/multipleDocs.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("doc1", doc.summary.toTestString())
- assertEquals("doc2\ndoc3", doc.description.toTestString())
+ assertEquals("doc1", content.summary.toTestString())
+ assertEquals("doc2\ndoc3", content.description.toTestString())
}
}
}
@@ -42,8 +42,8 @@ public class CommentTest {
Test fun multilineDocWithComment() {
verifyModel("test/data/comments/multilineDocWithComment.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("doc1", doc.summary.toTestString())
- assertEquals("doc2\ndoc3", doc.description.toTestString())
+ assertEquals("doc1", content.summary.toTestString())
+ assertEquals("doc2\ndoc3", content.description.toTestString())
}
}
}
@@ -51,7 +51,7 @@ public class CommentTest {
Test fun oneLineDoc() {
verifyModel("test/data/comments/oneLineDoc.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("doc", doc.summary.toTestString())
+ assertEquals("doc", content.summary.toTestString())
}
}
}
@@ -59,7 +59,7 @@ public class CommentTest {
Test fun oneLineDocWithComment() {
verifyModel("test/data/comments/oneLineDocWithComment.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("doc", doc.summary.toTestString())
+ assertEquals("doc", content.summary.toTestString())
}
}
}
@@ -67,7 +67,7 @@ public class CommentTest {
Test fun oneLineDocWithEmptyLine() {
verifyModel("test/data/comments/oneLineDocWithEmptyLine.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("doc", doc.summary.toTestString())
+ assertEquals("doc", content.summary.toTestString())
}
}
}
@@ -75,9 +75,9 @@ public class CommentTest {
Test fun emptySection() {
verifyModel("test/data/comments/emptySection.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("Summary", doc.summary.toTestString())
- assertEquals(2, doc.sections.count())
- with (doc.sections["one"]!!) {
+ assertEquals("Summary", content.summary.toTestString())
+ assertEquals(2, content.sections.count())
+ with (content.sections["one"]!!) {
assertEquals("one", label)
assertEquals("", toTestString())
}
@@ -88,9 +88,9 @@ public class CommentTest {
Test fun explicitSummary() {
verifyModel("test/data/comments/explicitSummary.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("Summary", doc.summary.toTestString())
- assertEquals("Description", doc.description.toTestString())
- assertEquals(2, doc.sections.count())
+ assertEquals("Summary", content.summary.toTestString())
+ assertEquals("Description", content.description.toTestString())
+ assertEquals(2, content.sections.count())
}
}
}
@@ -98,9 +98,9 @@ public class CommentTest {
Test fun section1() {
verifyModel("test/data/comments/section1.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("Summary", doc.summary.toTestString())
- assertEquals(2, doc.sections.count())
- with (doc.sections["one"]!!) {
+ assertEquals("Summary", content.summary.toTestString())
+ assertEquals(2, content.sections.count())
+ with (content.sections["one"]!!) {
assertEquals("one", label)
assertEquals("section one", toTestString())
}
@@ -111,13 +111,13 @@ public class CommentTest {
Test fun section2() {
verifyModel("test/data/comments/section2.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("Summary", doc.summary.toTestString())
- assertEquals(3, doc.sections.count())
- with (doc.sections["one"]!!) {
+ assertEquals("Summary", content.summary.toTestString())
+ assertEquals(3, content.sections.count())
+ with (content.sections["one"]!!) {
assertEquals("one", label)
assertEquals("section one", toTestString())
}
- with (doc.sections["two"]!!) {
+ with (content.sections["two"]!!) {
assertEquals("two", label)
assertEquals("section two", toTestString())
}
@@ -128,9 +128,9 @@ public class CommentTest {
Test fun sectionOnOneLine() {
verifyModel("test/data/comments/sectionOnOneLine.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("Summary", doc.summary.toTestString())
- assertEquals(2, doc.sections.count())
- with (doc.sections["one"]!!) {
+ assertEquals("Summary", content.summary.toTestString())
+ assertEquals(2, content.sections.count())
+ with (content.sections["one"]!!) {
assertEquals("one", label)
assertEquals("same line", toTestString())
}
@@ -141,9 +141,9 @@ public class CommentTest {
Test fun emptySectionOnOneLine() {
verifyModel("test/data/comments/emptySectionOnOneLine.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("Summary", doc.summary.toTestString())
- assertEquals(2, doc.sections.count())
- with (doc.sections["one"]!!) {
+ assertEquals("Summary", content.summary.toTestString())
+ assertEquals(2, content.sections.count())
+ with (content.sections["one"]!!) {
assertEquals("one", label)
assertEquals("", toTestString())
}
@@ -154,9 +154,9 @@ public class CommentTest {
Test fun multilineSection() {
verifyModel("test/data/comments/multilineSection.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("Summary", doc.summary.toTestString())
- assertEquals(2, doc.sections.count())
- with (doc.sections["one"]!!) {
+ assertEquals("Summary", content.summary.toTestString())
+ assertEquals(2, content.sections.count())
+ with (content.sections["one"]!!) {
assertEquals("one", label)
assertEquals("""line one
line two""", toTestString())
@@ -168,9 +168,9 @@ line two""", toTestString())
Test fun sectionWithBracedLabel() {
verifyModel("test/data/comments/sectionWithBracedLabel.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("Summary", doc.summary.toTestString())
- assertEquals(2, doc.sections.count())
- with (doc.sections["this.label.is.really.long"]!!) {
+ assertEquals("Summary", content.summary.toTestString())
+ assertEquals(2, content.sections.count())
+ with (content.sections["this.label.is.really.long"]!!) {
assertEquals("this.label.is.really.long", label)
assertEquals("section one", toTestString())
}
diff --git a/test/src/model/FunctionTest.kt b/test/src/model/FunctionTest.kt
index fe8b6397..c6ad93cc 100644
--- a/test/src/model/FunctionTest.kt
+++ b/test/src/model/FunctionTest.kt
@@ -10,7 +10,7 @@ public class FunctionTest {
with(model.members.single().members.single()) {
assertEquals("fn", name)
assertEquals(DocumentationNode.Kind.Function, kind)
- assertEquals("Function fn", doc.summary.toTestString())
+ assertEquals("Function fn", content.summary.toTestString())
assertEquals("Unit", detail(DocumentationNode.Kind.Type).name)
assertTrue(members.none())
assertTrue(links.none())
@@ -23,7 +23,7 @@ public class FunctionTest {
with(model.members.single().members.single()) {
assertEquals("fn", name)
assertEquals(DocumentationNode.Kind.Function, kind)
- assertEquals("Function with receiver", doc.summary.toTestString())
+ assertEquals("Function with receiver", content.summary.toTestString())
assertEquals("Unit", details.elementAt(0).name)
assertEquals(4, details.count())
@@ -32,7 +32,7 @@ public class FunctionTest {
with(details.elementAt(3)) {
assertEquals("<this>", name)
assertEquals(DocumentationNode.Kind.Receiver, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals("String", details.single().name)
assertTrue(members.none())
assertTrue(links.none())
@@ -48,7 +48,7 @@ public class FunctionTest {
with(model.members.single().members.single()) {
assertEquals("generic", name)
assertEquals(DocumentationNode.Kind.Function, kind)
- assertEquals("generic function", doc.summary.toTestString())
+ assertEquals("generic function", content.summary.toTestString())
assertEquals(4, details.count())
assertEquals("Unit", details.elementAt(0).name)
@@ -57,7 +57,7 @@ public class FunctionTest {
with(details.elementAt(3)) {
assertEquals("T", name)
assertEquals(DocumentationNode.Kind.TypeParameter, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertTrue(details.none())
assertTrue(members.none())
assertTrue(links.none())
@@ -73,7 +73,7 @@ public class FunctionTest {
with(model.members.single().members.single()) {
assertEquals("generic", name)
assertEquals(DocumentationNode.Kind.Function, kind)
- assertEquals("generic function", doc.summary.toTestString())
+ assertEquals("generic function", content.summary.toTestString())
assertEquals(5, details.count())
assertEquals("Unit", details.elementAt(0).name)
@@ -82,11 +82,11 @@ public class FunctionTest {
with(details.elementAt(3)) {
assertEquals("T", name)
assertEquals(DocumentationNode.Kind.TypeParameter, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
with(details.single()) {
assertEquals("R", name)
assertEquals(DocumentationNode.Kind.UpperBound, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertTrue(details.none())
assertTrue(members.none())
assertTrue(links.none())
@@ -97,7 +97,7 @@ public class FunctionTest {
with(details.elementAt(4)) {
assertEquals("R", name)
assertEquals(DocumentationNode.Kind.TypeParameter, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertTrue(members.none())
assertTrue(links.none())
}
@@ -113,9 +113,9 @@ public class FunctionTest {
with(model.members.single().members.single()) {
assertEquals("function", name)
assertEquals(DocumentationNode.Kind.Function, kind)
- assertEquals("Multiline", doc.summary.toTestString())
+ assertEquals("Multiline", content.summary.toTestString())
assertEquals("""Function
-Documentation""", doc.description.toTestString())
+Documentation""", content.description.toTestString())
assertEquals(4, details.count())
assertEquals("Unit", details.elementAt(0).name)
@@ -124,7 +124,7 @@ Documentation""", doc.description.toTestString())
with(details.elementAt(3)) {
assertEquals("x", name)
assertEquals(DocumentationNode.Kind.Parameter, kind)
- assertEquals("parameter", doc.summary.toTestString())
+ assertEquals("parameter", content.summary.toTestString())
assertEquals("Int", details.single().name)
assertTrue(members.none())
assertTrue(links.none())
diff --git a/test/src/model/JavaTest.kt b/test/src/model/JavaTest.kt
index 2fd197d5..e57be4a9 100644
--- a/test/src/model/JavaTest.kt
+++ b/test/src/model/JavaTest.kt
@@ -11,7 +11,7 @@ public class JavaTest {
with(pkg.members.single()) {
assertEquals("fn", name)
assertEquals(DocumentationNode.Kind.Function, kind)
- assertEquals("Function fn", doc.summary)
+ assertEquals("Function fn", content.summary)
assertEquals("Unit", detail(DocumentationNode.Kind.Type).name)
assertTrue(members.none())
assertTrue(links.none())
diff --git a/test/src/model/PackageTest.kt b/test/src/model/PackageTest.kt
index 848fff3e..1f1a6ebf 100644
--- a/test/src/model/PackageTest.kt
+++ b/test/src/model/PackageTest.kt
@@ -10,7 +10,7 @@ public class PackageTest {
with(model.members.single()) {
assertEquals(DocumentationNode.Kind.Package, kind)
assertEquals("", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertTrue(details.none())
assertTrue(members.none())
assertTrue(links.none())
@@ -23,7 +23,7 @@ public class PackageTest {
with(model.members.single()) {
assertEquals(DocumentationNode.Kind.Package, kind)
assertEquals("simple", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertTrue(details.none())
assertTrue(members.none())
assertTrue(links.none())
@@ -36,7 +36,7 @@ public class PackageTest {
with(model.members.single()) {
assertEquals(DocumentationNode.Kind.Package, kind)
assertEquals("dot.name", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertTrue(details.none())
assertTrue(members.none())
assertTrue(links.none())
@@ -50,14 +50,14 @@ public class PackageTest {
with(model.members.single { it.name == "simple" }) {
assertEquals(DocumentationNode.Kind.Package, kind)
assertEquals("simple", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertTrue(details.none())
assertTrue(members.none())
assertTrue(links.none())
}
with(model.members.single { it.name == "dot.name" }) {
assertEquals(DocumentationNode.Kind.Package, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertTrue(details.none())
assertTrue(members.none())
assertTrue(links.none())
@@ -71,7 +71,7 @@ public class PackageTest {
with(model.members.elementAt(0)) {
assertEquals(DocumentationNode.Kind.Package, kind)
assertEquals("simple", name)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertTrue(details.none())
assertTrue(members.none())
assertTrue(links.none())
diff --git a/test/src/model/PropertyTest.kt b/test/src/model/PropertyTest.kt
index cac62194..93d81769 100644
--- a/test/src/model/PropertyTest.kt
+++ b/test/src/model/PropertyTest.kt
@@ -10,7 +10,7 @@ public class PropertyTest {
with(model.members.single().members.single()) {
assertEquals("property", name)
assertEquals(DocumentationNode.Kind.Property, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals("String", detail(DocumentationNode.Kind.Type).name)
assertTrue(members.none())
assertTrue(links.none())
@@ -23,7 +23,7 @@ public class PropertyTest {
with(model.members.single().members.single()) {
assertEquals("property", name)
assertEquals(DocumentationNode.Kind.Property, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals("String", detail(DocumentationNode.Kind.Type).name)
assertTrue(members.none())
assertTrue(links.none())
@@ -36,13 +36,13 @@ public class PropertyTest {
with(model.members.single().members.single()) {
assertEquals("property", name)
assertEquals(DocumentationNode.Kind.Property, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals("String", detail(DocumentationNode.Kind.Type).name)
assertTrue(links.none())
with(members.single()) {
assertEquals("<get-property>", name)
assertEquals(DocumentationNode.Kind.Function, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals("String", detail(DocumentationNode.Kind.Type).name)
assertTrue(links.none())
assertTrue(members.none())
@@ -56,7 +56,7 @@ public class PropertyTest {
with(model.members.single().members.single()) {
assertEquals("property", name)
assertEquals(DocumentationNode.Kind.Property, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals(3, details.count())
assertEquals("String", detail(DocumentationNode.Kind.Type).name)
val modifiers = details(DocumentationNode.Kind.Modifier).map { it.name }
@@ -68,7 +68,7 @@ public class PropertyTest {
with(members.elementAt(0)) {
assertEquals("<get-property>", name)
assertEquals(DocumentationNode.Kind.Function, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
val get_modifiers = details(DocumentationNode.Kind.Modifier).map { it.name }
assertTrue("final" in get_modifiers)
assertTrue("internal" in get_modifiers)
@@ -79,7 +79,7 @@ public class PropertyTest {
with(members.elementAt(1)) {
assertEquals("<set-property>", name)
assertEquals(DocumentationNode.Kind.Function, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals(4, details.count())
assertEquals("Unit", detail(DocumentationNode.Kind.Type).name)
val set_modifiers = details(DocumentationNode.Kind.Modifier).map { it.name }
@@ -88,7 +88,7 @@ public class PropertyTest {
with(detail(DocumentationNode.Kind.Parameter)) {
assertEquals("value", name)
assertEquals(DocumentationNode.Kind.Parameter, kind)
- assertEquals(Content.Empty, doc)
+ assertEquals(Content.Empty, content)
assertEquals("String", detail(DocumentationNode.Kind.Type).name)
assertTrue(links.none())
assertTrue(members.none())