Skip to content

Commit

Permalink
Extract a nested custom tags brief block into a separate method
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnatBeresnev committed Feb 14, 2022
1 parent ac9b0a6 commit f89fab1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
Expand Up @@ -8,7 +8,7 @@ import org.jetbrains.dokka.pages.TextStyle

object SinceKotlinTagContentProvider : CustomTagContentProvider {

private val TAG_NAME = "Since Kotlin"
private const val TAG_NAME = "Since Kotlin"

override fun DocumentableContentBuilder.contentForDescription(
sourceSet: DokkaConfiguration.DokkaSourceSet,
Expand Down
Expand Up @@ -683,21 +683,7 @@ open class DefaultPageCreator(
}
after(extra = PropertyContainer.empty()) {
contentForBrief(it)

val customTags = it.customTags
if (customTags.isNotEmpty()) {
it.sourceSets.forEach { sourceSet ->
customTags.forEach { (tagName, sourceSetTag) ->
sourceSetTag[sourceSet]?.let { tag ->
customTagContentProviders.forEach { provider ->
with(provider) {
contentForBrief(sourceSet, tag)
}
}
}
}
}
}
contentForCustomTagsBrief(it)
}
}
}
Expand All @@ -708,6 +694,22 @@ open class DefaultPageCreator(
}
}

private fun DocumentableContentBuilder.contentForCustomTagsBrief(documentable: Documentable) {
val customTags = documentable.customTags
if (customTags.isEmpty()) return

documentable.sourceSets.forEach { sourceSet ->
customTags.forEach { (tagName, sourceSetTag) ->
sourceSetTag[sourceSet]?.let { tag ->
customTagContentProviders.forEach { provider ->
with(provider) {
contentForBrief(sourceSet, tag)
}
}
}
}
}
}

protected open fun TagWrapper.toHeaderString() = this.javaClass.toGenericString().split('.').last()

Expand Down

0 comments on commit f89fab1

Please sign in to comment.