lang HTML: HEADER := $HTML"" func HTML(t:Text->HTML): t = t:replace_all({ $/&/="&", $/="<", $/>/=">", $/"/=""", $/'/="'", }) return HTML.without_escaping(t) func HTML(i:Int->HTML): return HTML.without_escaping("$i") func paragraph(content:HTML->HTML): return $HTML"
$content
" struct Bold(text:Text): func HTML(b:Bold -> HTML): return $HTML"$(b.text)" func main(): >> HTML.HEADER = $HTML"" >> HTML.HEADER[1] = $HTML"<" >> HTML.HEADER.text = "" >> user := "I <3 hax" >> html := $HTML"Hello $user!" = $HTML"Hello I <3 hax!" >> html ++ $HTML"Hello I <3 hax!
" >> Text(html) = '$HTML"Hello I <3 hax!"' >> b := Bold("Some