///|
const NODE_RENDER_SEPARATOR = ""
///|
pub fn sexp_to_html(
source : String,
separator? : String = NODE_RENDER_SEPARATOR,
) -> Result[String, String] {
parse_sexp_html(source).map(nodes => render_html(nodes, separator~))
}
///|
pub fn render_html(
nodes : Array[SexpNode],
separator? : String = NODE_RENDER_SEPARATOR,
) -> String {
nodes.map(render_node).join(separator)
}
///|
pub fn render_html_document(
attrs : Array[(String, String?)],
head : Array[SexpNode],
body : Array[SexpNode],
doctype : String?,
) -> String {
let lines : Array[String] = []
match doctype {
Some(value) => lines.push("")
None => ()
}
lines.push(render_open_tag("html", attrs))
lines.push(" ")
push_rendered_lines(lines, head, " ")
lines.push(" ")
lines.push(" ")
push_rendered_lines(lines, body, " ")
lines.push(" ")
lines.push("