ref: 509d071791cc2c008759f637931b7afea73c083b
dir: /lib/escfmt/eschtml.myr/
use std
pkg escfmt =
type eschtml = byte[:]
const html : (s : byte[:] -> eschtml)
;;
const __init__ = {
var s = ("" : eschtml)
std.fmtinstall(std.typeof(s), htmlfmt, [][:])
}
const html = {s
-> (s : eschtml)
}
const htmlfmt = {sb, ap, args
var s : byte[:]
s = std.vanext(ap)
for c : std.bychar(s)
match c
| '&': std.sbputs(sb, "&")
| '<': std.sbputs(sb, "<")
| '>': std.sbputs(sb, ">")
| '/': std.sbputs(sb, "/")
| _: std.sbputc(sb, c)
;;
;;
}