aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/transformers
diff options
context:
space:
mode:
authorMartin Bonnin <martin@mbonnin.net>2020-11-18 12:48:03 +0100
committerGitHub <noreply@github.com>2020-11-18 12:48:03 +0100
commit1959b914c0838be814d45f617517ac73fa33cd47 (patch)
tree899805a421b45625ceffd599520a3f3e3d237e5a /plugins/base/src/main/kotlin/transformers
parentd6c798e44381fd436a264229f94f19528382c136 (diff)
downloaddokka-1959b914c0838be814d45f617517ac73fa33cd47.tar.gz
dokka-1959b914c0838be814d45f617517ac73fa33cd47.tar.bz2
dokka-1959b914c0838be814d45f617517ac73fa33cd47.zip
Add matchingRegex (#598)
* add matchingRegex as a simpler replacement for `prefix` * remove useless check * added a note about the order of the matchingRegex
Diffstat (limited to 'plugins/base/src/main/kotlin/transformers')
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt2
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt2
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt4
3 files changed, 4 insertions, 4 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
index 80696cbf..0f7795e6 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
@@ -24,7 +24,7 @@ class DeprecatedDocumentableFilterTransformer(val context: DokkaContext) : PreMe
fun <T> T.isAllowedInPackage(): Boolean where T : WithExtraProperties<T>, T : Documentable {
val packageName = this.dri.packageName
val condition = packageName != null && packageOptions.firstOrNull {
- packageName.startsWith(it.prefix)
+ Regex(it.matchingRegex).matches(packageName)
}?.skipDeprecated
?: globalOptions.skipDeprecated
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
index 57faeefb..1bc7a533 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
@@ -23,7 +23,7 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe
is JavaVisibility.Default,
is KotlinVisibility.Public -> true
else -> packageName != null
- && packageOptions.firstOrNull { packageName.startsWith(it.prefix) }?.includeNonPublic
+ && packageOptions.firstOrNull { Regex(it.matchingRegex).matches(packageName) }?.includeNonPublic
?: globalOptions.includeNonPublic
}
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
index 2608d9ba..a8fabc95 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
@@ -158,7 +158,7 @@ internal class ReportUndocumentedTransformer : DocumentableTransformer {
): DokkaConfiguration.PackageOptions? {
val packageName = documentable.dri.packageName ?: return null
return dokkaSourceSet.perPackageOptions
- .filter { packageOptions -> packageName.startsWith(packageOptions.prefix) }
- .maxBy { packageOptions -> packageOptions.prefix.length }
+ .filter { packageOptions -> Regex(packageOptions.matchingRegex).matches(packageName) }
+ .maxBy { packageOptions -> packageOptions.matchingRegex.length }
}
}