diff --git a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/explainer/PluginCallbackProxy.kt b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/explainer/PluginCallbackProxy.kt index dd74e411f..17bb2f618 100644 --- a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/explainer/PluginCallbackProxy.kt +++ b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/explainer/PluginCallbackProxy.kt @@ -314,29 +314,29 @@ private fun convertToDescription(dataframeLike: Any): String = else -> throw IllegalArgumentException("Unsupported type: ${dataframeLike::class}") }.escapeHtmlForIFrame() -internal fun String.escapeHtmlForIFrame(): String { - val str = this - return buildString { - for (c in str) { - when { - c.code > 127 || c == '\'' || c == '\\' -> { - append("&#") - append(c.code) - append(';') - } +internal fun String.escapeHtmlForIFrame(): String = + buildString { + for (c in this@escapeHtmlForIFrame) { + when (c) { + '<' -> append("<") + + '>' -> append(">") - c == '"' -> append(""") + '&' -> append("&") - c == '<' -> append("&lt;") + '"' -> append(""") - c == '>' -> append("&gt;") + '\'' -> append("'") - c == '&' -> append("&") + '\\' -> append("\") else -> { - append(c) + if (c.code > 127) { + append("&#${c.code};") + } else { + append(c) + } } } } } -} diff --git a/docs/README.md b/docs/README.md index 7fbaa78f6..3471d1beb 100644 --- a/docs/README.md +++ b/docs/README.md @@ -62,5 +62,3 @@ Code samples for the documentation website reside in [core/.../test/.../samples/ and [tests/.../samples/api](../tests/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api) (for samples can depend on other I/O modules) and they are copied over to Markdown files in [docs/StardustDocs/topics](./StardustDocs/topics) by [Korro](https://github.com/devcrocod/korro). - - diff --git a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Access.columnSelectorsMisc.html b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Access.columnSelectorsMisc.html index 29b762e40..32e25b555 100644 --- a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Access.columnSelectorsMisc.html +++ b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Access.columnSelectorsMisc.html @@ -226,7 +226,7 @@
- df.select { colsOf&lt;String&gt;() } + df.select { colsOf<String>() }
Input DataFrame: rowsCount = 7, columnsCount = 6
@@ -242,7 +242,7 @@

- df.select { colsOf&lt;String?&gt; { it.countDistinct() &gt; 5 } } + df.select { colsOf<String?> { it.countDistinct() > 5 } }
Input DataFrame: rowsCount = 7, columnsCount = 6
@@ -438,7 +438,7 @@

- df.select { colsAtAnyDepth().colsOf&lt;String&gt;() } + df.select { colsAtAnyDepth().colsOf<String>() }
Input DataFrame: rowsCount = 7, columnsCount = 6
@@ -454,7 +454,7 @@

- df.select { allExcept { colsOf&lt;String&gt;() } } + df.select { allExcept { colsOf<String>() } }
Input DataFrame: rowsCount = 7, columnsCount = 6
diff --git a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Access.columnSelectorsModifySet.html b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Access.columnSelectorsModifySet.html index 52e480ab8..51719d24a 100644 --- a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Access.columnSelectorsModifySet.html +++ b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Access.columnSelectorsModifySet.html @@ -274,7 +274,7 @@

- df.select { (colsOf&lt;Int&gt;() and age).distinct() } + df.select { (colsOf<Int>() and age).distinct() }
Input DataFrame: rowsCount = 7, columnsCount = 5
diff --git a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Access.columnSelectorsUsages.html b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Access.columnSelectorsUsages.html index 1b405ef82..47a3e74ce 100644 --- a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Access.columnSelectorsUsages.html +++ b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Access.columnSelectorsUsages.html @@ -194,7 +194,7 @@

- df.fillNaNs { colsAtAnyDepth().colsOf&lt;Double&gt;() }.withZero() + df.fillNaNs { colsAtAnyDepth().colsOf<Double>() }.withZero()
Input DataFrame: rowsCount = 7, columnsCount = 5
@@ -270,7 +270,7 @@

- df.gather { colsOf&lt;Number&gt;() }.into("key", "value") + df.gather { colsOf<Number>() }.into("key", "value")
Input DataFrame: rowsCount = 7, columnsCount = 5
diff --git a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.columnsFor.html b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.columnsFor.html index d4307ef33..e2c2e9c37 100644 --- a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.columnsFor.html +++ b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.columnsFor.html @@ -178,7 +178,7 @@
- df.minFor { colsOf&lt;Int&gt;() } + df.minFor { colsOf<Int>() }
Input DataFrame: rowsCount = 7, columnsCount = 5
diff --git a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.countAggregation.html b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.countAggregation.html index 8606bab03..8f74a8f1b 100644 --- a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.countAggregation.html +++ b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.countAggregation.html @@ -200,7 +200,7 @@

- df.pivot { city }.count { age &gt; 18 } + df.pivot { city }.count { age > 18 }
Input DataFrame: rowsCount = 7, columnsCount = 5
diff --git a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.DataRowApi.conditions.html b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.DataRowApi.conditions.html index 6ddaed2e0..43fa7239b 100644 --- a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.DataRowApi.conditions.html +++ b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.DataRowApi.conditions.html @@ -210,7 +210,7 @@

- df.update { weight }.where { index() &gt; 4 && city != "Paris" }.with { 50 } + df.update { weight }.where { index() > 4 && city != "Paris" }.with { 50 }
Input DataFrame: rowsCount = 7, columnsCount = 5
diff --git a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Join.joinWithMatch.html b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Join.joinWithMatch.html index 0b0c689c6..7637c598c 100644 --- a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Join.joinWithMatch.html +++ b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Join.joinWithMatch.html @@ -178,7 +178,7 @@
- other.into("fullName").cast&lt;Right&gt;() + other.into("fullName").cast<Right>()
Input DataFrame: rowsCount = 7, columnsCount = 3
diff --git a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.convert.html b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.convert.html index 5038a6108..4e7091b31 100644 --- a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.convert.html +++ b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.convert.html @@ -198,7 +198,7 @@

- df.convert { colsAtAnyDepth().colsOf&lt;String&gt;() }.with { it.toCharArray().toList() } + df.convert { colsAtAnyDepth().colsOf<String>() }.with { it.toCharArray().toList() }
Input DataFrame: rowsCount = 7, columnsCount = 5
diff --git a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.convertTo.html b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.convertTo.html index efbbbc02a..c915e7f07 100644 --- a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.convertTo.html +++ b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.convertTo.html @@ -178,7 +178,7 @@
- df.convert { age }.to&lt;Double&gt;() + df.convert { age }.to<Double>()
Input DataFrame: rowsCount = 7, columnsCount = 5
@@ -198,7 +198,7 @@

- df.convert { colsOf&lt;Number&gt;() }.to&lt;String&gt;() + df.convert { colsOf<Number>() }.to<String>()
Input DataFrame: rowsCount = 7, columnsCount = 5
diff --git a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.fillNulls.html b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.fillNulls.html index 09e320d86..458a2e13c 100644 --- a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.fillNulls.html +++ b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.fillNulls.html @@ -178,7 +178,7 @@
- df.fillNulls { colsOf&lt;Int?&gt;() }.with { -1 } + df.fillNulls { colsOf<Int?>() }.with { -1 }
Input DataFrame: rowsCount = 7, columnsCount = 5
@@ -200,7 +200,7 @@

- df.update { colsOf&lt;Int?&gt;() }.where { it == null }.with { -1 } + df.update { colsOf<Int?>() }.where { it == null }.with { -1 }
Input DataFrame: rowsCount = 7, columnsCount = 5
diff --git a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.gatherNames.html b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.gatherNames.html index 7ddf1b7f2..b1fdf69db 100644 --- a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.gatherNames.html +++ b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.gatherNames.html @@ -200,7 +200,7 @@

- pivoted.gather { "London".."Tokyo" }.cast&lt;Int&gt;().where { it &gt; 0 }.keysInto("city") + pivoted.gather { "London".."Tokyo" }.cast<Int>().where { it > 0 }.keysInto("city")
Input DataFrame: rowsCount = 6, columnsCount = 9
diff --git a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.update.html b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.update.html index 711a79244..0bb71306c 100644 --- a/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.update.html +++ b/docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.update.html @@ -200,7 +200,7 @@

- df.update { colsAtAnyDepth().colsOf&lt;String&gt;() }.with { it.uppercase() } + df.update { colsAtAnyDepth().colsOf<String>() }.with { it.uppercase() }
Input DataFrame: rowsCount = 7, columnsCount = 5
diff --git a/docs/StardustDocs/topics/DataSchema-Data-Classes-Generation.md b/docs/StardustDocs/topics/DataSchema-Data-Classes-Generation.md index f369b5fa9..d5faa6c62 100644 --- a/docs/StardustDocs/topics/DataSchema-Data-Classes-Generation.md +++ b/docs/StardustDocs/topics/DataSchema-Data-Classes-Generation.md @@ -164,8 +164,6 @@ val customers: List = df.cast().toList() - - ## generateCode ```kotlin @@ -202,6 +200,8 @@ the generated Kotlin code of `@DataSchema` interfaces and/or extension propertie ### Examples {id="generateCode-examples"} + + ```kotlin df.generateCode("Customer") ``` diff --git a/tests/build.gradle.kts b/tests/build.gradle.kts index 8018e9224..7229065b7 100644 --- a/tests/build.gradle.kts +++ b/tests/build.gradle.kts @@ -61,7 +61,7 @@ kotlin.sourceSets { korro { docs = fileTree(rootProject.rootDir) { // todo topics/*.md as a part of #898 - include("docs/StardustDocs/topics/Utilities-Generation.md") + include("docs/StardustDocs/topics/DataSchema-Data-Classes-Generation.md") include("docs/StardustDocs/topics/read.md") include("docs/StardustDocs/topics/write.md") include("docs/StardustDocs/topics/rename.md")