aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/DokkaDescriptorVisitor.kt9
-rw-r--r--core/src/main/kotlin/DokkaGenerator.kt11
-rw-r--r--core/src/main/kotlin/pages/transformers/XmlAttributesTransformer.kt80
3 files changed, 7 insertions, 93 deletions
diff --git a/core/src/main/kotlin/DokkaDescriptorVisitor.kt b/core/src/main/kotlin/DokkaDescriptorVisitor.kt
index 0265eacb..c24c43aa 100644
--- a/core/src/main/kotlin/DokkaDescriptorVisitor.kt
+++ b/core/src/main/kotlin/DokkaDescriptorVisitor.kt
@@ -142,8 +142,13 @@ class DokkaDescriptorVisitor(
}
private fun getXMLDRIs(descriptors: List<Descriptor<*>>) =
- descriptors.mapNotNull { it.docTag?.children?.findLast { it.text.contains("@attr") }?.text }.flatMap { ref ->
- val matchResult = "@attr\\s+ref\\s+(.+)".toRegex().matchEntire(ref)
+ descriptors.flatMap {
+ it.docTag?.children
+ ?.filter {
+ it.text.contains("@attr")
+ }.orEmpty()
+ }.flatMap { ref ->
+ val matchResult = "@attr\\s+ref\\s+(.+)".toRegex().matchEntire(ref.text)
val toFind = matchResult?.groups?.last()?.value.orEmpty()
resolveKDocLink(
resolutionFacade.resolveSession.bindingContext,
diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt
index 7529c53a..b29a0da2 100644
--- a/core/src/main/kotlin/DokkaGenerator.kt
+++ b/core/src/main/kotlin/DokkaGenerator.kt
@@ -7,7 +7,6 @@ import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.pages.MarkdownToContentConverter
import org.jetbrains.dokka.pages.PlatformData
import org.jetbrains.dokka.plugability.DokkaContext
-import org.jetbrains.dokka.pages.transformers.XmlAttributesTransformer
import org.jetbrains.dokka.renderers.FileWriter
import org.jetbrains.dokka.renderers.HtmlRenderer
import org.jetbrains.dokka.resolvers.DefaultLocationProvider
@@ -70,16 +69,6 @@ class DokkaGenerator(
}.let {
context[CoreExtensions.pageTransformer].fold(it) { pn, t -> t.action.invoke(pn, context) }
}.also {
- HtmlRenderer(
- FileWriter(configuration.outputDir, ""),
- DefaultLocationProvider(it, configuration, ".${configuration.format}")
- ).render(it)
- }
- .let {
- XmlAttributesTransformer(it)
- }
- }.also {
- // it.genericPretty().also(::nierzigoj)
HtmlRenderer(
FileWriter(configuration.outputDir, ""),
DefaultLocationProvider(it, configuration, ".${configuration.format}")
diff --git a/core/src/main/kotlin/pages/transformers/XmlAttributesTransformer.kt b/core/src/main/kotlin/pages/transformers/XmlAttributesTransformer.kt
deleted file mode 100644
index 7a74cb65..00000000
--- a/core/src/main/kotlin/pages/transformers/XmlAttributesTransformer.kt
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.jetbrains.dokka.pages.transformers
-
-import org.jetbrains.dokka.DefaultExtra
-import org.jetbrains.dokka.Model.DocumentationNode
-import org.jetbrains.dokka.Model.dfs
-import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.pages.*
-import org.jetbrains.dokka.renderers.platforms
-
-object XmlAttributesTransformer : PageNodeTransformer {
- enum class XMLKind : Kind {
- Main, XmlList
- }
-
- override fun invoke(original: ModulePageNode): ModulePageNode {
- original.findAll { it is ClassPageNode }.forEach { node ->
- val refs = node.documentationNode?.extra?.filterIsInstance<DefaultExtra>()?.filter { it.key == "@attr ref"}.orEmpty()
- val elementsToAdd = mutableListOf<DocumentationNode<*>>()
-
- refs.forEach { ref ->
- val toFind = DRI.from(ref.value)
- original.documentationNode?.dfs { it.dri == toFind }?.let { elementsToAdd.add(it) }
- }
-
- val refTable = ContentGroup(
- listOf(
- ContentHeader(
- listOf(
- ContentText(
- "XML Attributes",
- DCI(node.dri, XMLKind.XmlList),
- node.platforms().toSet(), emptySet(), emptySet()
- )
- ),
- 2,
- DCI(node.dri, XMLKind.Main),
- node.platforms().toSet(), emptySet(), emptySet()
- ),
- ContentTable(
- emptyList(),
- elementsToAdd.map {
- ContentGroup(
- listOf(
- ContentDRILink(
- listOf(
- ContentText(
- it.descriptors.first().name.toString(),
- DCI(node.dri, XMLKind.Main),
- node.platforms().toSet(), emptySet(), emptySet()
- )
- ),
- it.dri,
- DCI(it.dri, XMLKind.XmlList),
- it.platformData.toSet(), emptySet(), emptySet()
- ),
- ContentText(
- it.briefDocstring,
- DCI(it.dri, XMLKind.XmlList),
- it.platformData.toSet(), emptySet(), emptySet()
- )
- ),
- DCI(node.dri, XMLKind.XmlList),
- node.platforms().toSet(), emptySet(), emptySet()
- )
- },
- DCI(node.dri, XMLKind.XmlList),
- node.platforms().toSet(), emptySet(), emptySet()
- )
- ),
- DCI(node.dri, XMLKind.XmlList),
- node.platforms().toSet(), emptySet(), emptySet()
- )
-
- val content = node.content as ContentGroup
- val children = (node.content as ContentGroup).children
- node.content = content.copy(children = children + refTable)
- }
- return original
- }
-}