-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcommon.rkt
50 lines (38 loc) · 1.17 KB
/
common.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#lang racket/base
(provide markdown-inline
markdown-part
ABOUT.md
terminal
select-monster-db-tag
ref-doc
gui-doc)
(require markdown
markdown/scrib
racket/match
racket/runtime-path
scribble/base
scribble/decode)
(define-runtime-path ABOUT.md "../ABOUT.md")
(define (markdown-inline file)
(xexprs->scribble-pres
(strip-html-comments
(with-input-from-file file read-markdown))))
(define (markdown-part file)
(decode
(xexprs->scribble-pres
(strip-html-comments
(with-input-from-file file read-markdown)))))
(define (strip-html-comments xexpr)
(match xexpr
[(cons '!HTML-COMMENT _) ""]
[(list tag (list (list attr val) ...) x ...)
(list* tag (map list attr val)
(map strip-html-comments x))]
[(list tag x ...) (list* tag (map strip-html-comments x))]
[else xexpr]))
(define (terminal . args)
(nested #:style 'code-inset
(apply verbatim args)))
(define select-monster-db-tag "select-monster-db")
(define ref-doc '(lib "scribblings/reference/reference.scrbl"))
(define gui-doc '(lib "scribblings/gui/gui.scrbl"))