-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.rkt
61 lines (45 loc) · 1.38 KB
/
utils.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
51
52
53
54
55
56
57
58
59
60
61
#lang at-exp racket
;;-*- Scheme -*-
(require
scribble/base
scribble/bnf
scribble/core
scribble/decode
scribble/manual
scriblib/autobib
scriblib/footnote
(for-syntax syntax/parse))
(provide (all-defined-out))
(define variant (make-parameter '#:short))
(define (long?) (eq? (variant) '#:long))
(define-syntax-rule (longonly x ...)
(when (long?) (decode-content (list x ...))))
(define (note-url url)
(note (hyperlink url url)))
(define-syntax-rule (XXX . rest) '())
(define (sf . str) (make-element 'sf (decode-content str)))
(define (moneyquote . x) (bold x))
(define (q . x) (list "“" x "”"))
(define-syntax (clblock stx)
(syntax-parse stx
[(_ #:line-numbers ln str ...)
#'@codeblock[;;#:keep-lang-line? #f
#:line-numbers ln
#:line-number-sep 3
str ...]]
[(_ str ...)
#'(clblock #:line-numbers 0 str ...)]))
(define-syntax (clcode stx)
(syntax-parse stx
[(_ str ...) #'(clblock #:line-numbers #f str ...)]))
(define (cl . str)
(apply tt str))
(define (latin x) (emph x))
(define (ad_hoc) @latin{ad hoc})
(define (de_facto) @latin{de facto})
(define (bydef . x) (emph x))
(define (FRR) "François-René Rideau")
(define-cite ~cite cite-noun generate-bib #:style number-style)
(define-syntax-rule (define-bib name stuff ...)
(define name (make-bib stuff ...)))
(define (story . x) (emph x))