diff options
Diffstat (limited to 'core')
7 files changed, 76 insertions, 10 deletions
diff --git a/core/api/core.api b/core/api/core.api index f51d7043..4c755aae 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -1460,6 +1460,7 @@ public final class org/jetbrains/dokka/model/DocumentableUtilsKt { public static final fun filter (Lorg/jetbrains/dokka/model/DTypeParameter;Ljava/util/Set;)Lorg/jetbrains/dokka/model/DTypeParameter; public static final fun filtered (Ljava/util/Map;Ljava/util/Set;)Ljava/util/Map; public static final fun filtered (Lorg/jetbrains/dokka/DokkaConfiguration$DokkaSourceSet;Ljava/util/Set;)Lorg/jetbrains/dokka/DokkaConfiguration$DokkaSourceSet; + public static final fun isExtension (Lorg/jetbrains/dokka/model/Documentable;)Z } public final class org/jetbrains/dokka/model/DoubleConstant : org/jetbrains/dokka/model/Expression { @@ -3469,6 +3470,18 @@ public abstract interface class org/jetbrains/dokka/model/properties/WithExtraPr public abstract fun withNewExtras (Lorg/jetbrains/dokka/model/properties/PropertyContainer;)Ljava/lang/Object; } +public final class org/jetbrains/dokka/pages/BasicTabbedContentType : java/lang/Enum, org/jetbrains/dokka/pages/TabbedContentType { + public static final field CONSTRUCTOR Lorg/jetbrains/dokka/pages/BasicTabbedContentType; + public static final field ENTRY Lorg/jetbrains/dokka/pages/BasicTabbedContentType; + public static final field EXTENSION_FUNCTION Lorg/jetbrains/dokka/pages/BasicTabbedContentType; + public static final field EXTENSION_PROPERTY Lorg/jetbrains/dokka/pages/BasicTabbedContentType; + public static final field FUNCTION Lorg/jetbrains/dokka/pages/BasicTabbedContentType; + public static final field PROPERTY Lorg/jetbrains/dokka/pages/BasicTabbedContentType; + public static final field TYPE Lorg/jetbrains/dokka/pages/BasicTabbedContentType; + public static fun valueOf (Ljava/lang/String;)Lorg/jetbrains/dokka/pages/BasicTabbedContentType; + public static fun values ()[Lorg/jetbrains/dokka/pages/BasicTabbedContentType; +} + public abstract interface class org/jetbrains/dokka/pages/ClasslikePage : org/jetbrains/dokka/pages/ContentPage, org/jetbrains/dokka/pages/WithDocumentables { } @@ -4248,17 +4261,12 @@ public abstract class org/jetbrains/dokka/pages/RootPageNode : org/jetbrains/dok } public final class org/jetbrains/dokka/pages/SimpleAttr : org/jetbrains/dokka/model/properties/ExtraProperty { - public static final field Companion Lorg/jetbrains/dokka/pages/SimpleAttr$Companion; public fun <init> (Ljava/lang/String;Ljava/lang/String;)V public final fun getExtraKey ()Ljava/lang/String; public final fun getExtraValue ()Ljava/lang/String; public fun getKey ()Lorg/jetbrains/dokka/model/properties/ExtraProperty$Key; } -public final class org/jetbrains/dokka/pages/SimpleAttr$Companion { - public final fun header (Ljava/lang/String;)Lorg/jetbrains/dokka/pages/SimpleAttr; -} - public final class org/jetbrains/dokka/pages/SimpleAttr$SimpleAttrKey : org/jetbrains/dokka/model/properties/ExtraProperty$Key { public fun <init> (Ljava/lang/String;)V public final fun component1 ()Ljava/lang/String; @@ -4282,6 +4290,21 @@ public final class org/jetbrains/dokka/pages/SymbolContentKind : java/lang/Enum, public static fun values ()[Lorg/jetbrains/dokka/pages/SymbolContentKind; } +public abstract interface class org/jetbrains/dokka/pages/TabbedContentType { +} + +public final class org/jetbrains/dokka/pages/TabbedContentTypeExtra : org/jetbrains/dokka/model/properties/ExtraProperty { + public static final field Companion Lorg/jetbrains/dokka/pages/TabbedContentTypeExtra$Companion; + public fun <init> (Lorg/jetbrains/dokka/pages/TabbedContentType;)V + public fun getKey ()Lorg/jetbrains/dokka/model/properties/ExtraProperty$Key; + public final fun getValue ()Lorg/jetbrains/dokka/pages/TabbedContentType; +} + +public final class org/jetbrains/dokka/pages/TabbedContentTypeExtra$Companion : org/jetbrains/dokka/model/properties/ExtraProperty$Key { + public synthetic fun mergeStrategyFor (Ljava/lang/Object;Ljava/lang/Object;)Lorg/jetbrains/dokka/model/properties/MergeStrategy; + public fun mergeStrategyFor (Lorg/jetbrains/dokka/pages/TabbedContentTypeExtra;Lorg/jetbrains/dokka/pages/TabbedContentTypeExtra;)Lorg/jetbrains/dokka/model/properties/MergeStrategy; +} + public final class org/jetbrains/dokka/pages/TextStyle : java/lang/Enum, org/jetbrains/dokka/pages/Style { public static final field Block Lorg/jetbrains/dokka/pages/TextStyle; public static final field Bold Lorg/jetbrains/dokka/pages/TextStyle; diff --git a/core/content-matcher-test-utils/api/content-matcher-test-utils.api b/core/content-matcher-test-utils/api/content-matcher-test-utils.api index 0a7f153b..58881a15 100644 --- a/core/content-matcher-test-utils/api/content-matcher-test-utils.api +++ b/core/content-matcher-test-utils/api/content-matcher-test-utils.api @@ -30,6 +30,8 @@ public final class matchers/content/ContentMatchersDslKt { public static final fun platformHinted (Lmatchers/content/ContentMatcherBuilder;Lkotlin/jvm/functions/Function1;)V public static final fun skipAllNotMatching (Lmatchers/content/ContentMatcherBuilder;)V public static final fun somewhere (Lmatchers/content/ContentMatcherBuilder;Lkotlin/jvm/functions/Function1;)V + public static final fun tab (Lmatchers/content/ContentMatcherBuilder;Lorg/jetbrains/dokka/pages/TabbedContentType;Lkotlin/jvm/functions/Function1;)V + public static final fun tabbedGroup (Lmatchers/content/ContentMatcherBuilder;Lkotlin/jvm/functions/Function1;)V public static final fun table (Lmatchers/content/ContentMatcherBuilder;Lkotlin/jvm/functions/Function1;)V } diff --git a/core/content-matcher-test-utils/src/main/kotlin/matchers/content/ContentMatchersDsl.kt b/core/content-matcher-test-utils/src/main/kotlin/matchers/content/ContentMatchersDsl.kt index 08442536..13780718 100644 --- a/core/content-matcher-test-utils/src/main/kotlin/matchers/content/ContentMatchersDsl.kt +++ b/core/content-matcher-test-utils/src/main/kotlin/matchers/content/ContentMatchersDsl.kt @@ -3,6 +3,7 @@ package matchers.content import assertk.assertThat import assertk.assertions.contains import assertk.assertions.isEqualTo +import assertk.assertions.isNotNull import org.jetbrains.dokka.model.withDescendants import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.test.tools.matchers.content.* @@ -70,6 +71,23 @@ fun ContentMatcherBuilder<*>.skipAllNotMatching() { // Convenience functions: fun ContentMatcherBuilder<*>.group(block: ContentMatcherBuilder<ContentGroup>.() -> Unit) = composite(block) +fun ContentMatcherBuilder<*>.tabbedGroup( + block: ContentMatcherBuilder<ContentGroup>.() -> Unit +) = composite<ContentGroup> { + block() + check { assertThat(this::style).transform { style -> style.contains(ContentStyle.TabbedContent) }.isEqualTo(true) } +} + +fun ContentMatcherBuilder<*>.tab( + tabbedContentType: TabbedContentType, block: ContentMatcherBuilder<ContentGroup>.() -> Unit +) = composite<ContentGroup> { + block() + check { + assertThat(this::extra).transform { extra -> extra[TabbedContentTypeExtra]?.value } + .isEqualTo(tabbedContentType) + } +} + fun ContentMatcherBuilder<*>.header(expectedLevel: Int? = null, block: ContentMatcherBuilder<ContentHeader>.() -> Unit) = composite<ContentHeader> { block() diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index 73ab35d4..adc51cfc 100644 --- a/core/src/main/kotlin/model/Documentable.kt +++ b/core/src/main/kotlin/model/Documentable.kt @@ -519,4 +519,4 @@ interface DocumentableSource { val path: String } -data class TypeConstructorWithKind(val typeConstructor: TypeConstructor, val kind: ClassKind) +data class TypeConstructorWithKind(val typeConstructor: TypeConstructor, val kind: ClassKind)
\ No newline at end of file diff --git a/core/src/main/kotlin/model/documentableUtils.kt b/core/src/main/kotlin/model/documentableUtils.kt index e32605ca..076ca23a 100644 --- a/core/src/main/kotlin/model/documentableUtils.kt +++ b/core/src/main/kotlin/model/documentableUtils.kt @@ -19,3 +19,5 @@ fun DTypeParameter.filter(filteredSet: Set<DokkaSourceSet>) = extra ) } + +fun Documentable.isExtension() = this is Callable && receiver != null
\ No newline at end of file diff --git a/core/src/main/kotlin/pages/ContentNodes.kt b/core/src/main/kotlin/pages/ContentNodes.kt index 3c6fa5ac..78760044 100644 --- a/core/src/main/kotlin/pages/ContentNodes.kt +++ b/core/src/main/kotlin/pages/ContentNodes.kt @@ -392,7 +392,14 @@ enum class TextStyle : Style { } enum class ContentStyle : Style { - RowTitle, TabbedContent, WithExtraAttributes, RunnableSample, InDocumentationAnchor, Caption, + RowTitle, + /** + * The style is used only for HTML. It is applied only for [ContentGroup]. + * Creating and rendering tabs is a part of a renderer. + */ + TabbedContent, + + WithExtraAttributes, RunnableSample, InDocumentationAnchor, Caption, Wrapped, Indented, KDocTag, Footnote } diff --git a/core/src/main/kotlin/pages/contentNodeProperties.kt b/core/src/main/kotlin/pages/contentNodeProperties.kt index cfd7f769..3c9bd422 100644 --- a/core/src/main/kotlin/pages/contentNodeProperties.kt +++ b/core/src/main/kotlin/pages/contentNodeProperties.kt @@ -6,9 +6,23 @@ class SimpleAttr(val extraKey: String, val extraValue: String) : ExtraProperty<C data class SimpleAttrKey(val key: String) : ExtraProperty.Key<ContentNode, SimpleAttr> override val key: ExtraProperty.Key<ContentNode, SimpleAttr> = SimpleAttrKey(extraKey) - companion object { - fun header(value: String) = SimpleAttr("data-togglable", value) - } +} + +enum class BasicTabbedContentType : TabbedContentType { + TYPE, CONSTRUCTOR, FUNCTION, PROPERTY, ENTRY, EXTENSION_PROPERTY, EXTENSION_FUNCTION +} + +/** + * It is used only to mark content for tabs in HTML format + */ +interface TabbedContentType + +/** + * @see TabbedContentType + */ +class TabbedContentTypeExtra(val value: TabbedContentType) : ExtraProperty<ContentNode> { + companion object : ExtraProperty.Key<ContentNode, TabbedContentTypeExtra> + override val key: ExtraProperty.Key<ContentNode, TabbedContentTypeExtra> = TabbedContentTypeExtra } object HtmlContent : ExtraProperty<ContentNode>, ExtraProperty.Key<ContentNode, HtmlContent> { |