As announced previously, I recently wrote an implementation of JSON Template in Typed Racket. This is a port of the original untyped Racket code to R6RS.

Like the Racket version, it is likely to contain a number of bugs because of lack of real-world usage.

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.)

Documentation and Installation

See the manual for installation and usage instructions.


JSON Template for R6RS depends on the pregexp library.

Implementation Features

  • HTML and URI escaping through the use of formatters
  • Supports both association lists and hash tables 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>