diff options
author | Filip Zybała <fzybala@virtuslab.com> | 2020-03-12 14:29:42 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-03-26 12:36:03 +0100 |
commit | 91857c9ee37ff3227821feb952124e74bc415dfd (patch) | |
tree | 3643b805ca0a214854625652e3b36d99bd1a07be /plugins | |
parent | 7a1956409bc68e8b0ddf47dc9983d2d74728fe7d (diff) | |
download | dokka-91857c9ee37ff3227821feb952124e74bc415dfd.tar.gz dokka-91857c9ee37ff3227821feb952124e74bc415dfd.tar.bz2 dokka-91857c9ee37ff3227821feb952124e74bc415dfd.zip |
Added platformDepndentHints for platform-dependent contents
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt | 72 |
1 files changed, 46 insertions, 26 deletions
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index 6988afee..f29b05fb 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -42,17 +42,21 @@ open class DefaultPageCreator( open fun pageForFunction(f: DFunction) = MemberPageNode(f.name, contentForFunction(f), setOf(f.dri), f) protected open fun contentForModule(m: DModule) = contentBuilder.contentFor(m) { - header(1) { text(m.name) } - block("Packages", 2, ContentKind.Packages, m.packages, m.platformData.toSet()) { - link(it.name, it.dri) + platformDependentHint(m.dri,m.platformData.toSet()){ + header(1) { text(m.name) } + block("Packages", 2, ContentKind.Packages, m.packages, m.platformData.toSet()) { + link(it.name, it.dri) + } } // text("Index\n") TODO // text("Link to allpage here") } protected open fun contentForPackage(p: DPackage) = contentBuilder.contentFor(p) { - header(1) { text("Package ${p.name}") } - +contentForScope(p, p.dri, p.platformData) + platformDependentHint(p.dri,p.platformData.toSet()){ + header(1) { text("Package ${p.name}") } + +contentForScope(p, p.dri, p.platformData) + } } protected open fun contentForScope( @@ -61,30 +65,35 @@ open class DefaultPageCreator( platformData: List<PlatformData> ) = contentBuilder.contentFor(s as Documentable) { block("Types", 2, ContentKind.Classlikes, s.classlikes, platformData.toSet()) { - link(it.name.orEmpty(), it.dri) - group { - +buildSignature(it) - group(kind = ContentKind.BriefComment) { - text(it.briefDocumentation()) + platformDependentHint(it.dri,it.platformData.toSet()){ + link(it.name.orEmpty(), it.dri) + group { + +buildSignature(it) + group(kind = ContentKind.BriefComment) { + text(it.briefDocumentation()) + } } } } block("Functions", 2, ContentKind.Functions, s.functions, platformData.toSet()) { - link(it.name, it.dri) - group { - +buildSignature(it) - - group(kind = ContentKind.BriefComment) { - text(it.briefDocumentation()) + platformDependentHint(it.dri,it.platformData.toSet()){ + link(it.name, it.dri) + group { + +buildSignature(it) + group(kind = ContentKind.BriefComment) { + text(it.briefDocumentation()) + } } } } block("Properties", 2, ContentKind.Properties, s.properties, platformData.toSet()) { - link(it.name, it.dri) - +buildSignature(it) - breakLine() - group(kind = ContentKind.BriefComment) { - text(it.briefDocumentation()) + platformDependentHint(it.dri,it.platformData.toSet()){ + link(it.name, it.dri) + +buildSignature(it) + breakLine() + group(kind = ContentKind.BriefComment) { + text(it.briefDocumentation()) + } } } (s as? WithExtraProperties<Documentable>)?.let { it.extra[InheritorsInfo] }?.let { inheritors -> @@ -133,20 +142,31 @@ open class DefaultPageCreator( // TODO: this probably needs fixing d.documentation.forEach { _, documentationNode -> documentationNode.children.filter(filtering).forEach { - header(3) { - text(it.toHeaderString()) - d.documentation.keys.joinToString(prefix = "[", postfix = "]", separator = ", ") + platformDependentHint(d.dri,d.platformData.toSet()){ + header(3) { + text(it.toHeaderString()) + d.documentation.keys.joinToString(prefix = "[", postfix = "]", separator = ", ") + } + comment(it.root) + text("\n") } - comment(it.root) - text("\n") } } }.children +<<<<<<< HEAD protected open fun contentForFunction(f: DFunction) = contentBuilder.contentFor(f) { header(1) { text(f.name) } +buildSignature(f) +contentForComments(f) +======= + protected open fun contentForFunction(f: Function) = contentBuilder.contentFor(f) { + platformDependentHint(f.dri,f.platformData.toSet()){ + header(1) { text(f.name) } + +buildSignature(f) + +contentForComments(f) + } +>>>>>>> Added platformDepndentHints for platform-dependent contents } protected open fun TagWrapper.toHeaderString() = this.javaClass.toGenericString().split('.').last() |