aboutsummaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/kotlin/DokkaGenerator.kt2
-rw-r--r--core/src/main/kotlin/pages/PageContentBuilder.kt5
-rw-r--r--core/src/main/kotlin/renderers/HtmlRenderer.kt12
-rw-r--r--core/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt13
-rw-r--r--core/src/main/kotlin/transformers/psi/PsiToDocumentationTranslator.kt1
5 files changed, 25 insertions, 8 deletions
diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt
index 350ee5df..95f9e647 100644
--- a/core/src/main/kotlin/DokkaGenerator.kt
+++ b/core/src/main/kotlin/DokkaGenerator.kt
@@ -147,7 +147,7 @@ class DokkaGenerator(
}.flatten()
return context.single(CoreExtensions.psiToDocumentationTranslator)
- .invoke(psiFiles, platformData, context)
+ .invoke(platformData.name, psiFiles, platformData, context)
}
diff --git a/core/src/main/kotlin/pages/PageContentBuilder.kt b/core/src/main/kotlin/pages/PageContentBuilder.kt
index 25ddc2f1..d56a6d70 100644
--- a/core/src/main/kotlin/pages/PageContentBuilder.kt
+++ b/core/src/main/kotlin/pages/PageContentBuilder.kt
@@ -166,10 +166,13 @@ class DefaultPageContentBuilder(
private fun PageContentBuilder.type(t: TypeWrapper) {
if (t.constructorNamePathSegments.isNotEmpty() && t.dri != null)
link(t.constructorNamePathSegments.last(), t.dri!!)
+ else if (t.constructorNamePathSegments.isNotEmpty() && t.dri == null)
+ text(t.toString())
else (this as? DefaultPageContentBuilder)?.let {
logger.error("type $t cannot be resolved")
- text(t.toString())
+ text("???")
}
+
list(t.arguments, prefix = "<", suffix = ">") {
type(it)
}
diff --git a/core/src/main/kotlin/renderers/HtmlRenderer.kt b/core/src/main/kotlin/renderers/HtmlRenderer.kt
index 68d6d276..8742f202 100644
--- a/core/src/main/kotlin/renderers/HtmlRenderer.kt
+++ b/core/src/main/kotlin/renderers/HtmlRenderer.kt
@@ -22,17 +22,19 @@ open class HtmlRenderer(
protected open fun OL.buildListItems(items: List<ContentNode>, pageContext: PageNode) {
items.forEach {
- if (it is ContentText)
+ if (it is ContentList)
+ buildList(it, pageContext)
+ else
li { it.build(this, pageContext) }
- else buildList(it as ContentList, pageContext)
}
}
protected open fun UL.buildListItems(items: List<ContentNode>, pageContext: PageNode) {
items.forEach {
- if (it is ContentText)
+ if (it is ContentList)
+ buildList(it, pageContext)
+ else
li { it.build(this, pageContext) }
- else buildList(it as ContentList, pageContext)
}
}
@@ -109,7 +111,7 @@ open class HtmlRenderer(
override fun FlowContent.buildCode(code: List<ContentNode>, language: String, pageContext: PageNode) {
buildNewLine()
code.forEach {
- + (it as ContentText).text
+ + ((it as? ContentText)?.text ?: run { context.logger.error("Cannot cast $it as ContentText!"); ""} )
buildNewLine()
}
}
diff --git a/core/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt b/core/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt
index d3ad4526..d8595ad3 100644
--- a/core/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt
+++ b/core/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt
@@ -13,12 +13,13 @@ import org.jetbrains.dokka.utilities.DokkaLogger
object DefaultPsiToDocumentationTranslator : PsiToDocumentationTranslator {
override fun invoke(
+ moduleName: String,
psiFiles: List<PsiJavaFile>,
platformData: PlatformData,
context: DokkaContext
): Module {
val docParser = DokkaPsiParser(platformData, context.logger)
- return Module( "JavaModule",
+ return Module(moduleName,
psiFiles.map { psiFile ->
val dri = DRI(packageName = psiFile.packageName)
Package(
@@ -145,6 +146,16 @@ class JavaTypeWrapper(
if (it is PsiClassReferenceType) JavaTypeWrapper(it) else null
}
dri = fromPsi(type)
+ } else if (type is PsiEllipsisType) {
+ constructorFqName = type.canonicalText
+ constructorNamePathSegments = listOf(type.canonicalText) // TODO
+ arguments = emptyList()
+ dri = DRI("java.lang", "Object") // TODO
+ } else if (type is PsiArrayType) {
+ constructorFqName = type.canonicalText
+ constructorNamePathSegments = listOf(type.canonicalText)
+ arguments = emptyList()
+ dri = (type as? PsiClassReferenceType)?.let { fromPsi(it) } // TODO
} else {
type as PsiPrimitiveType
constructorFqName = type.name
diff --git a/core/src/main/kotlin/transformers/psi/PsiToDocumentationTranslator.kt b/core/src/main/kotlin/transformers/psi/PsiToDocumentationTranslator.kt
index 5a1209b1..41290ef8 100644
--- a/core/src/main/kotlin/transformers/psi/PsiToDocumentationTranslator.kt
+++ b/core/src/main/kotlin/transformers/psi/PsiToDocumentationTranslator.kt
@@ -7,6 +7,7 @@ import org.jetbrains.dokka.plugability.DokkaContext
interface PsiToDocumentationTranslator {
fun invoke(
+ moduleName: String,
psiFiles: List<PsiJavaFile>,
platformData: PlatformData,
context: DokkaContext