dmcg
10/15/2024, 9:22 AMfun partial(block: FlowContent.() -> Unit): String {
val writer = StringWriter()
val consumer = writer.appendHTML()
// hacky stuff so we don't have to return a wrapper div
object : FlowContent {
override val consumer = consumer
override val attributes: MutableMap<String, String>
get() = mutableMapOf()
override val attributesEntries: Collection<Map.Entry<String, String>>
get() = emptyList()
override val emptyTag: Boolean
get() = true
override val inlineTag: Boolean
get() = true
override val namespace: String?
get() = null
override val tagName: String
get() = ""
}.block()
return writer.toString()
}
I don’t know the library well enough to choose between the approaches, but thanks giving for your experience.