diff options
author | Błażej Kardyś <bkardys@virtuslab.com> | 2020-09-23 11:47:52 +0200 |
---|---|---|
committer | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2020-10-06 15:41:04 +0200 |
commit | be932e200951e5b043f2e04e18b60176ac876156 (patch) | |
tree | a3d78c8ccf719121e062809422e0b6e936f06bcf /plugins/base/src/main/kotlin | |
parent | 94be25b8854fd6a02adcb1c8798c9afe633b5a20 (diff) | |
download | dokka-be932e200951e5b043f2e04e18b60176ac876156.tar.gz dokka-be932e200951e5b043f2e04e18b60176ac876156.tar.bz2 dokka-be932e200951e5b043f2e04e18b60176ac876156.zip |
Addding separate pages for properties
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r-- | plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt | 4 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt index 2600884d..09eb7cc4 100644 --- a/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt @@ -26,7 +26,7 @@ open class DefaultExternalLocationProvider( val classLink = (listOfNotNull(packageName) + classNamesChecked.split('.')) .joinToString("/", transform = ::identifierToFilename) - val callableChecked = callable ?: return "$docURL$classLink/index$extension" - return "$docURL$classLink/" + identifierToFilename(callableChecked.name) + extension + val fileName = callable?.let { identifierToFilename(it.name) } ?: "index" + return "$docURL$classLink/$fileName$extension" } } diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index a702766e..e6f92d6b 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -37,7 +37,7 @@ open class DefaultPageCreator( open fun pageForPackage(p: DPackage): PackagePageNode = PackagePageNode( p.name, contentForPackage(p), setOf(p.dri), p, p.classlikes.renameClashingClasslikes().map(::pageForClasslike) + - p.functions.map(::pageForFunction) + p.functions.map(::pageForFunction) + p.properties.mapNotNull(::pageForProperty) ) open fun pageForEnumEntry(e: DEnumEntry): ClasslikePageNode = @@ -55,7 +55,9 @@ open class DefaultPageCreator( constructors.map(::pageForFunction) + c.classlikes.renameClashingClasslikes().map(::pageForClasslike) + c.filteredFunctions.map(::pageForFunction) + + c.properties.mapNotNull(::pageForProperty) + if (c is DEnum) c.entries.map(::pageForEnumEntry) else emptyList() + ) } @@ -74,6 +76,8 @@ open class DefaultPageCreator( open fun pageForFunction(f: DFunction) = MemberPageNode(f.name, contentForFunction(f), setOf(f.dri), f) + open fun pageForProperty(p: DProperty): MemberPageNode? = MemberPageNode(p.name, contentForProperty(p), setOf(p.dri), p) + private val WithScope.filteredFunctions: List<DFunction> get() = functions.mapNotNull { function -> function.takeIf { @@ -476,6 +480,8 @@ open class DefaultPageCreator( protected open fun contentForFunction(f: DFunction) = contentForMember(f) + protected open fun contentForProperty(p: DProperty) = contentForMember(p) + protected open fun contentForMember(d: Documentable) = contentBuilder.contentFor(d) { group(kind = ContentKind.Cover) { cover(d.name.orEmpty()) |