(define h-footnote-count 0) (define h-footnote-port #f) (mistie-def-ctl-seq 'footnote (lambda () ; ;print the footnote's number, but file away the ;footnote text in h-footnote-port ; (unless h-footnote-port (set! h-footnote-port (open-output-string))) (set! h-footnote-count (+ h-footnote-count 1)) (set! h-recent-label (string-append "FOOTNOTE_" (number->string h-footnote-count))) (set! h-recent-label-value h-footnote-count) (display "") (display h-footnote-count) (display "") (let ((old-output-port (current-output-port))) (mistie-push-frame) (current-output-port h-footnote-port) (newline) (display "
") (display h-footnote-count) (display " ") (h-ignore-spaces) (let ((ch (read-char))) (unless (eqv? ch #\{) (error "footnote: expected #\\{ but got" ch))) (mistie-def-char #\} (lambda () (newline) (current-output-port old-output-port) (mistie-pop-frame)))))) (define h-output-footnotes (lambda () (when h-footnote-port (newline) (newline) (display "
") (newline) (newline) (display (get-output-string h-footnote-port)) (set! h-footnote-port #f))))