Skip to content

Commit

Permalink
Merge branch 'master' into composite_build_new
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Mar 9, 2023
2 parents da2bf6b + 6b46d95 commit 044053f
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ internal fun String.parseHtmlEncodedWithNormalisedSpaces(
*/
internal fun String.parseWithNormalisedSpaces(
renderWhiteCharactersAsSpaces: Boolean
): List<DocTag> =
//parsing it using jsoup is required to get codePoints, otherwise they are interpreted separately, as chars
//But we dont need to do it for java as it is already parsed with jsoup
Jsoup.parseBodyFragment(this).body().wholeText().parseHtmlEncodedWithNormalisedSpaces(renderWhiteCharactersAsSpaces)
): List<DocTag> {
if (!requiresHtmlEncoding()) {
return parseHtmlEncodedWithNormalisedSpaces(renderWhiteCharactersAsSpaces)
}
// parsing it using jsoup is required to get codePoints, otherwise they are interpreted separately, as chars
// But we dont need to do it for java as it is already parsed with jsoup
return Jsoup.parseBodyFragment(this).body().wholeText().parseHtmlEncodedWithNormalisedSpaces(renderWhiteCharactersAsSpaces)
}

private fun String.requiresHtmlEncoding(): Boolean = indexOf('&') != -1

0 comments on commit 044053f

Please sign in to comment.