aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/pages
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-07-14 19:22:17 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-07-15 16:01:44 +0200
commitdcd4c1c5bc13e7bb058bcd055aa2b02d7d39e9c1 (patch)
tree7ff9003f55c5890ca5e7d47a0f2adc58ee363201 /core/src/main/kotlin/pages
parentac19f61e253e9d168898fe3a0f64221b697ad8be (diff)
downloaddokka-dcd4c1c5bc13e7bb058bcd055aa2b02d7d39e9c1.tar.gz
dokka-dcd4c1c5bc13e7bb058bcd055aa2b02d7d39e9c1.tar.bz2
dokka-dcd4c1c5bc13e7bb058bcd055aa2b02d7d39e9c1.zip
Fix presenting inline code in KDoc
Diffstat (limited to 'core/src/main/kotlin/pages')
-rw-r--r--core/src/main/kotlin/pages/ContentNodes.kt19
-rw-r--r--core/src/main/kotlin/pages/utils.kt3
2 files changed, 18 insertions, 4 deletions
diff --git a/core/src/main/kotlin/pages/ContentNodes.kt b/core/src/main/kotlin/pages/ContentNodes.kt
index c8b767d3..6a6d3e22 100644
--- a/core/src/main/kotlin/pages/ContentNodes.kt
+++ b/core/src/main/kotlin/pages/ContentNodes.kt
@@ -60,16 +60,29 @@ data class ContentHeader(
override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentHeader = copy(extra = newExtras)
}
+interface ContentCode : ContentComposite
+
/** Code blocks */
-data class ContentCode(
+data class ContentCodeBlock(
override val children: List<ContentNode>,
val language: String,
override val dci: DCI,
override val sourceSets: Set<DokkaSourceSet>,
override val style: Set<Style>,
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
-) : ContentComposite {
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentCode = copy(extra = newExtras)
+) : ContentCode {
+ override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentCodeBlock = copy(extra = newExtras)
+}
+
+data class ContentCodeInline(
+ override val children: List<ContentNode>,
+ val language: String,
+ override val dci: DCI,
+ override val sourceSets: Set<DokkaSourceSet>,
+ override val style: Set<Style>,
+ override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
+) : ContentCode {
+ override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentCodeInline = copy(extra = newExtras)
}
/** Union type replacement */
diff --git a/core/src/main/kotlin/pages/utils.kt b/core/src/main/kotlin/pages/utils.kt
index 5292dea1..c9039416 100644
--- a/core/src/main/kotlin/pages/utils.kt
+++ b/core/src/main/kotlin/pages/utils.kt
@@ -14,7 +14,8 @@ internal fun <T : ContentNode, R : ContentNode> R.mapTransform(type: KClass<T>,
val new = when (this) {
is ContentGroup -> this.copy(children.map { it.mapTransform(type, operation) })
is ContentHeader -> this.copy(children.map { it.mapTransform(type, operation) })
- is ContentCode -> this.copy(children.map { it.mapTransform(type, operation) })
+ is ContentCodeBlock -> this.copy(children.map { it.mapTransform(type, operation) })
+ is ContentCodeInline -> this.copy(children.map { it.mapTransform(type, operation) })
is ContentTable -> this.copy(children.map { it.mapTransform(type, operation) })
is ContentList -> this.copy(children.map { it.mapTransform(type, operation) })
is ContentDivergentGroup -> this.copy(children.map { it.mapTransform(type, operation) })