org.jetbrains.kotlinx.jupyter.htmlUtil.kt Maven / Gradle / Ivy
package org.jetbrains.kotlinx.jupyter
import org.jetbrains.kotlinx.jupyter.api.VariableState
const val varsTableStyleClass = "variables_table"
fun generateHTMLVarsReport(variablesState: Map): String {
return buildString {
append(generateStyleSection())
if (variablesState.isEmpty()) {
append("Variables State's Empty
\n")
return toString()
}
append("Variables State
\n")
append(generateVarsTable(variablesState))
}
}
fun generateStyleSection(borderPx: Int = 1, paddingPx: Int = 5): String {
//language=HTML
val styleSection = """
""".trimIndent()
return styleSection
}
fun generateVarsTable(variablesState: Map): String {
return buildString {
append(
"""
Variable
Value
""".trimIndent()
)
variablesState.entries.forEach {
append(
"""
${it.key}
${it.value.stringValue}
""".trimIndent()
)
}
append("\n
\n")
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy