summaryrefslogtreecommitdiff
path: root/manual.scrbl
diff options
context:
space:
mode:
Diffstat (limited to 'manual.scrbl')
-rw-r--r--manual.scrbl53
1 files changed, 17 insertions, 36 deletions
diff --git a/manual.scrbl b/manual.scrbl
index 109ea24..9f8b6b5 100644
--- a/manual.scrbl
+++ b/manual.scrbl
@@ -1,8 +1,10 @@
#lang scribble/manual
+@;@(require planet/scribble)
@(require scribble/eval)
@(require racket/sandbox)
-@(require (for-label r6rs))
-@;@(require (for-label "json-template.s6l"))
+@(require (for-label racket))
+@(require (for-label "json-template.rkt"))
+@;@(require (for-label (this-package-in json-template)))
@(define r6rs-evaluator
(call-with-trusted-sandbox-configuration
@@ -19,45 +21,24 @@
[sandbox-error-output 'string])
(make-evaluator
'racket/base
- #:requires (list 'json-template))))))
+ #:requires (list "json-template.rkt"))))))
+@(define typed-racket-evaluator
+ (call-with-trusted-sandbox-configuration
+ (lambda ()
+ (parameterize ([sandbox-output 'string]
+ [sandbox-error-output 'string])
+ (make-evaluator
+ 'typed/racket/base
+ #:requires (list "json-template.rkt"))))))
-@title{JSON Template for R6RS}
+@title{JSON Template for Racket (and Typed Racket)}
@author{Matthias A. Benkard}
@section{Installation}
-@subsection{Installing pregexp}
-
-Download the pregexp library from @url{http://evalwhen.com/pregexp/}. Wrap @filepath{pregexp.scm} in the following form (replacing ``....'' with the file's original content):
-
-@schemeblock[
-(library (pregexp)
- (export pregexp
- pregexp-match
- pregexp-match-positions
- pregexp-split
- pregexp-replace
- pregexp-replace*
- pregexp-quote)
- (import (rnrs) (rnrs mutable-pairs))
-
- ....
-
-)
-]
-
-You can then install @filepath{pregexp.scm} as an R6RS library. For details on how to do this, consult the manual of your Scheme implementation.
-
-As an example, @codeblock[@"plt-r6rs --install pregexp.scm"] will work on @hyperlink["http://racket-lang.org/"]{Racket}.
-
-
-@subsection{Installing JSON Template for R6RS}
-
-JSON Template for R6RS is provided as a ready-to-use R6RS library file. Simply install @filepath{json-template.s6l} as per the manual of the Scheme implementation of your choice.
-
-On Racket, @codeblock[@"plt-r6rs --install json-template.s6l"] ought to work just fine.
+JSON Template for Racket is published as a PLaneT module. Simply @racket[(require (planet mbenkard/json-template))] to get started.
@section{Usage}
@@ -72,7 +53,7 @@ On Racket, @codeblock[@"plt-r6rs --install json-template.s6l"] ought to work jus
@itemlist[
@item{@bold{Primitive contexts.} These may be of any form whatever (valid primitive contexts are lists, numbers, symbols, strings, etc.) and are not treated specially. Their only purpose is being printed into the template expansion as plain text. Note that a primitive context does not make a whole lot of sense when used as an argument to @scheme{make-template} (although it can be used as such and referenced as @scheme["@"]); it is much more commonly encountered as a nested context in a map.}
@item{@bold{Sequences.} At present, these may only be lists. They can be iterated over by the use of repeated sections.}
- @item{@bold{Maps.} These may be either hash tables or association lists. They can be indexed into by substitutions.}
+ @item{@bold{Maps.} These may be any kinds of <dict?> objects; in particular, association lists and hash tables are fine choices. They can be indexed into by substitutions.}
]
@scheme[make-template]'s behavior can be customized by the parameters @scheme[formatters], @scheme[meta-left], @scheme[meta-right], @scheme[default-formatter], and @scheme[format-char].
@@ -83,7 +64,7 @@ On Racket, @codeblock[@"plt-r6rs --install json-template.s6l"] ought to work jus
@subsection{Examples}
-@interaction[#:eval r6rs-evaluator
+@interaction[#:eval racket-evaluator
(define template (make-template "
<h1>{title|html}</h1>
{.section people}