aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-03-03 14:13:57 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-03-04 17:48:41 +0100
commitcf0c5043887b1dd38808b0fc12bd8700c9f3b6ba (patch)
tree2afa8a49d240cee38bc66edf0a927cd60f11cd8b
parent77702901cf9255da9a1390b4f01f986da78e58b6 (diff)
downloaddokka-cf0c5043887b1dd38808b0fc12bd8700c9f3b6ba.tar.gz
dokka-cf0c5043887b1dd38808b0fc12bd8700c9f3b6ba.tar.bz2
dokka-cf0c5043887b1dd38808b0fc12bd8700c9f3b6ba.zip
Refactor extras in ContentNodes
-rw-r--r--.idea/compiler.xml16
-rw-r--r--core/src/main/kotlin/model/properties/PropertyContainer.kt7
-rw-r--r--core/src/main/kotlin/pages/ContentNodes.kt75
-rw-r--r--core/src/main/kotlin/pages/contentNodeProperties.kt8
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt4
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/comments/CommentsToContentConverter.kt3
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt31
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/merger/SameMethodNamePageMergerStrategy.kt7
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt67
9 files changed, 127 insertions, 91 deletions
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 076cae16..0848aa0c 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -92,6 +92,22 @@
<module name="org.jetbrains.dokka.core.test" target="1.8" />
<module name="org.jetbrains.dokka.coreDependencies.main" target="1.8" />
<module name="org.jetbrains.dokka.coreDependencies.test" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.coreDependencies.main" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.coreDependencies.test" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.integration-tests.gradle-integration-tests.main" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.integration-tests.gradle-integration-tests.test" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.integration-tests.main" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.integration-tests.test" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.plugins.main" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.plugins.mathjax.main" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.plugins.mathjax.test" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.plugins.test" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.runners.main" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.runners.maven-plugin.main" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.runners.maven-plugin.test" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.runners.test" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.testApi.main" target="1.8" />
+ <module name="org.jetbrains.dokka.dokka.testApi.test" target="1.8" />
<module name="org.jetbrains.dokka.fatjar.main" target="1.8" />
<module name="org.jetbrains.dokka.fatjar.test" target="1.8" />
<module name="org.jetbrains.dokka.gradle-integration-tests.main" target="1.8" />
diff --git a/core/src/main/kotlin/model/properties/PropertyContainer.kt b/core/src/main/kotlin/model/properties/PropertyContainer.kt
index d30c6844..7fa46ccb 100644
--- a/core/src/main/kotlin/model/properties/PropertyContainer.kt
+++ b/core/src/main/kotlin/model/properties/PropertyContainer.kt
@@ -14,8 +14,10 @@ class PropertyContainer<C : Any> internal constructor(
else -> throw ClassCastException("Property for $key stored under not matching key type.")
}
+ inline fun <reified T : Any> allOfType(): List<T> = map.values.filterIsInstance<T>()
+
companion object {
- fun <T: Any> empty(): PropertyContainer<T> = PropertyContainer(emptyMap())
+ fun <T : Any> empty(): PropertyContainer<T> = PropertyContainer(emptyMap())
}
}
@@ -41,7 +43,8 @@ fun <C> C.mergeExtras(left: C, right: C): C where C : Any, C : WithExtraProperti
strategies.firstIsInstanceOrNull<MergeStrategy.Fail>()?.error?.invoke()
- val replaces: List<ExtraProperty<C>> = strategies.filterIsInstance<MergeStrategy.Replace<C>>().map { it.newProperty }
+ val replaces: List<ExtraProperty<C>> =
+ strategies.filterIsInstance<MergeStrategy.Replace<C>>().map { it.newProperty }
val needingFullMerge: List<(preMerged: C, left: C, right: C) -> C> =
strategies.filterIsInstance<MergeStrategy.Full<C>>().map { it.merger }
diff --git a/core/src/main/kotlin/pages/ContentNodes.kt b/core/src/main/kotlin/pages/ContentNodes.kt
index 797623e1..2e14dfb9 100644
--- a/core/src/main/kotlin/pages/ContentNodes.kt
+++ b/core/src/main/kotlin/pages/ContentNodes.kt
@@ -1,16 +1,17 @@
package org.jetbrains.dokka.pages
import org.jetbrains.dokka.links.DRI
+import org.jetbrains.dokka.model.properties.PropertyContainer
+import org.jetbrains.dokka.model.properties.WithExtraProperties
data class DCI(val dri: Set<DRI>, val kind: Kind) {
override fun toString() = "$dri[$kind]"
}
-interface ContentNode {
+interface ContentNode : WithExtraProperties<ContentNode> {
val dci: DCI
val platforms: Set<PlatformData>
val style: Set<Style>
- val extras: Set<Extra>
}
/** Simple text */
@@ -19,8 +20,10 @@ data class ContentText(
override val dci: DCI,
override val platforms: Set<PlatformData>,
override val style: Set<Style> = emptySet(),
- override val extras: Set<Extra> = emptySet()
-) : ContentNode
+ override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
+) : ContentNode {
+ override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentNode = copy(extra = newExtras)
+}
/** Headers */
data class ContentHeader(
@@ -29,9 +32,11 @@ data class ContentHeader(
override val dci: DCI,
override val platforms: Set<PlatformData>,
override val style: Set<Style>,
- override val extras: Set<Extra> = emptySet()
+ override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentComposite {
- constructor(level: Int, c: ContentComposite) : this(c.children, level, c.dci, c.platforms, c.style, c.extras)
+ constructor(level: Int, c: ContentComposite) : this(c.children, level, c.dci, c.platforms, c.style, c.extra)
+
+ override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentHeader = copy(extra = newExtras)
}
/** Code blocks */
@@ -41,8 +46,10 @@ data class ContentCode(
override val dci: DCI,
override val platforms: Set<PlatformData>,
override val style: Set<Style>,
- override val extras: Set<Extra>
-) : ContentComposite
+ override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
+) : ContentComposite {
+ override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentCode = copy(extra = newExtras)
+}
/** Union type replacement */
interface ContentLink : ContentComposite
@@ -54,8 +61,10 @@ data class ContentDRILink(
override val dci: DCI,
override val platforms: Set<PlatformData>,
override val style: Set<Style> = emptySet(),
- override val extras: Set<Extra> = emptySet()
-) : ContentLink
+ override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
+) : ContentLink {
+ override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentDRILink = copy(extra = newExtras)
+}
/** All links that do not need to be resolved */
data class ContentResolvedLink(
@@ -64,8 +73,11 @@ data class ContentResolvedLink(
override val dci: DCI,
override val platforms: Set<PlatformData>,
override val style: Set<Style> = emptySet(),
- override val extras: Set<Extra> = emptySet()
-) : ContentLink
+ override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
+) : ContentLink {
+ override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentResolvedLink =
+ copy(extra = newExtras)
+}
/** All links that do not need to be resolved */
data class ContentEmbeddedResource(
@@ -74,9 +86,11 @@ data class ContentEmbeddedResource(
override val dci: DCI,
override val platforms: Set<PlatformData>,
override val style: Set<Style> = emptySet(),
- override val extras: Set<Extra> = emptySet()
+ override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentLink {
override val children = emptyList<ContentNode>()
+ override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentEmbeddedResource =
+ copy(extra = newExtras)
}
/** Logical grouping of [ContentNode]s */
@@ -91,8 +105,10 @@ data class ContentTable(
override val dci: DCI,
override val platforms: Set<PlatformData>,
override val style: Set<Style>,
- override val extras: Set<Extra>
-) : ContentComposite
+ override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
+) : ContentComposite {
+ override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentTable = copy(extra = newExtras)
+}
/** Lists */
data class ContentList(
@@ -101,8 +117,10 @@ data class ContentList(
override val dci: DCI,
override val platforms: Set<PlatformData>,
override val style: Set<Style>,
- override val extras: Set<Extra>
-) : ContentComposite
+ override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
+) : ContentComposite {
+ override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentList = copy(extra = newExtras)
+}
/** Default group, eg. for blocks of Functions, Properties, etc. **/
data class ContentGroup(
@@ -110,23 +128,28 @@ data class ContentGroup(
override val dci: DCI,
override val platforms: Set<PlatformData>,
override val style: Set<Style>,
- override val extras: Set<Extra>
-) : ContentComposite
+ override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
+) : ContentComposite {
+ override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentGroup = copy(extra = newExtras)
+}
data class PlatformHintedContent(
val inner: ContentNode,
override val platforms: Set<PlatformData>
-): ContentComposite {
+) : ContentComposite {
override val children = listOf(inner)
override val dci: DCI
get() = inner.dci
- override val extras: Set<Extra>
- get() = inner.extras
+ override val extra: PropertyContainer<ContentNode>
+ get() = inner.extra
override val style: Set<Style>
get() = inner.style
+
+ override fun withNewExtras(newExtras: PropertyContainer<ContentNode>) =
+ throw UnsupportedOperationException("This method should not be called on this PlatformHintedContent")
}
/** All extras */
@@ -142,14 +165,6 @@ enum class TextStyle : Style {
Bold, Italic, Strong, Strikethrough, Paragraph, Block
}
-interface HTMLMetadata: Extra {
- val key: String
- val value: String
-}
-
-data class HTMLSimpleAttr(override val key: String, override val value: String): HTMLMetadata
-data class HTMLTableMetadata(val item: String, override val key: String, override val value: String): HTMLMetadata
-
fun ContentNode.dfs(predicate: (ContentNode) -> Boolean): ContentNode? = if (predicate(this)) {
this
} else {
diff --git a/core/src/main/kotlin/pages/contentNodeProperties.kt b/core/src/main/kotlin/pages/contentNodeProperties.kt
new file mode 100644
index 00000000..9eabcd12
--- /dev/null
+++ b/core/src/main/kotlin/pages/contentNodeProperties.kt
@@ -0,0 +1,8 @@
+package org.jetbrains.dokka.pages
+
+import org.jetbrains.dokka.model.properties.ExtraProperty
+
+class SimpleAttr(val extraKey: String, val extraValue: String) : ExtraProperty<ContentNode> {
+ data class SimpleAttrKey(val key: String) : ExtraProperty.Key<ContentNode, SimpleAttr>
+ override val key: ExtraProperty.Key<ContentNode, SimpleAttr> = SimpleAttrKey(extraKey)
+}
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 0dd3b34b..74bc6fea 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -88,7 +88,7 @@ open class HtmlRenderer(
val imageExtensions = setOf("png", "jpg", "jpeg", "gif", "bmp", "tif", "webp", "svg")
return if (File(node.address).extension.toLowerCase() in imageExtensions) {
//TODO: add imgAttrs parsing
- val imgAttrs = node.extras.filterIsInstance<HTMLSimpleAttr>().joinAttr()
+ val imgAttrs = node.extra.allOfType<SimpleAttr>().joinAttr()
img(src = node.address, alt = node.altText)
} else {
println("Unrecognized resource type: $node")
@@ -239,7 +239,7 @@ open class HtmlRenderer(
}
}
-fun List<HTMLMetadata>.joinAttr() = joinToString(" ") { it.key + "=" + it.value }
+fun List<SimpleAttr>.joinAttr() = joinToString(" ") { it.extraKey + "=" + it.extraValue }
private fun PageNode.pageKind() = when (this) {
is PackagePageNode -> "package"
diff --git a/plugins/base/src/main/kotlin/transformers/pages/comments/CommentsToContentConverter.kt b/plugins/base/src/main/kotlin/transformers/pages/comments/CommentsToContentConverter.kt
index 4d2f14a5..778e0498 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/comments/CommentsToContentConverter.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/comments/CommentsToContentConverter.kt
@@ -1,6 +1,7 @@
package org.jetbrains.dokka.base.transformers.pages.comments
import org.jetbrains.dokka.model.doc.DocTag
+import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.*
interface CommentsToContentConverter {
@@ -9,6 +10,6 @@ interface CommentsToContentConverter {
dci: DCI,
platforms: Set<PlatformData>,
styles: Set<Style> = emptySet(),
- extras: Set<Extra> = emptySet()
+ extras: PropertyContainer<ContentNode> = PropertyContainer.empty()
): List<ContentNode>
}
diff --git a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
index 70792534..900f5c19 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
@@ -1,6 +1,7 @@
package org.jetbrains.dokka.base.transformers.pages.comments
import org.jetbrains.dokka.model.doc.*
+import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
@@ -10,13 +11,12 @@ object DocTagToContentConverter : CommentsToContentConverter {
dci: DCI,
platforms: Set<PlatformData>,
styles: Set<Style>,
- extras: Set<Extra>
-
+ extra: PropertyContainer<ContentNode>
): List<ContentNode> {
- fun buildChildren(docTag: DocTag, newStyles: Set<Style> = emptySet(), newExtras: Set<Extra> = emptySet()) =
+ fun buildChildren(docTag: DocTag, newStyles: Set<Style> = emptySet(), newExtras: SimpleAttr? = null) =
docTag.children.flatMap {
- buildContent(it, dci, platforms, styles + newStyles, extras + newExtras)
+ buildContent(it, dci, platforms, styles + newStyles, newExtras?.let { extra + it } ?: extra)
}
fun buildHeader(level: Int) =
@@ -26,8 +26,7 @@ object DocTagToContentConverter : CommentsToContentConverter {
level,
dci,
platforms,
- styles,
- extras
+ styles
)
)
@@ -38,8 +37,7 @@ object DocTagToContentConverter : CommentsToContentConverter {
ordered,
dci,
platforms,
- styles,
- extras
+ styles
)
)
@@ -62,8 +60,7 @@ object DocTagToContentConverter : CommentsToContentConverter {
docTag.params.get("href")!!,
dci,
platforms,
- styles,
- extras
+ styles
)
)
is DocumentationLink -> listOf(
@@ -75,8 +72,7 @@ object DocTagToContentConverter : CommentsToContentConverter {
ContentKind.Symbol
),
platforms,
- styles,
- extras
+ styles
)
)
is BlockQuote -> listOf(
@@ -85,8 +81,7 @@ object DocTagToContentConverter : CommentsToContentConverter {
"",
dci,
platforms,
- styles,
- extras
+ styles
)
)
is Code -> listOf(
@@ -95,8 +90,7 @@ object DocTagToContentConverter : CommentsToContentConverter {
"",
dci,
platforms,
- styles,
- extras
+ styles
)
)
is Img -> listOf(
@@ -106,7 +100,7 @@ object DocTagToContentConverter : CommentsToContentConverter {
dci = dci,
platforms = platforms,
style = styles,
- extras = extras
+ extra = extra
)
)
is HorizontalRule -> listOf(
@@ -122,8 +116,7 @@ object DocTagToContentConverter : CommentsToContentConverter {
docTag.body,
dci,
platforms,
- styles,
- extras
+ styles
)
)
else -> buildChildren(docTag)
diff --git a/plugins/base/src/main/kotlin/transformers/pages/merger/SameMethodNamePageMergerStrategy.kt b/plugins/base/src/main/kotlin/transformers/pages/merger/SameMethodNamePageMergerStrategy.kt
index ce57d28c..fb904f47 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/merger/SameMethodNamePageMergerStrategy.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/merger/SameMethodNamePageMergerStrategy.kt
@@ -31,8 +31,7 @@ object SameMethodNamePageMergerStrategy : PageMergerStrategy {
return others + listOf(merged)
}
- fun asGroup(dci: DCI, nodes: List<ContentNode>): ContentGroup {
- val n = nodes.first()
- return ContentGroup(nodes, dci, n.platforms, n.style, n.extras)
- }
+ fun asGroup(dci: DCI, nodes: List<ContentNode>): ContentGroup =
+ nodes.first().let { ContentGroup(nodes, dci, it.platforms, it.style, it.extra) }
+
} \ No newline at end of file
diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
index 369c9c81..ef1b8ec1 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
@@ -6,6 +6,7 @@ import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.model.TypeWrapper
import org.jetbrains.dokka.model.doc.DocTag
+import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.utilities.DokkaLogger
@@ -22,30 +23,30 @@ open class PageContentBuilder(
platformData: Set<PlatformData>,
kind: Kind = ContentKind.Main,
styles: Set<Style> = emptySet(),
- extras: Set<Extra> = emptySet(),
+ extra: PropertyContainer<ContentNode> = PropertyContainer.empty(),
block: DocumentableContentBuilder.() -> Unit
): ContentGroup =
- DocumentableContentBuilder(dri, platformData, styles, extras)
+ DocumentableContentBuilder(dri, platformData, styles, extra)
.apply(block)
- .build(platformData, kind, styles, extras)
+ .build(platformData, kind, styles, extra)
fun contentFor(
d: Documentable,
kind: Kind = ContentKind.Main,
styles: Set<Style> = emptySet(),
- extras: Set<Extra> = emptySet(),
+ extra: PropertyContainer<ContentNode> = PropertyContainer.empty(),
block: DocumentableContentBuilder.() -> Unit
): ContentGroup =
- DocumentableContentBuilder(d.dri, d.platformData.toSet(), styles, extras)
+ DocumentableContentBuilder(d.dri, d.platformData.toSet(), styles, extra)
.apply(block)
- .build(d.platformData.toSet(), kind, styles, extras)
+ .build(d.platformData.toSet(), kind, styles, extra)
@ContentBuilderMarker
open inner class DocumentableContentBuilder(
val mainDRI: DRI,
val mainPlatformData: Set<PlatformData>,
val mainStyles: Set<Style>,
- val mainExtras: Set<Extra>
+ val mainExtra: PropertyContainer<ContentNode>
) {
protected val contents = mutableListOf<ContentNode>()
@@ -53,13 +54,13 @@ open class PageContentBuilder(
platformData: Set<PlatformData>,
kind: Kind,
styles: Set<Style>,
- extras: Set<Extra>
+ extra: PropertyContainer<ContentNode>
) = ContentGroup(
contents.toList(),
DCI(setOf(mainDRI), kind),
platformData,
styles,
- extras
+ extra
)
operator fun ContentNode.unaryPlus() {
@@ -74,12 +75,12 @@ open class PageContentBuilder(
level: Int,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
- extras: Set<Extra> = mainExtras,
+ extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit
) {
contents += ContentHeader(
level,
- contentFor(mainDRI, mainPlatformData, kind, styles, extras, block)
+ contentFor(mainDRI, mainPlatformData, kind, styles, extra, block)
)
}
@@ -88,9 +89,9 @@ open class PageContentBuilder(
kind: Kind = ContentKind.Main,
platformData: Set<PlatformData> = mainPlatformData,
styles: Set<Style> = mainStyles,
- extras: Set<Extra> = mainExtras
+ extra: PropertyContainer<ContentNode> = mainExtra
) {
- contents += createText(text, kind, platformData, styles, extras)
+ contents += createText(text, kind, platformData, styles, extra)
}
fun buildSignature(d: Documentable) = signatureProvider.signature(d)
@@ -100,17 +101,17 @@ open class PageContentBuilder(
kind: Kind = ContentKind.Main,
platformData: Set<PlatformData> = mainPlatformData,
styles: Set<Style> = mainStyles,
- extras: Set<Extra> = mainExtras
+ extra: PropertyContainer<ContentNode> = mainExtra
) {
contents += ContentTable(
emptyList(),
elements.map {
- contentFor(it, platformData, kind, styles, extras) {
+ contentFor(it, platformData, kind, styles, extra) {
link(it.classNames ?: "", it)
}
},
DCI(setOf(mainDRI), kind),
- platformData, styles, extras
+ platformData, styles, extra
)
}
@@ -121,7 +122,7 @@ open class PageContentBuilder(
elements: Iterable<T>,
platformData: Set<PlatformData> = mainPlatformData,
styles: Set<Style> = mainStyles,
- extras: Set<Extra> = mainExtras,
+ extra: PropertyContainer<ContentNode> = mainExtra,
renderWhenEmpty: Boolean = false,
operation: DocumentableContentBuilder.(T) -> Unit
) {
@@ -130,13 +131,13 @@ open class PageContentBuilder(
contents += ContentTable(
emptyList(),
elements.map {
- buildGroup(it.dri, it.platformData.toSet(), kind, styles, extras) {
+ buildGroup(it.dri, it.platformData.toSet(), kind, styles, extra) {
// TODO this will fail
operation(it)
}
},
DCI(setOf(mainDRI), kind),
- platformData, styles, extras
+ platformData, styles, extra
)
}
}
@@ -166,10 +167,10 @@ open class PageContentBuilder(
kind: Kind = ContentKind.Main,
platformData: Set<PlatformData> = mainPlatformData,
styles: Set<Style> = mainStyles,
- extras: Set<Extra> = mainExtras
+ extra: PropertyContainer<ContentNode> = mainExtra
) {
contents += ContentDRILink(
- listOf(createText(text, kind, platformData, styles, extras)),
+ listOf(createText(text, kind, platformData, styles, extra)),
address,
DCI(setOf(mainDRI), kind),
platformData
@@ -181,11 +182,11 @@ open class PageContentBuilder(
kind: Kind = ContentKind.Main,
platformData: Set<PlatformData> = mainPlatformData,
styles: Set<Style> = mainStyles,
- extras: Set<Extra> = mainExtras,
+ extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit
) {
contents += ContentDRILink(
- contentFor(mainDRI, platformData, kind, styles, extras, block).children,
+ contentFor(mainDRI, platformData, kind, styles, extra, block).children,
address,
DCI(setOf(mainDRI), kind),
platformData
@@ -197,14 +198,14 @@ open class PageContentBuilder(
kind: Kind = ContentKind.Comment,
platformData: Set<PlatformData> = mainPlatformData,
styles: Set<Style> = mainStyles,
- extras: Set<Extra> = mainExtras
+ extra: PropertyContainer<ContentNode> = mainExtra
) {
val content = commentsConverter.buildContent(
docTag,
DCI(setOf(mainDRI), kind),
platformData
)
- contents += ContentGroup(content, DCI(setOf(mainDRI), kind), platformData, styles, extras)
+ contents += ContentGroup(content, DCI(setOf(mainDRI), kind), platformData, styles, extra)
}
fun group(
@@ -212,10 +213,10 @@ open class PageContentBuilder(
platformData: Set<PlatformData> = mainPlatformData,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
- extras: Set<Extra> = mainExtras,
+ extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit
) {
- contents += buildGroup(dri, platformData, kind, styles, extras, block)
+ contents += buildGroup(dri, platformData, kind, styles, extra, block)
}
fun buildGroup(
@@ -223,20 +224,20 @@ open class PageContentBuilder(
platformData: Set<PlatformData> = mainPlatformData,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
- extras: Set<Extra> = mainExtras,
+ extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit
- ): ContentGroup = contentFor(dri, platformData, kind, styles, extras, block)
+ ): ContentGroup = contentFor(dri, platformData, kind, styles, extra, block)
fun platformDependentHint(
dri: DRI = mainDRI,
platformData: Set<PlatformData> = mainPlatformData,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
- extras: Set<Extra> = mainExtras,
+ extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit
) {
contents += PlatformHintedContent(
- buildGroup(dri, platformData, kind, styles, extras, block),
+ buildGroup(dri, platformData, kind, styles, extra, block),
platformData
)
}
@@ -246,9 +247,9 @@ open class PageContentBuilder(
kind: Kind,
platformData: Set<PlatformData>,
styles: Set<Style>,
- extras: Set<Extra>
+ extra: PropertyContainer<ContentNode>
) =
- ContentText(text, DCI(setOf(mainDRI), kind), platformData, styles, extras)
+ ContentText(text, DCI(setOf(mainDRI), kind), platformData, styles, extra)
fun type(t: TypeWrapper) {
if (t.constructorNamePathSegments.isNotEmpty() && t.dri != null)