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)
(list (make-flow (list (make-paragraph
(let loop ([s s])
(let ([spaces (regexp-match-positions #rx"(?:^| ) +" s)])
(if spaces (if spaces
(append (list* (substring str 0 (caar spaces))
(loop (substring s 0 (caar spaces))) (hspace (- (cdar spaces) (caar spaces)))
(list (hspace (- (cdar spaces) (caar spaces)))) (str->elts (substring str (cdar spaces))))
(loop (substring s (cdar spaces)))) (list (make-element 'tt (list str))))))
(list (make-element 'tt (list s))))))))))) (define (make-line str)
strs)))) (list (make-flow (list (make-paragraph
(list (make-element 'tt (str->elts str))))))))
(make-table #f (map make-line strs)))
(define-syntax indexed-scheme (define-syntax indexed-scheme
(syntax-rules () (syntax-rules ()