made verbatim take any number of arguments (and reformat code)

svn: r8698

original commit: 7e736230321ff6625327b51a31950e653faed2bb
This commit is contained in:
Eli Barzilay 2008-02-18 09:36:40 +00:00
parent 454ac77d5f
commit b2336626fa

View File

@ -187,21 +187,19 @@
(make-element "schemeinput" (list (substring s (cdar spaces) (caar end-spaces)))) (make-element "schemeinput" (list (substring s (cdar spaces) (caar end-spaces))))
(hspace (- (cdar end-spaces) (caar end-spaces))))))))) (hspace (- (cdar end-spaces) (caar end-spaces)))))))))
(define (verbatim s) (define (verbatim s . more)
(let ([strs (regexp-split #rx"\n" s)]) (define strs (regexp-split #rx"\n" (apply string-append s more)))
(make-table (define (str->elts str)
#f (let ([spaces (regexp-match-positions #rx"(?:^| ) +" str)])
(map (lambda (s) (if spaces
(list (make-flow (list (make-paragraph (list* (substring str 0 (caar spaces))
(let loop ([s s]) (hspace (- (cdar spaces) (caar spaces)))
(let ([spaces (regexp-match-positions #rx"(?:^| ) +" s)]) (str->elts (substring str (cdar spaces))))
(if spaces (list (make-element 'tt (list str))))))
(append (define (make-line str)
(loop (substring s 0 (caar spaces))) (list (make-flow (list (make-paragraph
(list (hspace (- (cdar spaces) (caar spaces)))) (list (make-element 'tt (str->elts str))))))))
(loop (substring s (cdar spaces)))) (make-table #f (map make-line strs)))
(list (make-element 'tt (list s)))))))))))
strs))))
(define-syntax indexed-scheme (define-syntax indexed-scheme
(syntax-rules () (syntax-rules ()