defs.rkt 1.15 KB
Newer Older
Robert Ricci's avatar
Robert Ricci committed
1
#lang racket/base
Robert Ricci's avatar
Robert Ricci committed
2
(require scribble/base)
3 4 5
(require scribble/decode)
(require racket/class)
(require racket/draw)
Robert Ricci's avatar
Robert Ricci committed
6 7 8

(provide (all-defined-out))

9 10 11 12 13 14 15 16
(define apt-base-url "https://www.aptlab.net/")

(define screenshot-width 650)

(define apturl
  (case-lambda
    [() apt-base-url]
    [(page) (string-append apt-base-url page)]))
Robert Ricci's avatar
Robert Ricci committed
17

18
(define (TODO . what)
19
  (bold "TODO: " (decode-content what)))
20 21 22 23 24 25 26 27

(define nodetype
  (lambda (typename howmany . properties)
          (tabular #:style 'boxed #:sep (hspace 3)
                   (cons
                     (list (bold typename)
                           (string-append (number->string howmany) " nodes"))
                     properties))))
28 29 30 31 32 33 34 35 36 37 38 39

(define (instructionstep step #:screenshot [screenshot #f] . body)
  (item (bold (decode-content (list step)))
        (linebreak)
        (if screenshot
          (let* ([path (string-append "screenshots/" screenshot)]
                 [b (make-object bitmap% path)]
                 [width (send b get-width)]
                 [scale-factor (/ screenshot-width width)])
            (list (image #:scale scale-factor path screenshot) (linebreak)))
          (void))
        (decode-content body)))