aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/model
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-08-26 16:56:39 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-31 15:10:04 +0200
commit732d181e4908ed0ddc513e305addc71560c0e109 (patch)
tree740c3ebe3fa05c3702b30faf07c4f6f87c97e432 /core/src/main/kotlin/model
parentf0524ce475695be163683cd1fdda2fab58ac0161 (diff)
downloaddokka-732d181e4908ed0ddc513e305addc71560c0e109.tar.gz
dokka-732d181e4908ed0ddc513e305addc71560c0e109.tar.bz2
dokka-732d181e4908ed0ddc513e305addc71560c0e109.zip
Let root package be represented as [root] to the user
Diffstat (limited to 'core/src/main/kotlin/model')
-rw-r--r--core/src/main/kotlin/model/Documentable.kt15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt
index 293b8a30..34ad6c2b 100644
--- a/core/src/main/kotlin/model/Documentable.kt
+++ b/core/src/main/kotlin/model/Documentable.kt
@@ -111,9 +111,18 @@ data class DPackage(
override val sourceSets: Set<DokkaSourceSet> = emptySet(),
override val extra: PropertyContainer<DPackage> = PropertyContainer.empty()
) : Documentable(), WithScope, WithExtraProperties<DPackage> {
- override val name = dri.packageName.orEmpty()
- override val children: List<Documentable>
- get() = (properties + functions + classlikes + typealiases)
+
+ val packageName: String = dri.packageName.orEmpty()
+
+ /**
+ * !!! WARNING !!!
+ * This name is not guaranteed to be a be a canonical/real package name.
+ * e.g. this will return a human readable version for root packages.
+ * Use [packageName] or `dri.packageName` instead to obtain the real packageName
+ */
+ override val name: String = if (packageName.isBlank()) "[root]" else packageName
+
+ override val children: List<Documentable> = properties + functions + classlikes + typealiases
override fun withNewExtras(newExtras: PropertyContainer<DPackage>) = copy(extra = newExtras)
}