diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/model/doc/DocTag.kt | 4 | ||||
-rw-r--r-- | core/src/main/kotlin/pages/ContentNodes.kt | 19 | ||||
-rw-r--r-- | core/src/main/kotlin/pages/utils.kt | 3 |
3 files changed, 21 insertions, 5 deletions
diff --git a/core/src/main/kotlin/model/doc/DocTag.kt b/core/src/main/kotlin/model/doc/DocTag.kt index 42836d71..069bbcab 100644 --- a/core/src/main/kotlin/model/doc/DocTag.kt +++ b/core/src/main/kotlin/model/doc/DocTag.kt @@ -24,7 +24,9 @@ class B(children: List<DocTag> = emptyList(), params: Map<String, String> = empt class BlockQuote(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) object Br : DocTag(emptyList(), emptyMap()) class Cite(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) -class Code(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) +sealed class Code(children: List<DocTag>, params: Map<String, String>) : DocTag(children, params) +class CodeInline(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : Code(children, params) +class CodeBlock(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : Code(children, params) class Dd(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) class Dfn(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) class Dir(children: List<DocTag> = emptyList(), params: Map<String, String> = emptyMap()) : DocTag(children, params) 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) }) |