// Compiled templaters (ADR 0057): a page written as an HTML literal, as // `html`…`` and as `pug`…`` renders byte-identical output. Runs on both // backends, optimised and not. import std/html.{type Html} import std/io import std/list import std/string import std/template.{html, pug} import std/test.{assert} // http_demo's page skeleton. fn page_literal :: title: String body: Html -> Html {
Welcome, {name}! Count: {list.length items}.
Welcome, {name}! Count: {list.length items}.
body & soul
` same "page" (html.render (page_literal "T & <" body)) (html.render (page_html "T & <" body)) same "page" (html.render (page_literal "T & <" body)) (html.render (page_pug "T & <" body)) let inner = pug`p body` same "card" (html.render (card_literal "T <&" inner)) (html.render (card_html "T <&" inner)) same "card" (html.render (card_literal "T <&" inner)) (html.render (card_pug "T <&" inner)) let items: List = [pug`li one`, html`