builtin-programs/web/holds.folk

When the db library is /dbLib/ {
  set db [__db]
  Wish the web server handles route "/holds" with handler {
    set holds [$dbLib holds $db]

    html [subst {
      <html>
      <head>
        <link rel="stylesheet" href="/style.css">
        <title>Statement Holds</title>
      </head>
      <h1>Statement Holds</h1>
      <ol>
        [join [lmap holdObj $holds {
            lassign $holdObj key version ref clause
            subst {<li>$key ($version): ($ref) <pre>[htmlEscape [string range $clause 0 300]]</pre></li>}
        }] "\n"]
      </ol>
      </html>
    }]
  }
}