diff options
Diffstat (limited to 'src/Model')
-rw-r--r-- | src/Model/Content.kt | 25 | ||||
-rw-r--r-- | src/Model/DocumentationNode.kt | 3 | ||||
-rw-r--r-- | src/Model/DocumentationReference.kt | 1 |
3 files changed, 26 insertions, 3 deletions
diff --git a/src/Model/Content.kt b/src/Model/Content.kt index eb092cb2..1b00bd34 100644 --- a/src/Model/Content.kt +++ b/src/Model/Content.kt @@ -9,18 +9,37 @@ public abstract class ContentNode { val empty = ContentEmpty } + fun append(node : ContentNode) : ContentNode { + children.add(node) + return this + } + fun isEmpty() = children.isEmpty() } -public object ContentEmpty : ContentNode( ) +public object ContentEmpty : ContentNode() -public class ContentText(val text : String) : ContentNode( ) -public class ContentBlock() : ContentNode( ) +public class ContentText(val text: String) : ContentNode() +public class ContentKeyword(val text: String) : ContentNode() +public class ContentIdentifier(val text: String) : ContentNode() +public class ContentSymbol(val text: String) : ContentNode() +public class ContentBlock() : ContentNode() public class ContentEmphasis() : ContentNode() public class ContentStrong() : ContentNode() public class ContentList() : ContentNode() public class ContentSection(public val label: String) : ContentNode() +fun content(body: ContentNode.() -> Unit): ContentNode { + val block = ContentBlock() + block.body() + return block +} + +fun ContentNode.text(value: String) = append(ContentText(value)) +fun ContentNode.keyword(value: String) = append(ContentKeyword(value)) +fun ContentNode.symbol(value: String) = append(ContentSymbol(value)) +fun ContentNode.identifier(value: String) = append(ContentIdentifier(value)) + public class Content() : ContentNode() { public val sections: Map<String, ContentSection> by Delegates.lazy { val map = hashMapOf<String, ContentSection>() diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt index cb6a13db..18efaa9b 100644 --- a/src/Model/DocumentationNode.kt +++ b/src/Model/DocumentationNode.kt @@ -16,6 +16,8 @@ public open class DocumentationNode(val name: String, get() = references(DocumentationReference.Kind.Member).map { it.to } public val extensions: List<DocumentationNode> get() = references(DocumentationReference.Kind.Extension).map { it.to } + public val inheritors: List<DocumentationNode> + get() = references(DocumentationReference.Kind.Inheritor).map { it.to } public val links: List<DocumentationNode> get() = references(DocumentationReference.Kind.Link).map { it.to } @@ -61,6 +63,7 @@ public open class DocumentationNode(val name: String, Receiver TypeParameter Type + Supertype UpperBound LowerBound Exception diff --git a/src/Model/DocumentationReference.kt b/src/Model/DocumentationReference.kt index fdc29b9e..1849fe08 100644 --- a/src/Model/DocumentationReference.kt +++ b/src/Model/DocumentationReference.kt @@ -7,6 +7,7 @@ public data class DocumentationReference(val from: DocumentationNode, val to: Do Detail Link Extension + Inheritor Override } } |