diff options
| author | Szymon Świstun <sswistun@virtuslab.com> | 2020-01-20 14:55:42 +0100 |
|---|---|---|
| committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-02-12 13:13:18 +0100 |
| commit | 50e711d24b517bc93c37d89f258c9dafaa038ad1 (patch) | |
| tree | 201c27b6860ac14b6ddc673ff099d74f53b4e15c /core/src/main/kotlin/pages | |
| parent | 5a432c9c62ff95779a495fb354c83f5f7c481a1d (diff) | |
| download | dokka-50e711d24b517bc93c37d89f258c9dafaa038ad1.tar.gz dokka-50e711d24b517bc93c37d89f258c9dafaa038ad1.tar.bz2 dokka-50e711d24b517bc93c37d89f258c9dafaa038ad1.zip | |
kotlin-as-java plugin
Diffstat (limited to 'core/src/main/kotlin/pages')
| -rw-r--r-- | core/src/main/kotlin/pages/PageBuilder.kt | 12 | ||||
| -rw-r--r-- | core/src/main/kotlin/pages/PageContentBuilder.kt | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/core/src/main/kotlin/pages/PageBuilder.kt b/core/src/main/kotlin/pages/PageBuilder.kt index 7fe07ae4..df0c12c2 100644 --- a/core/src/main/kotlin/pages/PageBuilder.kt +++ b/core/src/main/kotlin/pages/PageBuilder.kt @@ -5,7 +5,7 @@ import org.jetbrains.dokka.model.Enum import org.jetbrains.dokka.model.Function import org.jetbrains.dokka.model.doc.TagWrapper -class DefaultPageBuilder( +open class DefaultPageBuilder( override val rootContentGroup: RootContentBuilder ) : PageBuilder { @@ -37,10 +37,10 @@ class DefaultPageBuilder( else -> throw IllegalStateException("$m should not be present here") } - private fun group(node: Documentable, content: PageContentBuilderFunction) = + protected open fun group(node: Documentable, content: PageContentBuilderFunction) = rootContentGroup(node, ContentKind.Main, content) - private fun contentForModule(m: Module) = group(m) { + protected open fun contentForModule(m: Module) = group(m) { header(1) { text("root") } block("Packages", 2, ContentKind.Packages, m.packages, m.platformData) { link(it.name, it.dri) @@ -49,7 +49,7 @@ class DefaultPageBuilder( text("Link to allpage here") } - private fun contentForPackage(p: Package) = group(p) { + protected open fun contentForPackage(p: Package) = group(p) { header(1) { text("Package ${p.name}") } block("Types", 2, ContentKind.Properties, p.classlikes, p.platformData) { link(it.name, it.dri) @@ -62,13 +62,13 @@ class DefaultPageBuilder( } } - private fun contentForClasslike(c: Classlike): ContentGroup = when (c) { + fun contentForClasslike(c: Classlike): ContentGroup = when (c) { is Class -> contentForClass(c) is Enum -> contentForEnum(c) else -> throw IllegalStateException("$c should not be present here") } - private fun contentForClass(c: Class) = group(c) { + protected fun contentForClass(c: Class) = group(c) { header(1) { text(c.name) } c.inherited.takeIf { it.isNotEmpty() }?.let { diff --git a/core/src/main/kotlin/pages/PageContentBuilder.kt b/core/src/main/kotlin/pages/PageContentBuilder.kt index d5ffe27a..bc01b03e 100644 --- a/core/src/main/kotlin/pages/PageContentBuilder.kt +++ b/core/src/main/kotlin/pages/PageContentBuilder.kt @@ -8,21 +8,21 @@ import org.jetbrains.dokka.model.TypeWrapper import org.jetbrains.dokka.model.doc.DocTag import org.jetbrains.dokka.utilities.DokkaLogger -class DefaultPageContentBuilder( +open class DefaultPageContentBuilder( private val dri: Set<DRI>, private val platformData: Set<PlatformData>, private val kind: Kind, private val commentsConverter: CommentsToContentConverter, - val logger: DokkaLogger, + open val logger: DokkaLogger, private val styles: Set<Style> = emptySet(), private val extras: Set<Extra> = emptySet() ) : PageContentBuilder { private val contents = mutableListOf<ContentNode>() - private fun createText(text: String, kind: Kind = ContentKind.Symbol) = + protected fun createText(text: String, kind: Kind = ContentKind.Symbol) = ContentText(text, DCI(dri, kind), platformData, styles, extras) - private fun build() = ContentGroup( + protected fun build() = ContentGroup( contents.toList(), DCI(dri, kind), platformData, @@ -38,7 +38,7 @@ class DefaultPageContentBuilder( contents += createText(text, kind) } - private fun signature(f: Function, block: PageContentBuilderFunction) { + protected fun signature(f: Function, block: PageContentBuilderFunction) { contents += group(setOf(f.dri), f.platformData, ContentKind.Symbol, block) } @@ -163,7 +163,7 @@ class DefaultPageContentBuilder( } -private fun PageContentBuilder.type(t: TypeWrapper) { +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) |
