File tree Expand file tree Collapse file tree 1 file changed +16
-16
lines changed
core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/explainer Expand file tree Collapse file tree 1 file changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -314,29 +314,29 @@ private fun convertToDescription(dataframeLike: Any): String =
314314 else -> throw IllegalArgumentException (" Unsupported type: ${dataframeLike::class } " )
315315 }.escapeHtmlForIFrame()
316316
317- internal fun String.escapeHtmlForIFrame (): String {
318- val str = this
319- return buildString {
320- for (c in str) {
321- when {
322- c.code > 127 || c == ' \' ' || c == ' \\ ' -> {
323- append(" &#" )
324- append(c.code)
325- append(' ;' )
326- }
317+ internal fun String.escapeHtmlForIFrame (): String =
318+ buildString {
319+ for (c in this @escapeHtmlForIFrame) {
320+ when (c) {
321+ ' <' -> append(" <" )
322+
323+ ' >' -> append(" >" )
327324
328- c == ' " ' -> append(" " ;" )
325+ ' & ' -> append(" & ;" )
329326
330- c == ' < ' -> append(" &lt ;" )
327+ ' " ' -> append(" " ;" )
331328
332- c == ' > ' -> append(" &gt ;" )
329+ ' \' ' -> append(" ' ;" )
333330
334- c == ' & ' -> append(" & ;" )
331+ ' \\ ' -> append(" \ ;" )
335332
336333 else -> {
337- append(c)
334+ if (c.code > 127 ) {
335+ append(" &#${c.code} ;" )
336+ } else {
337+ append(c)
338+ }
338339 }
339340 }
340341 }
341342 }
342- }
You can’t perform that action at this time.
0 commit comments