On this page:
8.1 mischief/  examples:   Evaluating Examples for Scribble Documentation
examples/  evaluator
define-example-form
define-example-evaluator
make-example-evaluator
8.2 mischief/  web:   XML and CSS
css/  c
css?
xexpr/  c
write-css
write-xexpr
create-stylesheet
create-webpage
6.3.90.900

8 Typesetting Formats

8.1 mischief/examples: Evaluating Examples for Scribble Documentation

 (require mischief/examples) package: mischief

syntax

(examples/evaluator lang-module-path maybe-requires body ...+)

 
maybe-requires = 
  | #:requires [require-mod ...]
     
require-mod = module-path
  | (for-syntax module-path)
Like examples using an evaluator built using lang-module-path and maybe-requires. Also requires the lang-module-path and maybe-requires at the label phase.

syntax

(define-example-form name-id lang-module-path require-mod ...)

Defines a macro named name-id that works like examples, but using an evaluator based on lang-module-path and the given require-mods. Also requires the lang-module-path and require-mods at the label phase.

syntax

(define-example-evaluator name-id lang-module-path require-mod ...)

Defines an evaluator named name-id using make-example-evaluator and requires the lang-module-path and require-mods at the label phase.

procedure

(make-example-evaluator language 
  input-program ... 
  [#:requires requires 
  #:allow-for-require allow-for-require 
  #:allow-for-load allow-for-load 
  #:allow-read allow-read]) 
  (-> any/c any)
  language : 
(or/c
  module-path?
  (list/c 'special symbol?)
  (cons/c 'begin list?))
  input-program : any/c
  requires : 
(listof (or/c module-path? path-string?
          (cons/c 'for-syntax (listof module-path?))))
   = null
  allow-for-require : (listof (or/c module-path? path?)) = null
  allow-for-load : (listof path-string?) = null
  allow-read : (listof (or/c module-path? path-string?)) = null
Like make-evaluator, but called with permission and output parameters set appropriately for generating Scribble documentation.

8.2 mischief/web: XML and CSS

 (require mischief/web) package: mischief

This module provides tools for programmatic creation of static web pages. It is based on the XML collection; see documentation for xexpr?.

value

css/c : flat-contract?

procedure

(css? v)  boolean?

  v : any/c
This contract and predicate pair recognizes CSS-expressions, which are described by the following grammar:

  css = (list style ...)
     
  style-def = (cons selector (list property ...))
     
  property = (list name value)
     
  selector = text
     
  name = text
     
  value = text

Here, text is a string or a symbol.

This flat contract corresponds to xexpr?. It is reprovided from xml. In versions of PLT Racket before the implementation of xexpr/c, this module provides its own definition.

procedure

(write-css css [out])  void?

  css : css/c
  out : output-port? = (current-output-port)

procedure

(write-xexpr css [out])  void?

  css : css/c
  out : output-port? = (current-output-port)
These functions write CSS-expressions and X-expressions, respectively, to output ports, by their canonical text representations.

procedure

(create-stylesheet file css)  void?

  file : path-string?
  css : css/c

procedure

(create-webpage file xexpr)  void?

  file : path-string?
  xexpr : xexpr/c
These functions write style sheets (represented as CSS-expressions) or webpages (represented as X-expressions) to files.