I recently wrote an implementation of JSON Template in Typed Racket, mainly in order to get a feel for DrRacket's advantages and disadvantages relative to Common Lisp and SLIME.

In contrast to the Common Lisp version, this implementation is not used in any production code, so it is likely to contain a couple of bugs. On the other hand, the implementation is more featureful and probably prettier overall, one reason being Racket's built-in support for regular expressions.

JSON Template is a minimalistic, declarative template language.


You can fetch the Mercurial repository using the following command:

hg clone

(Mind the trailing slash. My web server is overly picky there.)

Alternatively, you can require the PLaneT version directly from Racket:

(require (planet mbenkard/json-template/json-template))


See the manual for installation and usage instructions.

Implementation Features

  • No dependencies other than Racket's built-in libraries
  • HTML and URI escaping through the use of formatters
  • Supports arbitrary <dict?> objects as input data
  • Configurable meta characters
  • GPLv3 license

Missing Things

  • Literals (like {.space} and {.meta-left}/{.meta-right})
  • Multiple-argument formatters
  • Some kind of compilation for efficiency


Example code:
(define template-string "
{.section people}
{.repeated section @}
  <li>{name} ({age} years)</li>
<p>No one's registered.</p>

(define template (make-template template-string))

(template '((title . "<Registered People>")
            (people .
                    (((name . "Nathalie") (age . 24))
                     ((name . "Heinrich") (age . 28))
                     ((name . "Hans")     (age . 25)))))))


<h1>&#60;Registered People&#62;</h1>
  <li>Nathalie (24 years)</li>
  <li>Heinrich (28 years)</li>
  <li>Hans (25 years)</li>