aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/pages/ContentNodes.kt
blob: afb81995055ff4d3ce9c6e476dc2e16d312805f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package org.jetbrains.dokka.pages

import org.jetbrains.dokka.links.DRI

interface ContentNode {
    val platforms: List<PlatformData>
    val annotations: List<Annotation>
}

/** Comment consisting of parts, eg. [ContentText]s, [ContentLink]s and so on */
data class ContentComment(val parts: List<ContentNode>,
                       override val platforms: List<PlatformData>,
                       override val annotations: List<Annotation> = emptyList()
): ContentNode

/** Simple text */
data class ContentText(val text: String,
                       override val platforms: List<PlatformData>,
                       override val annotations: List<Annotation> = emptyList()
): ContentNode

///** Headers */  TODO for next iteration
data class ContentHeader(val text: String,
                         val level: Int,
                        override val platforms: List<PlatformData>,
                        override val annotations: List<Annotation> = emptyList()
): ContentNode

/** Lists */
data class ContentList(val items: List<ContentNode>,
                         val ordered: Boolean,
                         override val platforms: List<PlatformData>,
                         override val annotations: List<Annotation> = emptyList()
): ContentNode

/** Styled elements, eg. bold, strikethrough, emphasis and so on **/
data class ContentStyle(val items: List<ContentNode>,
                       val style: ContentNode,
                       override val platforms: List<PlatformData>,
                       override val annotations: List<Annotation> = emptyList()
): ContentNode

/** Code blocks */
data class ContentCode(val code: String,
                       val language: String,
                       override val platforms: List<PlatformData>,
                       override val annotations: List<Annotation> = emptyList()
): ContentNode

/** Symbols, eg. `open fun foo(): String`, or `class Bar`, consisting of parts like [ContentText] and [ContentLink] */
data class ContentSymbol(val parts: List<ContentNode>,
                         override val platforms: List<PlatformData>,
                         override val annotations: List<Annotation> = emptyList()
): ContentNode

/** All links that have te be resolved */
data class ContentLink(val text: String,
                       val address: DRI,
                       override val platforms: List<PlatformData>,
                       override val annotations: List<Annotation> = emptyList()
): ContentNode

/** Blocks of [ContentNode]s with name, eg. Functions, Types, Properties, etc. */
data class ContentBlock(val name: String,
                        val children: List<ContentNode>,
                        override val platforms: List<PlatformData>,
                        override val annotations: List<Annotation> = emptyList()
): ContentNode

/** Logical grouping of [ContentNode]s, eg. [ContentLink], [ContentText] and [ContentSymbol] for one entity */
data class ContentGroup(val children: List<ContentNode>,
                       override val platforms: List<PlatformData>,
                       override val annotations: List<Annotation> = emptyList()
): ContentNode

/** All annotations */
data class Annotation(val name: String)