import std/html.{type Html} import std/io import std/template.{pug} fn layout :: title: String content: Html -> Html { pug` html body.main h1#top {title} | byline // a comment .content {content} ` } pub fn main :: -> () / { io.println (html.render pug`.card`) io.println (html.render pug`h1.title Hello, {"Ada & "}!`) io.println (html.render pug`a(href="/x?y={1 + 1}" class="link") go`) io.println (html.render pug`input(type="text" disabled)`) io.println (html.render pug`p count: {40 + 2}`) io.println (html.render pug`p before {pug`b inside`} after`) io.println (html.render (layout "A & B" pug`p `)) // Bool attribute holes are flags (present iff true), `Option` // is absent for `None` (ADR 0057). let on = True let off = False let none: Option = None io.println (html.render pug`input(required={on} autofocus={off} value={none})`) io.println ( html.render pug` ul li one li two p.after done ` ) // Attribute names take `:` and `.`, as a literal's do (issue #300): // htmx 4's modifiers, Alpine's directives; tag names take `:`. io.println ( html.render pug`section#shelf(hx-target:inherited="#shelf" hx-status:422="target:#composer")` ) io.println (html.render pug`button(x-on:click.prevent="save()") save`) io.println (html.render pug`svg:rect(width="1")`) } //>
//>

Hello, Ada & <Co>!

//> go //> //>

count: 42

//>

before inside after

//>

A & B

byline

<not-a-tag>

//> //>
  • one
  • two

done

//>
//> //>