import std/html.{type Element, type Html} import std/list import std/template.{type Hole, type Template, Template, Text, html, pug, xml} // std's `html` compiles the template to the tree (ADR 0057): an // `Element`, its holes typed by position. fn para :: name: String { html`
{name}
` } //~ TYPE para: fn(String) -> Element fn shown :: n: Int -> Html { html`{n}
` } fn debugged :: n: Int -> Html { html`{n:?}`
}
fn embed :: body: Html -> Html
{
html`{f}
` //~ ERROR E0401 does not implement `Show` } pub fn unknown_tag :: -> Html { puug`.card` //~ ERROR E0101 no value named `puug` } pub fn tag_not_a_function :: -> () { let x = 42 x`nope` //~ ERROR E0207 this is not a function } // std's templaters are syntax, not values (ADR 0057): outside a // template's tag position they do not exist as values. pub fn pug_as_value :: -> () { let t = pug //~ ERROR E0605 syntax, not values } pub fn html_as_value :: templates: List> -> List { list.map templates html //~ ERROR E0605 syntax, not values } pub fn xml_qualified_as_value :: -> () { let x = template.xml //~ ERROR E0605 syntax, not values } // A local shadowing a templater is an ordinary value. pub fn shadowed :: -> Int { let pug = 42 pug } // A custom templater is any function from a `Template`. pub fn shout :: template: Template