56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
-
-
-
+
+
|
(syntax-parse stx
[(_ TAG:id)
(with-syntax ([((POLY-TARGET POLY-FUNC) ...)
(for/list ([target (in-list (setup:poly-targets))])
(list target (format-id stx "~a-~a" target #'TAG)))]
[DEFAULT-FUNC (format-id stx "html-~a" #'TAG)])
#'(define-tag-function (TAG attributes elems)
(define args (cons attributes elems))
(case (current-poly-target)
[(POLY-TARGET) (apply POLY-FUNC args)] ...
[else (apply DEFAULT-FUNC args)])))]))
[(POLY-TARGET) (POLY-FUNC attributes elems)] ...
[else (DEFAULT-FUNC attributes elems)])))]))
;; Like above, but uses `define` instead of `define-tag-function`.
;; Use this when you know you will not need keyword arguments.
;;
(define-syntax (poly-branch-tag stx)
(syntax-parse stx
[(_ TAG:id)
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
-
+
|
(poly-branch-tag blockquote)
(poly-branch-tag newthought)
(poly-branch-tag smallcaps)
(poly-branch-tag center)
(poly-branch-tag section)
(poly-branch-tag subsection)
(poly-branch-tag code)
(poly-branch-tag blockcode)
(poly-branch-kwargs-tag blockcode)
(poly-branch-kwargs-tag verse) ; [#:title ""] [#:italic "no"]
(poly-branch-tag link)
(poly-branch-tag url)
(poly-branch-tag fn)
(poly-branch-tag fndef)
|