Skip to content

Commit

Permalink
refactor kdoc sanitization
Browse files Browse the repository at this point in the history
  • Loading branch information
tabilzad committed Oct 2, 2024
1 parent 723c194 commit 64108df
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions create-plugin/src/main/kotlin/io/github/tabilzad/ktor/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,11 @@ internal fun FirDeclaration.getKDocComments(configuration: PluginConfiguration):
if (!configuration.useKDocsForDescriptions) return null

fun String.sanitizeKDoc(): String {
val lines = trim().lines().map { it.trim() }
return lines.filter { it.isNotEmpty() && it != "*" }
return removePrefix("/**")
.removeSuffix("*/")
.lineSequence()
.joinToString("\n") { line ->
line.removePrefix("/**")
.removeSuffix("*/")
.removePrefix("*/")
.trimMargin("*")
line.trim().removePrefix("*")
}
.trim()
}
Expand Down

0 comments on commit 64108df

Please sign in to comment.