ponies.rkt
- Код: Выделить всё
#lang racket
(struct pony (name kind coat-color mane-color)
#:transparent)
(define ponies (list
(pony "Rainbow Dash" 'pegasus 'cerulean 'rainbow)
(pony "Fluttershy" 'pegasus 'gold 'rose)
(pony "Twilight Sparkle" 'unicorn 'mulberry 'sapphire-blue)
(pony "Rarity" 'unicorn 'light-gray 'indigo)
(pony "Pinkie Pie" 'earth 'raspberry 'light-raspberry)
(pony "Applejack" 'earth 'gamboge 'olive)))
(define test #f)
(require web-server/templates)
(include-template "tpl.html")
tpl.html
- Код: Выделить всё
<html>
<body>
<h1>Ponies</h1>
<table>
<tr>
<th>Name</td>
<th>Kind</td>
<th>Coat</td>
<th>Mane</td>
</tr>
@in[p ponies]{
<tr>
<td>@(pony-name p)</td>
<td>@(pony-kind p)</td>
<td>@(pony-coat-color p)</td>
<td>@(pony-mane-color p)</td>
</tr>
}
</table>
</body>
</html>