lang HTML: HEADER := $HTML"" func escape(t:Text)->HTML: t = t:replace($/&/, "&") t = t:replace($/, "<") t = t:replace($/>/, ">") t = t:replace($/"/, """) t = t:replace($/'/, "'") return HTML.from_unsafe_text(t) func escape_int(i:Int)->HTML: return HTML.from_unsafe_text("$i") func paragraph(content:HTML)->HTML: return $HTML"
$content
" func main(): >> HTML.HEADER = $HTML"" >> HTML.HEADER.text_content = "" >> 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!\""