package utils import matchers.content.* import org.jetbrains.dokka.pages.ContentGroup //TODO: Try to unify those functions after update to 1.4 fun ContentMatcherBuilder<*>.signature( name: String, returnType: String? = null, vararg params: Pair ) = platformHinted { bareSignature(name, returnType, *params) } fun ContentMatcherBuilder<*>.bareSignature( name: String, returnType: String? = null, vararg params: Pair ) = group { +"final fun" link { +name } +"(" params.forEachIndexed { id, (n, t) -> +"$n:" group { link { +t } } if (id != params.lastIndex) +", " } +")" returnType?.let { +": $it" } } fun ContentMatcherBuilder<*>.signatureWithReceiver( receiver: String, name: String, returnType: String? = null, vararg params: Pair ) = platformHinted { bareSignatureWithReceiver(receiver, name, returnType, *params) } fun ContentMatcherBuilder<*>.bareSignatureWithReceiver( receiver: String, name: String, returnType: String? = null, vararg params: Pair ) = group { +"final fun" group { link { +receiver } } +"." link { +name } +"(" params.forEach { (n, t) -> +"$n:" group { link { +t } } } +")" returnType?.let { +": $it" } } fun ContentMatcherBuilder<*>.pWrapped(text: String) = group {// TODO: remove it when double wrapping for descriptions will be resolved group { +text } } fun ContentMatcherBuilder<*>.unnamedTag(tag: String, content: ContentMatcherBuilder.() -> Unit) = group { header(4) { +tag } group { content() } }