-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathex.rkt
32 lines (24 loc) · 764 Bytes
/
ex.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#lang racket/base
(require scribble/manual
scribble/core
scribble/decode
"counter.rkt")
(provide exercise Exref exref eop)
(define eop "■")
(define (exercise tag . content)
(nested-flow
(make-style #f '()) ;; #f ==> blockquote?
(decode-flow
(append
(list (exercise-target tag) ". ")
content
(list " " eop)))))
(define exercises (new-counter "exercise"))
(define (exercise-target tag)
(counter-target exercises tag (bold "Exercise")))
(define (Exref tag)
(make-element #f (list (counter-ref exercises tag "Exercise"))))
(define (exref tag [loud #f])
(if loud
(make-element #f (list (silent-counter-ref exercises tag loud)))
(make-element #f (list (counter-ref exercises tag "exercise")))))