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 =
314
314
else -> throw IllegalArgumentException (" Unsupported type: ${dataframeLike::class } " )
315
315
}.escapeHtmlForIFrame()
316
316
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(" >" )
327
324
328
- c == ' " ' -> append(" " ;" )
325
+ ' & ' -> append(" & ;" )
329
326
330
- c == ' < ' -> append(" &lt ;" )
327
+ ' " ' -> append(" " ;" )
331
328
332
- c == ' > ' -> append(" &gt ;" )
329
+ ' \' ' -> append(" ' ;" )
333
330
334
- c == ' & ' -> append(" & ;" )
331
+ ' \\ ' -> append(" \ ;" )
335
332
336
333
else -> {
337
- append(c)
334
+ if (c.code > 127 ) {
335
+ append(" &#${c.code} ;" )
336
+ } else {
337
+ append(c)
338
+ }
338
339
}
339
340
}
340
341
}
341
342
}
342
- }
You can’t perform that action at this time.
0 commit comments